Skip to content

Burst lab · your question 2

Fixing the 429s

Three reps ask at once with prompts of about 14,500 tokens, against an assumed limit of 30,000 tokens per minute. The same burst runs through three clients: where the 429s come from, and what removes them.

The burst uses questions the answer bank does not cover, so each one calls the model. Answer-bank hits never call the model, so common questions cannot hit a 429 (about 69% of questions in the simulated day).

Scenario

The scenario in your post: three reps ask together with prompts of about 14,500 tokens. The 30,000 tokens-per-minute limit is an assumption; the x-ratelimit-limit-tokens header on one of your 429s confirms the real number.

3
14,500
0 tokens/min

The same settings give the same result every time (seeded clock). Played back about 12x faster, long waits shortened.

Why requests fail

The provider charges the prompt plus the requested max output against the per-minute budget the moment a request arrives.

Each request
15,000 tokens
14,500 prompt + 500 output
3 at once need
45,000 tokens
Budget this minute
30,000 tokens

Only 2 of 3 fit in the first minute. Without a queue, the rest come back as 429.

Results for each client
ClientAnsweredTypicalSlowest
Today’s client (no retry)2/3 (67%)1.6 s1.9 s
With retry queue3/3 (100%)1.9 s31.6 s
+ smaller prompts3/3 (100%)1.3 s1.5 s

The retry queue removes the errors but not the wait: the slowest rep waits 31.6 s. Smaller prompts or a higher tier remove the wait (slowest 1.5 s with smaller prompts).

Typical and slowest are answer times for answered requests, from the rep asking to the last word.

What each rep saw, second by second

  • Waiting in line (local budget)
  • Sent, waiting for first token
  • Streaming the answer
  • Backing off after a 429
  • 429 from provider

Today’s client (no retry)14,500-token prompts

Sends every request the moment it arrives. No queue, no retry. A 429 reaches the rep as an error.

2 of 3 answered · 1 × 429
  • Rep 1Answered 1.6 s
  • Rep 2Answered 1.9 s
  • Rep 3Failed (429)

What each rep sees

  • Rep 1OBJ-4.2Good, that tells me they're doing a lot right. If you could change one thing about how it works today, what would it be?
  • Rep 2EML-2.2Here is what we agreed: you'll share the demo with [name], I'll send the pricing options, and we'll decide together on [day]. Reply yes and I'll send the invite.
  • Rep 3The coaching response could not finish

With retry queue14,500-token prompts

Estimates tokens first and waits in a local token bucket, caps concurrency at 4, retries with full-jitter backoff that honors retry-after (4 retries max), and tells the rep to try again when the wait would pass 45 seconds.

3 of 3 answered · 0 × 429 · slowest 31.6 s
  • Rep 1Answered 1.6 s
  • Rep 2Answered 1.9 s
  • Rep 3Answered 31.6 s

What each rep sees

  • Rep 1OBJ-4.2Good, that tells me they're doing a lot right. If you could change one thing about how it works today, what would it be?
  • Rep 2EML-2.2Here is what we agreed: you'll share the demo with [name], I'll send the pricing options, and we'll decide together on [day]. Reply yes and I'll send the invite.
  • Rep 3EML-5.2I'm writing because teams like yours often lose hours each week to [problem]. Is that true for you, or am I off base?

+ smaller prompts4,000-token prompts

The same retry queue, with prompts cut to the matched section and top lines. The demo pads prompts to a 4,000-token target; on your app the size comes from a token count of real prompts, and the trim ships only if the 30-question score holds.

3 of 3 answered · 0 × 429
  • Rep 1Answered 1.2 s
  • Rep 2Answered 1.5 s
  • Rep 3Answered 1.3 s

What each rep sees

  • Rep 1OBJ-4.2Good, that tells me they're doing a lot right. If you could change one thing about how it works today, what would it be?
  • Rep 2EML-2.2Here is what we agreed: you'll share the demo with [name], I'll send the pricing options, and we'll decide together on [day]. Reply yes and I'll send the invite.
  • Rep 3EML-5.2I'm writing because teams like yours often lose hours each week to [problem]. Is that true for you, or am I off base?

Capacity planner: limits for a group of reps

The worst case is every rep asking in the same minute. Size the tokens-per-minute limit for that, and let the queue absorb anything above it: those reps wait instead of seeing an error.

10

Today’s prompts (14,500 tokens)

15,000 tokens per request · 10 reps need 150,000 tokens a minute

  • 30,000 / min2 at once, rest wait
  • 90,000 / min6 at once, rest wait
  • 450,000 / minall 10 at once

Smaller prompts (4,000-token target)

4,500 tokens per request · 10 reps need 45,000 tokens a minute

  • 30,000 / min6 at once, rest wait
  • 90,000 / minall 10 at once
  • 450,000 / minall 10 at once
  1. Measure the prompt, then trim it. Count the tokens in one real prompt first. If most of it is pasted reference text, send the matched section and top lines instead: the same tier then serves about 3.3x more questions a minute. The trim ships only if the 30-question score holds.
  2. Set max_tokens to the real answer length. It is reserved against the budget when the request arrives, even if the answer is short.
  3. Know which limits apply. Check the tier for the model on the key the app really uses. One shared key means every rep and every instance draws from one budget.
  4. One queue per key. With more than one server instance, keep the token bucket in shared storage (your existing Postgres works) so each instance does not assume it has the whole budget.
  5. Retry on the provider's schedule. Honor retry-after, add jitter, cap retries, and tell the rep to try again when the wait would be too long.
  6. Alert on 429s, not only failures. 429s that retries absorb are the early warning that the tier is too small.