What is rate limiting? Explained with a doorman and a tally book
Rate limiting caps how many requests one visitor or app can make in a set time, then asks the rest to wait. Picture a doorman who counts visits and says "come back in 10 minutes".
- Author
Umair Mateen- Published
- Reading time
- 5 min
- Category
- Engineering
Google's new rules for AI agents in Workspace come with a free tier that has published rate limits, so here is what a rate limit actually is.
In one sentence: Rate limiting is a cap on how many times one visitor, app or account can ask a service for something in a set period of time, such as a minute or an hour; anyone who goes over is told to slow down and try again later.
The everyday picture
Picture a busy office building with a doorman at the front door. Visitors arrive all day. Most come once or twice, do their business and leave.
The doorman keeps a tally book. Each time someone knocks, he notes who it is and checks how many times they have come in during the past hour. If they are under the house limit, he opens the door. If they have already been in too many times, he hands them a small card: "Too many visits. Please come back in 10 minutes."
The doorman is not there to keep people out. He is there so one pushy visitor cannot crowd the lobby and stop everyone else getting in.
Each request is counted against a limit for the time window. Under the limit, it reaches the server; over it, the visitor gets a 429 reply saying when to come back.
How it works, step by step
- A request arrives (a visitor knocks). An app, a website visitor or an AI agent asks a service for something: a page, a login, an answer from an AI model.
- The rate limiter (the doorman) works out who is asking. Usually that means the visitor's IP address, the internet address the request comes from. If the visitor is signed in, it can count by account or by app instead.
- It checks the counter (the tally book): how many requests has this visitor made in the current time window? The window might be one second, one minute, an hour or a day.
- Under the limit, the request goes through (the door opens). The server does the work and replies as normal.
- Over the limit, the request is refused (the "come back later" card). On the web this is the error code
429 Too Many Requests. It often comes with aRetry-Afternote that says how many seconds to wait, or the time after which to try again.
Try it · Try the dial
What happens as your app sends more requests?
Drag the dial and watch what changes.
Well under this example limit. Every request goes straight through, like a visitor the doorman barely notices.
Where the picture stops
- A real doorman can recognise faces. A rate limiter mostly sees addresses. Many people in one office can share one IP address, and one attacker can spread requests across many addresses, so the count is never perfect.
- The doorman works one door. A large service may have many rate limiters, each with its own rules for logins, searches or AI calls.
- A doorman can use judgement. A rate limiter follows its rules exactly, so it can also turn away a real customer who simply mistyped a password too many times.
Why it matters for your business
- Security. Limiting login attempts makes password-guessing by bots much slower and much less likely to work. Rate limits also help against floods of traffic and bad bots, though Cloudflare notes they are not a complete defence on their own.
- Reliability. One runaway script, or one busy customer, cannot slow the service down for everyone else.
- Cost and planning. The AI and software services you build on have rate limits too, often higher on paid plans. Google's Workspace tiers are one example. If your product grows, check those limits before launch, not after the first 429 errors.
- Customer experience. Good software expects a 429, waits the time it is told, and tries again, instead of crashing or showing a confusing error.
An example
Imagine a 20-person travel agency that adds an AI assistant to its booking site. In a holiday rush, hundreds of customers ask questions at once. The AI provider's rate limit is reached and some requests come back with "too many requests".
A well-built assistant handles this calmly. It waits the time the provider asks for, retries, and tells the customer "one moment" instead of failing. The agency also adds its own limit on the login page, so bots cannot try thousands of passwords against staff accounts.
Frequently asked questions
What does "429 Too Many Requests" mean?
It means you, or the app you are using, sent too many requests in a given amount of time. Wait a while and try again; the reply may say exactly how long.
Is rate limiting the same as being blocked?
No. A rate limit is usually temporary and resets when the time window passes. A block is a decision to refuse someone completely.
Why do AI services have rate limits?
Running AI models takes real computing power, and providers share it between many customers. Limits keep one customer from using it all, and higher limits often come with paid plans.
Can rate limiting stop every attack?
No. It slows down password guessing and traffic floods, but attackers can spread requests across many addresses. It works best as one layer alongside other protections.
Related explainers
The DevDrift builds APIs and cloud platforms with sensible limits and retries built in: see how.
Sources
Could you explain this to a colleague now?
Mark it and posts that mention it will show a tick. Saved in this browser only.