Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RPS control with ramp-up for tuple writes #464

Closed
wants to merge 4 commits into from

Conversation

Siddhant-K-code
Copy link
Contributor

Description

This PR adds support for specifying RPS (Requests Per Second) for writes while allowing for ramp-up over a period of time. It implements the following features:

  • Adds three new flags to the tuple write and tuple import commands:

    • min-rps: Minimum requests per second for writes
    • max-rps: Maximum requests per second for writes
    • rampup-period-in-sec: Period in seconds to ramp up from min-rps to max-rps
  • These flags are optional by default, but if one is provided, all three are required with positive values

  • When these flags are provided, the SDK:

    • Starts writing tuples at the min-rps rate
    • Gradually increases to max-rps over the specified rampup period
    • If all tuples are written before the rampup period ends, the command exits
    • If the rampup period ends and there are still tuples to write, the command continues writing at the max-rps rate until all tuples are written

Testing

Added a test case to verify the RPS control functionality. The test ensures that:

  • The rate limiting works as expected
  • The duration of the write operation is consistent with the specified RPS parameters

References

fixes #463

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@Siddhant-K-code Siddhant-K-code requested a review from a team as a code owner March 10, 2025 17:58
@Siddhant-K-code Siddhant-K-code marked this pull request as draft March 10, 2025 18:04
@Siddhant-K-code
Copy link
Contributor Author

ahh! I just saw that the issue was already In-progress in the SDK board. Closing this

@Siddhant-K-code Siddhant-K-code deleted the feat/463 branch March 10, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support specifying RPS for Writes while allowing for ramp up over a period of time
1 participant