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

Refactor RateLimitController: improve accuracy and support maxQps threshold > 1000 #2951

Merged
merged 2 commits into from
Nov 30, 2022

Conversation

sczyh30
Copy link
Member

@sczyh30 sczyh30 commented Nov 14, 2022

Describe what this PR does / why we need it

Refactor RateLimitController: improve accuracy and support maxQps threshold > 1000.

Does this pull request fix one issue?

Resolves #399, #259

Describe how you did it

  • Improve accuracy: use nanoseconds when necessary and support maxQps threshold > 1000 (i.e. wait < 1ms)
  • Rename RateLimitController to ThrottlingController

Describe how to verify it

Run the test cases and demo.

Special notes for reviews

NOTE: this PR contains breaking change (for public class name).

… 1000

* Rename to ThrottlingController
* Improve accuracy: use nanoseconds when necessary and support maxQps threshold > 1000 (i.e. wait < 1ms)

Signed-off-by: Eric Zhao <[email protected]>
@sczyh30 sczyh30 added kind/enhancement Category issues or prs related to enhancement. to-review To review area/flow-control Issues or PRs related to flow control labels Nov 14, 2022
@sczyh30 sczyh30 linked an issue Nov 14, 2022 that may be closed by this pull request
@sczyh30 sczyh30 marked this pull request as ready for review November 14, 2022 15:26
@sczyh30 sczyh30 added this to the v2.0.0 milestone Nov 14, 2022
@sczyh30 sczyh30 removed the to-review To review label Nov 30, 2022
@sczyh30 sczyh30 merged commit 6dc2fdb into alibaba:master Nov 30, 2022
@imhansai
Copy link

this.useNanoSeconds = statDurationMs % Math.round(maxCountPerStat) != 0 || maxCountPerStat / statDurationMs > 1;

Math.round(maxCountPerStat) 这里可能出现除零异常,例如 count 设置为 0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/flow-control Issues or PRs related to flow control kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
3 participants