All glossary terms

Serving

Rate limiting

A counter at the gateway, often a token bucket, that refuses arrivals above a chosen share before they reach a card - where a refusal costs nothing at all.

Rate limiting is admission control with a price tag attached. The cost structure makes it a design question rather than a protection feature: an arrival refused at the gateway with a clear status costs nothing, while the same arrival admitted into a saturated pool holds a KV cache seat and lengthens the wait of every request behind it. So the limiter exists to spend refusals early and cheaply instead of wait time late and universally.

The token bucket is the standard mechanism, and its two numbers are the design. The refill rate is the steady budget - how many arrivals per window the tier may spend. The bucket capacity is the burst budget - how much of that allowance can be granted instantly when a burst lands, which is what keeps a short burst of legitimate traffic from being punished by an empty refill. Holding the bucket in a shared store keeps the decision atomic when many gateway instances admit concurrently.

Setting the rate is a product decision wearing arithmetic. Admitting near full demand keeps users happy until pool utilization closes on saturation, where wait time explodes; tightening the bucket rejects more arrivals at the edge and buys back a queue that drains. The honest version states the chosen share, measures the refused share, and revisits both after every incident - a limiter set once and never measured is a guess with a name.

A worked example

A free tier sees 1,200 arrivals per minute at peak. The gateway admits 30 percent of demand through a token bucket that holds up to 40 tokens and refills at the admitted rate.

  1. Refill: 1,200 x 0.30 = 360 tokens a minute, 6 per second - the steady grant for the tier.
  2. A 2-second burst of 90 arrivals collects 12 refill tokens while it runs: the stored 40 plus 12 grants 52 arrivals, and 38 are refused.
  3. The same 38 admitted into a saturated pool would queue at super-linear wait cost - the refusal is the cheaper outcome for everyone already in line.

A bucket of 40 refilling at 6 per second grants 52 of a 90-arrival burst and refuses the rest at the door - the shaped share, written in two numbers.

Where this shows up

Related terms