AI Interviews · Question

Place 10,000 short tasks that all arrive within one second onto a pool of GPU containers.

System design question reported at Modal (Jul 2026). Sources, confidence and an answer card.

Researched · updated

infra-050 AI Infra Engineer GPU fleet scheduling & fairness System design Low confidence
On this page

What they’re really asking

If you only remember one thing, say this in the first minute: “The one second of arrivals isn’t the deadline. I first turn the burst into GPU time: 10,000 half-second tasks are 5,000 GPU-seconds, which clears in about 20 seconds on a few hundred warm containers. I accept the burst into a durable log in batches, and warm containers that already have the model loaded pull tasks in batches of 20. A brand-new container needs about as long to load the model as the whole burst takes, so I don’t scale from zero for this. I size the warm pool with a control loop instead of keeping everything on.”

The rest of this page explains each part of that answer, so you can say it with understanding.

The interviewer wants to see whether you can reason about a burst that arrives faster than your system can react.

In a normal web service, a burst is handled by autoscaling: start more instances, and within a few seconds they take traffic. That works because a web server starts quickly and holds almost nothing in memory.

GPU workers are different. Before a GPU container can run its first task, it must load the model’s weights (its learned numbers, often tens of gigabytes) from storage into GPU memory. That start-up delay is called a cold start, and it can take as long as the burst itself. A container that already has the model loaded and is ready to run is called warm. Idle warm GPUs cost money every hour, so you can’t just keep thousands of them on.

So the real trade-off is the cost of idle warm GPUs against the delay of cold ones. The rest of the answer is arithmetic and dispatch mechanics in service of that trade-off.

(This comes from a July 2026 prep article on Modal, which poses “Ten thousand short tasks land in a single second. Walk me through how the scheduler places them” without giving an answer, and cites no first-hand sources. The same article frames warm pools as a control loop and calls “just keep instances always on” weak techinterview.orgsecondary · Jul 2026.)

Clarify first

Ask these, with an assumption for each:

  • How long is a “short” task? “Assume 0.5 seconds of GPU time.”
  • How many warm containers exist, and how long is a cold start? The article’s example model is 40 GB. “Assume 250 warm containers.”
  • One model or many? Can a container run several tasks at once, or batch them on the GPU?
  • What latency does the caller expect for the last task of the burst?
  • Is the burst predictable (a scheduled batch job) or a surprise?

Answer

Step 1: size the work, not the requests

10,000 tasks × 0.5 seconds = 5,000 GPU-seconds of work. Spread over 250 warm containers, that clears in about 20 seconds. That 20 seconds, not the one-second arrival, is the number users will see: the last task of the burst finishes about 20 seconds after it arrived.

Now compare it with a cold start. Loading a 40 GB model at an assumed 2 GB/s takes about 20 seconds before a new container can run anything. “A new container would be ready just as the warm pool finishes the burst. So scaling out only helps tasks that would otherwise wait longer than a cold start.”

Step 2: follow the burst on a clock

Clients ── 10,000 tasks in 1 second
   │
   ▼
API ── appends to a durable log in batches, returns task IDs
   │
   ▼
Durable log (the queue)
   │   warm containers PULL batches of 20 tasks, each under a lease
   ▼
250 warm containers (model already loaded) ── run each batch back to back
   │
   ▼
Results ── committed only if the container's lease is still current
ClockWhat happensWhat to say in the interview
0–1 s10,000 tasks arrive. The API appends them to the durable log in batches and returns IDs.”Batch the writes. 10,000 single-row transactions, each taking locks, would make the database the bottleneck.”
~1 sEach of the 250 warm containers pulls a batch of 20 tasks under one lease: 500 lease grants, not 10,000.”Pull, not push. A fast container simply comes back for more sooner.”
1–11 sEach container runs its 20 tasks back to back: 20 × 0.5 s = 10 s. 5,000 tasks done.”No central placer deciding 10,000 times.”
11–21 sEach container pulls a second batch of 20. All 10,000 are done at about 21 s.”Shrink batch size as the queue drains, so the tail isn’t stuck behind one slow container.”
~21 sA cold container started at 1 s would only now be ready.”For this burst, it would have added cost and no speed.”

Step 3: the mechanisms, one by one

Accept in batches. Append the burst to a durable log in batches and return IDs. A durable log is an append-only file on disk (or several machines), so an accepted task survives a crash.

