33/41
Part 6 of 7 · Overload and monitoringLearn and do

Overload protection, from the front door down

Overload in a batch system has two faces:

  • more work is submitted than the window can hold
  • the GPU tier loses capacity while the backlog is large

The defenses run from the front door down.

Admit against the window

Model M, next 24 hours, replica-hours
forecast idle
400
queued + new
450

300 already queued plus the new 150 is 450, so about 50 replica-hours of work would expire.

Per-tenant caps are the first layer. The second is special to queues with a deadline: admit against the window. Use a forecast of batch capacity for the next 24 hours, and the work already queued.

Suppose a model's queue holds 300 replica-hours, the forecast is 400 idle replica-hours, and a 150-replica-hour batch arrives. 300 + 150 = 450 doesn't fit in 400.

Accept it anyway, and about 50 replica-hours of requests expire tomorrow. The customer learns that after 24 hours instead of in the submit response. So reject with a retry-after, or accept with an honest estimate.

Anthropic's docs describe the trade from the customer's side. Processing can slow down with current demand and your request volume, and then more requests may expire after 24 hours.

LLM requests make this check possible because their work is bounded. max_tokens caps the output, and the prompt length is known at submit. The Builders' Library explains why that matters: admission control is very hard when a server has no idea what a request will take.

Backpressure between stages

A pull dispatcher is backpressure by construction, since full workers stop asking. Keep that property everywhere.

If the result store slows, workers stop pulling rather than hold finished results in memory. Upstream, tie submit limits to the backlog. The Builders' Library calls it scaling an inbound throttle limit inversely with the backlog's size.

In the editor, write bound_hours(requests): the most replica-hours a batch can take, with every answer running to its max_tokens. Each request is its prompt tokens and its max_tokens. Then write would_expire(queued, new, forecast): the replica-hours that would expire if you accepted, 0 when it all fits.