tonic icon indicating copy to clipboard operation
tonic copied to clipboard

Include Tower feature 'load-shed'

Open GrandmasterTash opened this issue 4 years ago • 2 comments

Feature Request

Please add the tower feature 'load-shed' to cargo.toml

Motivation

Under heavy load I'm seeing thread counts and memory explode (for some reason when the clients begin timing out).

This isn't prohibited by tower::limit::ConcurrencyLimitLayer as it backs-up the requests behind a semaphore.

I'm also not able to try the rate-limit layer because I'm using serve_with_shutdown() which requires layers implement Clone.

I would like to try the Tower feature tower::load_shed::LoadShed to see if this can alleviate my problem.

Proposal

Amend the dependency in Cargo.toml for tower to include "load-shed" in list of features.

GrandmasterTash avatar Sep 20 '21 03:09 GrandmasterTash

@GrandmasterTash if I understand correctly you'd like to use a time based rate limiter than a concurrency one? I think that makes sense. I think the rate limit layer currently is quite limited, we should improve this for sure.

LucioFranco avatar Oct 06 '21 21:10 LucioFranco

Pretty-much yes. I actually had this layer in-mind - but the rate limit layer could be useful as well.

GrandmasterTash avatar Oct 08 '21 02:10 GrandmasterTash