Dispatch by pull. Each warm container leases a batch: it borrows the tasks for a limited time and renews the loan with regular “still here” messages. Twenty tasks per lease means 500 lease grants instead of 10,000. Run them back to back, or batched together on the GPU if the model allows. Pulling balances load automatically.

Make crashes safe. Each lease carries a fencing token: a number that goes up every time the tasks are leased. If a container dies mid-batch, its tasks are released when the lease runs out and re-leased with a higher token. If the old container wakes and tries to save results, its stale token is rejected, so there’s no double completion.

Place by affinity. Prefer containers that already have the right model loaded. Send only the overflow to containers that would need to load it. Otherwise every container reloads weights and the burst turns into a cold-start storm.

Scale with a control loop. Predict demand per function from recent arrivals. Keep a warm buffer sized to the latency target. Start cold containers when the backlog divided by the current throughput (the expected wait) is longer than a cold start, and shrink when traffic falls.

Make the next cold start faster, carefully. The article suggests two ideas: fetch only the parts of the container’s filesystem a process actually touches, and snapshot GPU memory so a restart restores state instead of reloading. Check the second idea against Modal’s own docs, which list GPU memory snapshots as alpha and say they “do not speed up model loading from storage” (Modal docs, fetched 2026-10-12). For a 40 GB model, loading the weights is the part that dominates.

Protect the rest of the fleet. Cap one tenant’s share of the warm containers, so their burst doesn’t push everyone else’s models out of memory.

The arithmetic behind the numbers (for a Staff-level follow-up)
  • Work: 10,000 × 0.5 s = 5,000 GPU-seconds; 5,000 ÷ 250 containers = 20 s.
  • Batches: 10,000 ÷ 20 = 500 lease grants; 20 × 0.5 s = 10 s per batch; two rounds ≈ 20 s.
Is it worth starting cold containers?
cold start ≈ model bytes ÷ load bandwidth + init     worth it if expected wait > cold start
load bandwidth
from object store or local disk; 2 GB/s is an assumption
Worked example

40 GB ÷ 2 GB/s = 20 s before a new container's first task, so new capacity helps only tasks that would wait longer than about 20 s

Senior vs Staff

10,000 tasks in one second

Senior

  • Batches acceptance, dispatches by pull with batch leases, prefers warm containers with the model loaded.

Staff

  • Converts the burst into GPU-seconds and drain time, compares it with cold-start time to decide when scaling helps, and caps a tenant's share of the warm pool.

In plain words: a Senior answer gets the mechanics right. A Staff answer turns the burst into a drain time, compares it with the cold start, and uses that comparison to decide whether scaling helps at all.

Small-team version

A small team gets bursts like this from a nightly backfill or a customer’s bulk upload. The cheap answer is a queue, a fixed set of warm workers pulling batches, and an honest completion-time estimate, rather than autoscaling from zero.

If bursts are rare, rent per-second “serverless” GPUs, which bill only for busy seconds, so you don’t pay for an idle pool. Check that their cold start fits your latency target.

The money makes the case (list prices fetched 2026-10-11):

  • The burst itself is cheap: 5,000 GPU-seconds on RunPod serverless L40S at $1.75 an hour is about $2.43, plus the billed cold-start seconds.
  • A standing warm pool is not: keeping 10 L40S warm all month to absorb it would cost about $8,000 at the dedicated secure rate.

“For rare bursts I’d pay a few dollars per burst rather than about $8,000 a month for idle GPUs.”

The arithmetic behind the numbers (for a Staff-level follow-up)
  • Burst: 5,000 ÷ 3,600 × $1.75 ≈ $2.43.
  • Warm pool: 10 × $1.09 × 730 hours ≈ $7,957, about $8,000 a month.

Pitfalls

  • Treating one second as the deadline. The number that matters is the drain time, about 20 seconds here.
  • One central placement decision and one transaction per task. That makes the scheduler and the database the bottleneck.
  • Scaling out from zero for a burst shorter than a cold start. The new containers arrive after the work is done.
  • Ignoring model affinity. Every container reloads weights, and the burst becomes a cold-start storm.

Go deeper

Family

Async GPU job system: queueing, leases, fencing and no lost work

Design a job queue for long GPU tasks such as text-to-video: accept a job so it is never lost, share GPUs fairly with a paid tier, re-run crashed work safely, contain a model that breaks on some GPU types, and survive bursts.

Other questions in this family