Lab · Backend
Learn rate limiting by playing: seven worlds from a single token bucket to designing the whole limiter. The live simulator is further down for free play.
7 worlds · 15 missions
Let friends in. Hold floods back.
Your API is under pressure. Real people arrive in bursts and bots never stop. Set the rules so the good traffic gets through.
Choose your difficulty
Green passed, red was refused. A real leaky bucket also delays accepted requests so they leave at a steady rate.
This is the token bucket algorithm — the same mechanism behind most production API rate limiters. Tokens refill continuously up to the bucket's capacity; every request costs one token, and a request with no tokens left gets a 429.
Recent requests
Send a request to see it logged here.
7 worlds, 15 missions and 29 glossary topics.
Understand why servers say no, and how a token bucket decides.
Missions: Serve a calm visitor, Survive a page load.
Balance generosity to users against protection from abuse.
Missions: Steady stream plus a spike, Slow down a flood.
Choose between algorithms and keep one caller from starving another.
Missions: Close the boundary loophole, Protect the good user.
Protect downstream services and limit across many servers.
Missions: Do not crush the database, Three servers, one limit.
Tune limits for launches and teach clients to behave.
Missions: Launch day, Incident room: retries.
Defend a whole platform: layers, overload and attacks.
Missions: The patient bot, Incident room: under attack.
Design the limiter itself: where it sits, how it counts and how it fails.
Missions: Scoping the limiter, Incident room: double spending, Running it in production.
Rate limiting caps how many requests a caller may make in a period, to protect a service from overload and abuse and to share capacity fairly.
A token bucket allows short bursts up to the bucket size while refilling at a steady rate. A sliding window counts requests over a rolling period, so it holds a limit more strictly across window boundaries.
429 Too Many Requests, ideally with a Retry-After header saying when to try again.
It is free and needs no account. It has 7 worlds and 15 missions, and your progress is saved only in your own browser.