Why you shouldn’t use Redis as a rate limiter: Part 1 of 2
A tour of the common Redis-based rate limiter implementations — and the correctness and performance traps each one hides.
We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Rate limiting and admission checks that help reduce overload and protect expensive work.
Set admission budgets for launch spikes and promos before excess work reaches your handlers.
Fewer moving parts to run and monitor. Spend less on Redis and ops.
Add via SDK. Keep your stack. Clear limits your customers understand.
UNDERSTAND OVERLOAD · KEEP USEFUL WORK MOVING
For developers, architects, and managers: 27 narrated lessons on why services overload and how to protect them. No cloud experience required. Start with one request, or jump to any lesson.
Four chapters, one learning path. Read or listen in any order. ~41 minutes total · Times shown at 1×.
Keep enough capacity to finish work and recover.
Contain one customer's excess without punishing everyone.
Reduce work entering a shared dependency when it slows.
Choose, combine, and test the right protections.
Read the explanation or use the course map above. Audio is optional.
Arrivals → completions → unfinished work
Acceptance is not completion.
Finite processing capacity serves the shared demand.
Worked illustration: equal-cost reports, initially empty, no refusals or cancellations. Blocks compare rates; tiles count unfinished work. Final charts compare two explicit demand patterns on identical linear time scales.
Read the numbered steps in order. The explanation below follows the narration.
Capacity is what can finish; throughput is what does finish.
100 arrivals/s − 80 completions/s = 20 extra unfinished requests/s.
100 arrivals/s − 80 completions/s = 20 extra unfinished requests/s.
Now many people ask for reports. Capacity means how much work the system can finish in a given time under the conditions we are considering. Throughput is how much actually finishes.
For a simple worked example, assume every report costs the same amount of work. One hundred requests arrive each second, but only eighty finish. After one second, twenty remain unfinished. After ten seconds, two hundred remain, assuming none were refused or canceled.
This unfinished work is called work in flight. It includes work waiting to start and work already running. Latency is how long a particular operation takes from its chosen start to its finish. More waiting can make that time longer.
Would accepting another hundred requests make the eighty-per-second worker faster? No. A short burst may clear when arrivals fall. If arrivals stay above completions, unfinished work keeps growing until capacity, demand, or the work we accept changes.
Requests can arrive from many people at once. Accepting those requests and producing useful reports are different events; more accepted requests do not themselves make reports finish faster.
Capacity describes available finishing ability per unit of time. The request mix, available resources, and other conditions matter; it is not simply the number of requests the system can accept.
Compare the two definitions. Capacity is the available ability to finish work; throughput counts actual completions. A system can finish less than its capacity, for example when less work arrives.
The following arithmetic assumes equal-cost reports and constant conditions. It starts with no unfinished work and retains everything that has not finished; real mixed-cost traffic need not behave this simply.
This is offered demand, not completed reports. We need the finishing rate as well before we can work out whether unfinished work accumulates.
Subtract completions from arrivals: 100 minus 80 leaves 20 extra unfinished requests each second. The finishing rate remains 80/s even though more work was accepted.
Starting empty, 100 arrivals minus 80 completions leaves 20 unfinished requests. One tile represents those twenty requests; it is a count of work, not a memory allocation or a new processing slot.
The same excess of 20/s continues for ten seconds: 200 requests remain unfinished. No request was refused or canceled in this calculation. The worker has still been finishing 80/s throughout.
Unfinished does not mean only requests sitting in a queue. It also includes operations already running whose required result has not completed. Both categories count as work in flight.
Choose a start and finish for the operation being measured. Time spent waiting within that boundary contributes to latency alongside time spent running; the unfinished count is not itself a duration.
The worker still finishes eighty reports each second in these conditions. Accepting more demand increases the unfinished work unless something else changes; acceptance alone is not extra capacity.
Read the rate chart first, then the unfinished-work chart. In this illustration, 100/s arrive for five seconds, then 60/s; 80/s keep finishing. Work grows to 100, then drains to zero: less must arrive than finishes before the old work can clear.
Same time window, same scales, same 80/s finishing rate. Dashed A falls to 60/s and clears. Solid B stays at 100/s: 20 extra requests each second leave 200 unfinished after ten seconds. Under unchanged conditions, waiting longer makes this case worse.
Content revision: 07c7dd00db17
Download review copy (27 lessons)How many extra requests remain after ten seconds?
200, under the equal-cost, constant-capacity assumptions with no refusal or cancellation.
Measure arrivals, useful completions and unfinished work separately.
These illustrative rates assume equal-cost work and constant capacity; they are not product benchmarks.
Start here. No earlier lesson is required.
Accepting a request is not the same as delivering a useful result.
Request rate alone is a weak capacity proxy when work mix, resource costs or available capacity change.
Original explanation inspired by Fred Hébert and operational references; no endorsement implied.
AI-generated narration: ElevenLabs Eleven v3, Daniel stock voice. Audio streams only when you start listening.
A tour of the common Redis-based rate limiter implementations — and the correctness and performance traps each one hides.
The myth of infinite serverless scale — why adding machines doesn’t fix overload, and what to do instead.