01Chapter 1: Why services need rate limitersThis chapter assumes you know the basics of HTTP requests and responses. It also assumes you can read short Python snippets, and that you have a general idea of how services run behind a load balancer. Later chapters use a key-value store such as Redis, but this chapter does not.3 min read
02Chapter 2: Clarifying requirements: what to limit, how strictly, and for whomThis chapter assumes you know basic HTTP request and response concepts and can read Python. It also assumes you know roughly what a key-value store such as Redis does. Before choosing an algorithm, you need to pin down what the limiter must do. Most rate limiter bugs trace back to requirements nobod2 min read
03Chapter 3: Where to enforce: client, gateway, middleware, or serviceThis chapter assumes you know basic HTTP, can read Python, and know that services usually run as several instances behind a load balancer. Where you enforce a limit decides what the limiter can see, what it can protect, and how much shared state it needs.2 min read
04Chapter 4: Choosing the key: user, API key, IP address, or endpointThis chapter assumes you know the limiter algorithms from earlier chapters and basic HTTP headers. A limiter counts requests per key. The key decides who shares a budget, so a poor key blocks innocent clients or lets abusers through.2 min read
05Chapter 5: Fixed window counter and its boundary burst problemThis chapter assumes you know basic HTTP request and response concepts and can read Python. You should also know what a key-value store such as Redis does. It covers the simplest rate limiting algorithm, how to implement it, and the flaw that motivates the algorithms in later chapters.2 min read
06Chapter 6: Sliding window log: exact but memory-hungryThis chapter assumes you have read the fixed window chapter and can read basic Python. The fixed window counter allows up to twice the limit across a window boundary. The sliding window log removes that flaw by remembering when every recent request happened.2 min read
08Chapter 8: Token bucket: steady rate with controlled burstsThis chapter assumes you know basic HTTP request and response concepts and can read Python. You should also know what the fixed window counter does and why its boundary burst is a problem. The token bucket avoids that problem by letting you set the burst size and the long-run rate as two separate nu2 min read
09Chapter 9: Leaky bucket: smoothing output to a constant rateThis chapter assumes you have read the token bucket chapter and can read short Python. The leaky bucket is the mirror image of the token bucket. Instead of letting bursts through, it evens them out.2 min read
10Chapter 10: Choosing an algorithm: accuracy, memory, burst behavior, costThis chapter assumes you have read the earlier chapters on the five algorithms: fixed window, sliding window log, sliding window counter, token bucket, and leaky bucket. You should be comfortable reading short Python. Here you compare them and pick one for a given job.2 min read
11Chapter 11: Telling clients about limits: HTTP 429 and Retry-AfterThis chapter assumes you know basic HTTP status codes and headers, and that you have a limiter that returns allow or deny, such as the token bucket from earlier chapters. Here we cover what the server sends back when it denies a request.2 min read
12Chapter 12: Scaling out: shared counters in a store such as RedisThis chapter assumes you know the fixed window and token bucket algorithms from earlier chapters. It also assumes you can read basic Python and know what a key-value store such as Redis is.2 min read
14Chapter 14: Time sources and clock skew across nodesThis chapter assumes you know the fixed window and token bucket algorithms from earlier chapters, and that you can read short Python and Lua snippets. Every algorithm so far depends on "now". With one process that is easy. With many application servers, each server has its own clock, and those clock2 min read
15Chapter 15: When the limiter's store is down: fail open or fail closedThis chapter assumes you know the token bucket and fixed window algorithms, and that you understand a shared Redis store holds limiter state for many application servers. If you need a refresher on that setup, see the earlier chapters on distributed state and atomic updates.2 min read
16Chapter 16: Layering limits: per-second bursts, per-day quotas, global capsThis chapter assumes you know the fixed window and token bucket algorithms from earlier chapters, how a limiter key is chosen, and how a shared store such as Redis holds counters. A single limit rarely fits real traffic, so production services stack several.2 min read
17Chapter 17: Testing with a fake clock and monitoring rejectionsThis chapter assumes you can read the Python limiters from earlier chapters and know what a metrics counter is. It covers how to test time-dependent limiter logic without sleeping, and which signals to watch once the limiter is in production.2 min read