Skip to content

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

Merged
sczyh30 merged 2 commits intoalibaba:masterfrom
sczyh30:fix-throttling-controller
Nov 30, 2022
Merged

Refactor RateLimitController: improve accuracy and support maxQps threshold > 1000#2951
sczyh30 merged 2 commits intoalibaba:masterfrom
sczyh30:fix-throttling-controller

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).

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
… 1000

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

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@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