skip to content

During a launch, the primary provider's region fails and a model gateway moves all traffic to the fallback provider, which throttles within minutes: what went wrong, and how do you size the fallback?

level: seniorimportance: should knowfreq 45%

answer

  1. sized for a trickle, not a takeover
  2. where the limit is scoped
  3. everyone else fails over too
  4. plan for losing the primary
  5. reserved base, pay-per-token peaks

basics

~20 s

The fallback held only trickle capacity, its limits were scoped wider than the keys spread over them, and other customers failed over too. Size each protected route's next hop to carry the primary's peak, spread over separate accounts and regions.

solid answer

~50 s

The chain looked right but the **capacity behind it** was not there. Provider rate limits, usually requests and tokens per minute, are scoped to a key, project, account or region; the fallback had been sized for occasional spillover, and several keys inside one account often share one account-level limit, so adding keys added nothing. A regional outage also pushes other companies onto the same fallback, so it can throttle even below your own limit. The fix is **capacity planning for losing the primary**: for each route you promise to protect, the next hop must hold the primary's peak, spread across separate accounts and regions where limits are scoped there, with increases requested well before the launch, a small steady share of traffic kept on the fallback, and priority for critical routes when it still cannot hold everything. Reserved capacity follows the same logic: reserve the base load, overflow the peaks to pay-per-token.

code

yaml · 16 lines
yaml
# illustrative capacity plan for one protected route; figures and field names are invented
route: launch-assistant
peak_tokens_per_minute: 6000000
primary:
  target: assistant-model @ vendor-a / region-east
  reserved_tokens_per_minute: 3000000
  overflow: assistant-model @ vendor-a / region-east / pay-per-token
fallback_pools:
  - target: assistant-model @ vendor-a / region-west / account-2
    limit_tokens_per_minute: 2000000
  - target: assistant-model @ vendor-a / region-north / account-3
    limit_tokens_per_minute: 2000000
  - target: assistant-model @ host-b / region-east
    limit_tokens_per_minute: 2000000
fallback_total_tokens_per_minute: 6000000   # must cover peak_tokens_per_minute
steady_share_on_fallback: 0.05

go deeper

for a junior

Recall that a fallback has its own rate limits and that a chain is useless if the next hop cannot hold the traffic it receives.

for a middle

Explain that limits are scoped per key, account or region, and why keys inside one account often share a single limit.

for a senior

Diagnose the launch failure, do the tokens-per-minute arithmetic, and lay out the plan: separate pools, early increases, steady traffic and route priority.

for a principal

Own which routes get full failover capacity, and weigh reserved capacity for the base against pay-per-token and second-provider overflow at peak.

## What went wrong The gateway did its job: it noticed the primary region failing and walked the fallback chain. The chain failed anyway because nobody had checked **how much capacity was waiting at the next hop**. Four causes usually stack up: - **The fallback was sized for a trickle.** It normally served a few percent of traffic, and its limits had never been raised past that. - **The limit was scoped wider than the keys.** Providers express limits as requests per minute and tokens per minute, scoped to a key, a project, an account or a region depending on the provider. Spreading calls over several API keys inside one account often hits the same account-level limit. - **Failover is correlated.** A regional outage at a large provider pushes many companies onto the same alternatives at the same moment, so the fallback can return overload errors even while you are under your own limit. - **Retries amplified the load.** Each throttled call that was resent added to the queue; retry discipline is covered with retries and backoff, but it makes every capacity gap worse. ## Do the arithmetic before the launch A worked scenario, with figures that are this scenario's own: - Launch peak: **2,400 calls per minute** at about **2,500 tokens per call** (input plus output) = **6,000,000 tokens per minute**. - Fallback account limit: **1,000,000 tokens per minute**. - So the fallback can hold about **one sixth** of peak: roughly 400 calls per minute. The other 2,000 calls per minute are throttled. Some providers also count a call's requested maximum output against the limit before it is generated, so a route that asks for a large maximum output uses up quota faster than its real usage suggests. ## Sizing the fallback for losing the primary Plan as if the primary is gone, route by route: 1. **Decide which routes are protected.** Not every feature needs full failover; list the ones that do, and their peak. 2. **Give each protected route's next hop the primary's peak**, or the share you have promised to protect. 3. **Spread capacity where the limit is scoped.** If limits are per account and per region, capacity comes from separate accounts and separate regions the route's data rules allow, not more keys in one account. Check the provider's terms first: some forbid multiplying accounts to get around limits and expect you to ask for an increase instead. 4. **Request increases well ahead.** Limit increases and reserved capacity can take days or weeks, so they belong in the launch checklist, not the incident channel. 5. **Keep a steady share on the fallback.** Sending a few percent of traffic there all the time proves the path works and, with some providers, builds the usage history that higher limits depend on. 6. **Balance by remaining headroom.** The gateway should send calls to the target with the most quota left, using the remaining-quota figures many providers return, instead of filling one key until it throttles. 7. **Prioritise when capacity is still short.** If the fallback cannot hold everything, the gateway admits protected routes first and returns a clear error to the rest. ## Reserved capacity and overflow Some providers sell **reserved capacity**: guaranteed throughput billed per unit of time whether you use it or not, alongside **pay-per-token** on-demand access. The same reasoning applies at peak: | Choice | Cost shape | Risk | |---|---|---| | Reserve for full peak | Pay for idle capacity most hours | Expensive, rarely saturated | | Reserve the base, overflow peaks to pay-per-token | Premium only on the peak share | The on-demand pool may also be busy at peak | | Overflow to another provider | Different price and model behaviour | Output drift, a second integration | In the scenario, if the base is 3,000,000 tokens per minute for most of the day and 6,000,000 for two peak hours, reserving 6,000,000 pays for 3,000,000 idle for the other twenty-two hours. Reserving the base and overflowing the peaks to the same model's pay-per-token pool keeps the same model and pays the premium only on the extra half during the two peak hours. A different provider is the last overflow step, for the same reason it sits last in a chain: the model changes. ## The lesson A fallback chain is a routing decision; **capacity is a planning decision**. A chain whose next hop cannot hold the load turns one provider's outage into two.

  • Why might adding five more API keys in the same provider account not raise fallback capacity at all?
    Many providers scope rate limits to the account, project or organisation, not to each key, so every key draws on the same pool. Capacity rises only where the limit is scoped: a separate account, region or approved limit increase. Check how the provider scopes its limits and what its terms allow before spreading load.
  • When reserved model capacity saturates at peak, where should overflow go first?
    To the same model's pay-per-token pool, because the model stays the same and mainly the price changes. Then to the same model on another host, and only then to a different model. The on-demand pool can itself be busy at peak, so measure how it behaves at your peak hour rather than assuming it is unlimited.
  • Why keep a small steady share of traffic on a fallback while the primary is healthy?
    It proves the path, keys and request translation work, it shows real latency and error rates for that target, and with some providers it builds the usage history that higher limits depend on. A fallback that has carried no traffic for months is an untested assumption.

  • More API keys in one account always means more capacity.
  • A fallback sized for its usual trickle can absorb a full failover.
  • Limit increases can be requested once the outage has started.
  • Reserving capacity for the full peak is always the cheapest option.
  • Other companies failing over cannot affect our fallback provider.