Inference prep
Study plan
Day 4 of 13 · Dec 1, 2026

Route requests and release capacity

An in-flight count estimates work. Long prompts and reused prefixes can make two equally busy workers have different completion times.

Before you start

Two streaming workers and yesterday’s gateway. Read the partial-failure discussion in DDIA, The Trouble with Distributed Systems.

Read and predict 1 hour including video

Inference Engineering · §7.2.3 pp. 190–191; §5.3.3 pp. 140–141

Use the printed page numbers. In the supplied PDF, add two to reach the viewer page. Write a prediction for the question below before opening its answer.

Designing Data-Intensive Applications · vLLM · online serving

Build and test 3 hours

Reserve the least-loaded healthy worker before awaiting I/O. Add health checks, expiry, tie-breaking and try/finally cleanup. Kill a worker during a stream.

  1. List eligible workers

    Give each worker a ready flag and an in-flight count. With counts [2, 0], a new request should choose the second worker.

  2. Reserve before forwarding

    Choose and increment the count under one lock. Release the lock before network I/O. Send two requests simultaneously and log both choices.

  3. Interrupt a stream

    Stop the selected worker after its first token. Inspect the client output and confirm the reservation was released.

Open gateway
Troubleshooting

If a token appears twice, inspect retries after the first emitted chunk.

Save your result 1 hour

Save tests for simultaneous arrivals, cancellation and a worker dying mid-stream. Include per-worker counts before and after each test.

Explain from memory 1 hour

A worker fails after sending three words. Can the gateway silently retry from the start?

Check your reasoning

The client has observed a prefix. A replay can duplicate or diverge. Surface interruption and release capacity once.

Show surviving requests drain. Distinguish retry before output from recovery after bytes reached the client.