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

Proposed Feature/PR - In-flight request concurrency limiter package #953

Closed
JimFicarra opened this issue Feb 2, 2020 · 2 comments
Closed

Comments

@JimFicarra
Copy link

JimFicarra commented Feb 2, 2020

Hi folks,

I recently had a need to limit the number of concurrently executing requests in some of our services instead of implementing ratelimit to protect the services from being over-consumed. In our situation the ratelimit package didn't fit our needs because the nature of the requests we are processing tend to be highly variant in latency and resource consumption.

To address this I created an endpoint.Middleware concurrency limiter package that, like ratelimit, provides capability to:

  • deny with error when max request concurrency is reached
  • block until in-flight requests are processed and capacity becomes available and can be processed
  • be chained with other middleware endpoints (since it's an endpoint.Middlware type)

Go-kit has been very helpful for us and I'd like to contribute this back. Let me know if there's interest and I will submit a PR for review.

Thanks!

-Jim Ficarra

@JimFicarra JimFicarra changed the title Proposed Feature/PR - In-flight request concurrency limiter Proposed Feature/PR - In-flight request concurrency limiter package Feb 2, 2020
@JimFicarra
Copy link
Author

@peterbourgon @ChrisHines @briankassouf @basvanbeek - sorry for the bump - wanted to see if any interest in this PR?

@peterbourgon
Copy link
Member

peterbourgon commented Feb 12, 2020

Hey @JimFicarra, sorry for the delay, I had a response typed up some time ago but didn't click Comment 🤦‍♂ Thanks for the idea. Do you have a link to the package?

In general I'm trying to reduce the amount of code in the repo, rather than add to it. I ask: can users implement this feature in their own code? If so, I'd like to avoid bringing it in, and adding to the maintenance burden. Essentially all middlewares can be implemented in user code; changes to e.g. how the HTTP server works cannot.

In the next major version of Go kit (see #843) I expect to remove packages ratelimit, circuitbreaker, sd, and kitgen, at a minimum.

No slight against you, and I hope you'll comment with a link to your package, so anyone who comes by later can find it and use it, if they like. Thanks again!

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

No branches or pull requests

2 participants