uber-go / ratelimit

A Go blocking leaky-bucket rate limit implementation
MIT License
4.32k stars 300 forks source link

This is rate shaping, not limiting #118

Open chmike opened 11 months ago

chmike commented 11 months ago

A rate limiter drops requests arriving at a rate exceeding a limit.

A rate shaper slows down processing rate to avoid exceeding the desired maximum rate. As it doesn't drop requests, there is a risk of queue overflow.

The optimal choice between the two depends on the type of application and the desired kind of protection.

EDIT: A combination of the two would probably be better.

rabbbit commented 7 months ago

Well it's a bit too late to rename the package. I agree we could add a note on traffic shaping if you'd like to put up a PR.