-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Reimplement the concurrency limiter middleware to use the new abstractions & implementations #39040
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
Reimplement the concurrency limiter middleware to use the new abstractions & implementations #39040
Conversation
src/Middleware/ConcurrencyLimiter/src/QueuePolicies/BasePolicy.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable - my feeling is we can start with this then make the breaking API change as a next stop (as opposed to obsoletion), but I'm open to persuasion
How do the microbenchmarks look before and after? I'm expecting a big regression 😨 |
I think we should pick a new namespace ( |
The new middleware is a separate topic (#37384). I expect to make minimal changes to the old one and gradually phase it out. |
src/Middleware/ConcurrencyLimiter/src/QueuePolicies/BasePolicy.cs
Outdated
Show resolved
Hide resolved
1 Before:
After:
2 Before:
After:
3
After:
Note RejectingRapidly_StackPolicy is misleading because of dotnet/runtime#62817 |
ef3fd3d
to
b5de7cd
Compare
Contributes to #38306, not sure if we want to take it further with breaking API changes? Or do we obsolete it in favor of the new one?
This is a literal replacement of the implementations from the old middleware with the new RateLimiter components. It's not a perfect fit, but it's close enough.
Outstanding issue: dotnet/runtime#62817
Design mismatch: IQueuePolicy has an explicit release API, where ConcurrencyLimiter returns a lease that's disposable. Layering IQueuePolicy on ConcurrencyLimiter requires tracking the outstanding leases.
I was able to combine QueuePolicy and StackPolicy since the only difference is the order enum.