Rate Limiting
Rate limiting caps how often a client can act, protecting shared capacity by rejecting or delaying the excess.
Rate limiting restricts how many requests a client can make in a given window, protecting a service's shared capacity from any single caller — malicious or merely enthusiastic — by rejecting or queuing what's over the limit. It's a policy decision as much as a technical one: someone has to decide what "fair" looks like per API key, per IP, or per user, and what happens to the request that exceeds it (usually an HTTP 429 with a Retry-After header).
The two common algorithms behave differently under bursty traffic. A fixed window counter resets every, say, 60 seconds — simple, but it allows a burst of double the limit right at the window boundary, since a client can spend its whole allowance in the last second of one window and the first second of the next. A token bucket instead refills at a steady rate and lets a client spend saved-up tokens in a burst, which is usually the better model for real traffic: it tolerates a legitimate spike while still capping the long-run average.
Rate limiting is enforced at multiple layers for different reasons. An API Gateway rate-limits at the edge to protect everything behind it uniformly, cheaply, before a request even reaches application code. A single service might additionally rate-limit a specific expensive endpoint that the gateway's blanket policy doesn't account for. And a client calling a third-party API has to respect that API's rate limit or get cut off — which is why well-behaved clients implement their own backoff rather than hammering the limit and hoping.
It's a close cousin of Backpressure, but the direction of control is different: rate limiting is a hard cap imposed from outside a client's control, while backpressure is a signal a struggling receiver sends so a well-behaved sender can slow itself down voluntarily.
See also4
Backpressure
Backpressure is a slow receiver telling a fast sender to hold up, so a queue grows on purpose instead of by accident.
Networks & Distribution5 connections
API Gateway
An API gateway is the single front door to a set of backend services, handling cross-cutting policy once instead of per-service.
Networks & Distribution6 connections
Circuit Breaker
A circuit breaker stops calling a failing dependency, converting slow repeated failures into a fast, cheap one.
Networks & Distribution5 connections
Load Balancing
A load balancer spreads requests across many backend instances, turning "one server" into "one address."
Networks & Distribution8 connections
Linked from4
- API GatewayNetworks & Distribution
An API gateway is the single front door to a set of backend services, handling cross-cutting policy once instead of per-service.
- BackpressureNetworks & Distribution
Backpressure is a slow receiver telling a fast sender to hold up, so a queue grows on purpose instead of by accident.
- Circuit BreakerNetworks & Distribution
A circuit breaker stops calling a failing dependency, converting slow repeated failures into a fast, cheap one.
- Load BalancingNetworks & Distribution
A load balancer spreads requests across many backend instances, turning "one server" into "one address."