Log inStart free
LESSON 33.04 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Cancellation and deadlines

Clients give up at a deadline, and the server can keep working for nobody.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 33.04 · SERVING BAY42 REQUESTS · LONGEST WAIT 10.19 S
01
Stage 1 of 5 · Requests wait
The gateway passes 42 requests. They wait in one queue for 4 GPU replicas, up to 10.19 s.
Explain it simply

Each row is one request, grouped by API key. The dashed part is its wait in line. The solid part is the time a replica works on it. Each replica serves one request at a time, at 1,500 tokens a second. The flood's big requests fill the line, so R25 from the chat app waits 7.06 seconds.

42 rows on a time axis, grouped by key. Each row shows a dashed wait, then a solid run. The longest wait is 10.19 seconds.

requestswaitingdeadlineanswered in timewasted or rejected
05101520253035time (s)K1 chat app15 sentK2 batch job12 sentK3 flood15 sentreplicas W1–W4no deadline · one row per requestR25 waits 7.06 sR25: wait = 20.06 − 13.00 = 7.06 s · run = 826 / 1,500 = 0.55 s05101520253035time (s)K1 chat app15 sentK2 batch job12 sentK3 flood15 sentreplicas W1–W4no deadline · one row per requestR25 waits 7.06 sR25: wait = 20.06 − 13.00 = 7.06 s · run = 826 / 1,500 = 0.55 s
Toy: 42 requests from 3 API keys, 4 GPU replicas
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
w=s−t,run=p+oc\sy{w}{ink}{w} = \sy{s}{ink}{s} - \sy{t}{data}{t}, \quad \text{run} = \frac{p + o}{\sy{c}{param}{c}}
R25: w=20.06−13.00=7.06 s,  run=826/1500=0.55 s\text{R25: } w = 20.06 - 13.00 = 7.06\text{ s}, \; \text{run} = 826 / 1500 = 0.55\text{ s}

The wait is the start time minus the send time.

Common mix-ups

MYTHA client timeout stops the work on the server.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With a 4 s deadline, no retry and cancellation, how many of the 15 chat app requests finish in time?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.