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 support for load-shedding. #1616

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

abizjak
Copy link

@abizjak abizjak commented Jan 30, 2024

Add an option to enable load shedding for the service constructed for the connection.

Motivation

In the server we are implementing we want to load-shed when the service is overloaded, and we want to limit the number of concurrent requests per connection. We use tower::load_shed layer for load shedding, but this only applies to the entire service.

If we additionally apply the per-connection concurrency limit the issue is that this limit is typically hit first and so the service responds with "not ready". As a result the load-shed layer of the service is never reached meaning that requests just queue up.

Solution

The solution is to optionally add a load-shed layer to the per-connection service constructed by tonic.

When the per-connection service is not ready this gives an option of immediately
rejecting requests.
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.

None yet

1 participant