In this lesson · topic 7 of 7
Topic 7
Choosing a limiter under pressure
4 min read
Predict first
Predict first
Predict first
Take away
- A limiter protects a service from one caller. It is a promise made in advance, and it does not know how busy the server is.
- The fixed window is cheap and has a hole at its edge. The sliding log closes it at a memory cost. The sliding counter and the token bucket get close with a few numbers.
- The sliding counter’s error is bounded by the previous window’s count. Charge expensive calls more tokens, and check narrow limits before wide ones.
- Bucket size is burst tolerance, and refill rate is the long-run rate. The leaky bucket trades rejections for delay.
Sources
- RFC 2697, A Single Rate Three Color Marker, a metering scheme built on a token bucket.
- J. S. Turner, New directions in communications (or which way to the information age?), IEEE Communications Magazine, 1986, an early description of the leaky bucket.
- Beyer, Jones, Petoff and Murphy, Site Reliability Engineering, chapter 21, Handling Overload, O’Reilly, 2016, which covers per-customer limits.
- RFC 6585, Additional HTTP Status Codes, which defines 429.