Reliabilitythrottlingrate limiterquota

Rate limiting

Definition

Rate limiting restricts the number of operations a client, key or tenant may perform per unit of time, rejecting or delaying requests above the limit.

In practice

Limits protect a service from abusive or buggy clients and from cost overruns, and make capacity planning possible. Common algorithms are token bucket, leaky bucket, fixed window and sliding window.

In a distributed deployment, per-instance limits are inaccurate, so limits are usually enforced at a gateway or with a shared store such as Redis. Rejected clients should receive 429 Too Many Requests with a Retry-After header.

Example

A public API allows each API key 100 requests per minute with bursts up to 20; the 21st request in a burst gets 429 and a hint to retry in 3 seconds.