Build a Multi-Team GPU Cluster Platform for Distributed Training
System DesignModel answerLast updated
Design a shared platform where several teams run distributed GPU training jobs, with all-or-nothing placement, fair quotas, fast failure recovery and a storage layer that avoids I/O stalls.
Context
A self-driving vehicle organization trains many kinds of models: large vision transformers, trajectory forecasting models, and reinforcement-learning agents in simulation. Four teams (Perception, Prediction, Controls, Simulation) all draw on one pool of accelerators. Today each team hand-manages its own machines, and utilization and reliability are poor.
You are asked to design a shared training platform on which engineers can launch, monitor and recover distributed training runs without caring which machines they land on.
Functional requirements
- Gang scheduling and placement. Multi-node jobs (for example PyTorch DDP or DeepSpeed) must have every worker start together or not at all. Placement should respect network topology: GPUs within one host first, then hosts under the same leaf switch.
- Quotas and fairness. Each team has a guaranteed share. Idle capacity can be borrowed by others, and borrowed capacity can be reclaimed through priority-based preemption.
- Reproducibility. Every run is bound to an immutable dataset snapshot and a specific code commit.
- Fault tolerance. Detect failed workers or nodes, remove unhealthy nodes from service, and resume from the most recent valid checkpoint with little lost work.
- Experiment tracking. Expose live metrics (loss, throughput, GPU utilization), artifacts and lineage.
Non-functional requirements
- 4,000+ GPUs across 500+ hosts; hundreds of concurrent runs; about 10,000 job launches per day.
- Node failure detected within 10 seconds; affected distributed job running again within 90 seconds.
- Average idle overhead on allocated GPUs (between checkpoints or job transitions) under 5%.
What to cover
- High-level architecture of the control plane (API, scheduler/resource manager, node agents, experiment store).
- The gang-scheduling and quota engine: data model, fair-share algorithm, preemption policy, topology-aware placement.
- The failure lifecycle, from a missed heartbeat through draining, health checks, rescheduling and checkpoint reload.
- The storage design for data reads and synchronous checkpoint writes (object store versus parallel file system or local cache) so that I/O does not become the bottleneck.
State your assumptions, give back-of-the-envelope numbers, and discuss trade-offs.
Hints
Hint 1
Start with numbers: heartbeats per second, job launches per second, checkpoint size per node, and metric points per second. They show which parts are actually hard (placement quality and recovery time, not raw throughput).
Hint 2
A default one-pod-at-a-time scheduler can deadlock two large jobs that each hold half the nodes they need. Think about admitting a whole group atomically, reserving nodes for large jobs, and only backfilling small jobs that finish before the reservation.
Hint 3
Break the 90-second recovery budget into phases (detect, isolate, replace, start, rendezvous, reload) and decide what must be pre-arranged, such as hot spare hosts, pre-pulled images and node-local checkpoint copies, to fit each phase.
Hint 4
Separate durable storage from fast storage: an object store as the source of truth, and local NVMe or a parallel file system as a cache. Consider asynchronous upload of checkpoints and a commit marker so that a half-written checkpoint is never used for resume.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
What a strong answer focuses on
Three problems dominate: all-or-nothing placement with topology awareness, recovery inside a hard time budget, and I/O at scale. Lead with these, quantify them, and keep the control plane separate from the in-band training state.
1. Scale estimates
| Quantity | Estimate | Implication |
|---|---|---|
| Hosts and GPUs | 500 hosts x 8 GPUs = 4,000 | The host is the natural unit for big jobs |
| Launch rate | 10k/day is about 0.12/s average, a few per second at peak | The scheduler is limited by placement quality, not throughput |
| Heartbeats | 500 hosts every 2s = 250 msg/s | Trivial; 3 missed beats gives about 6s detection, under 10s |
| Checkpoint | 7B parameters with Adam at roughly 16 bytes/param is about 112 GB | Sharded across 64 nodes it is under 2 GB each; local NVMe writes this in about a second |
| Metrics | 300 runs x 64 workers x 50 series every 10s is about 100k points/s | A standard time-series database is enough |
Clarifying questions: can all tiers be preempted, what is the largest job (assume 1,024 GPUs), is hardware mixed (assume A100 and H100), and are checkpoints framework-native (assume sharded distributed checkpoints).
2. API and data model
Submission carries team, priority, image, commit, dataset snapshot, node and GPU counts, GPU type, a topology preference (same leaf or any), a restart limit and a checkpoint policy. The gateway resolves mutable references to immutable ones: a branch becomes a commit SHA, an image tag becomes a digest, and a dataset name becomes a content-addressed snapshot ID. That is what makes runs reproducible.
Store core state in a strongly consistent database (Postgres or etcd):
- Job: state (pending, admitted, running, recovering, preempting, done), attempt number, last valid checkpoint.
- Quota: team, guaranteed GPUs, borrow limit, used, borrowed.
- Node: GPU type, leaf switch, spine, health (healthy, suspect, cordoned, draining), last heartbeat.
- Allocation: job, attempt, node, rank range.
- Checkpoint: job, step, URI, manifest hash, committed flag.
- Lineage: run to commit, image, dataset snapshot and parent checkpoint.
3. Architecture
Client or SDK goes to an API gateway (auth, validation, pinning), then a job store plus event bus. A scheduler and quota engine drives a Kubernetes custom resource for the training job, reconciled by a controller onto node agents (one per host). Node agents report to a health service. Workers stream metrics to a collector feeding a time-series store and an experiment store. Storage is an object store plus a cache tier.
Plain Kubernetes is not enough: it places pods individually, so two 64-node jobs can each grab 40 nodes and wait forever, and it has no notion of leaf switches. Use a job-level resource and a gang scheduler (Volcano, Kueue or custom) that binds every pod of the group or none.
4. Gang scheduling and quotas
Admission. Hierarchical queues: cluster, team, priority class. Each team has guaranteed GPUs; others may borrow idle guaranteed capacity up to a limit, and borrowed capacity is flagged reclaimable. Order by lowest used/guaranteed ratio, then priority, then FIFO.
Starving large jobs. When a big gang reaches the head, reserve nodes as they free up. Backfill small jobs onto reserved nodes only if their declared maximum runtime ends before the reservation time.
Placement.
- Filter by health, GPU type and taints.
- Prefer whole 8-GPU hosts for multi-node jobs.
- Use the fewest leaf switches that fit; score by leaf count, spine hops and fragmentation left behind. Pack small jobs into already-fragmented leaves.
- Put tensor and pipeline parallel groups inside a host or leaf, data-parallel across leaves.
Preemption. Choose victims by borrowed capacity first, then lowest priority, then least work lost (shortest time since last committed checkpoint). Send a graceful signal so victims can write a checkpoint before eviction.
5. Failure detection and recovery
Use two independent signals:
- Out-of-band: agent heartbeat every 2s carrying GPU health (error codes, ECC, thermals) and NIC state; three misses mark the node suspect (about 6s).
- In-band: elastic rendezvous, a collective-communication watchdog with timeouts of seconds rather than the default tens of minutes, and a per-rank step-progress heartbeat. These catch hangs on healthy hosts.
| Phase | Action | Budget |
|---|---|---|
| Detect | Heartbeat or watchdog fires, health service correlates | up to 10s |
| Isolate | Cordon and taint node, tear down all ranks | 5s |
| Replace | Take a host from a hot-spare pool (1-2% of hosts), same leaf if possible | 5s |
| Start | Image pre-pulled on spares | 15-20s |
| Rendezvous | Re-form the world with attempt+1 | 10s |
| Reload | Survivors read shards from local NVMe; the new node reads from peers or the object store | 20-30s |
| Total | about 70-80s |
The cordoned node runs offline diagnostics (GPU diagnostics, all-reduce test, link check) and either returns to the pool or goes to repair. If the same job fails on several different nodes, suspect a code bug and stop at the restart limit instead of burning capacity.
6. Data and checkpoint storage
- Object store is the durable source of truth for datasets and checkpoints.
- Cache tier (parallel file system or node-local NVMe) serves hot dataset shards. Prefetch the next shards while training, and shard data so each worker reads a distinct slice, avoiding hot spots.
- Checkpoint writes: each rank writes its own shard to local NVMe synchronously (about a second), then uploads asynchronously to the object store. Training resumes immediately after the local write.
- Commit protocol: write shards, then a manifest with hashes, then flip the committed flag only when all shards are verified. Resume only from committed checkpoints, so a partial write is never loaded.
- Keep the last N checkpoints locally and a sparser history durably.
Trade-offs and common mistakes
- Frequent checkpoints reduce lost work but add overhead; choose the interval so overhead stays well below the 5% idle target (for example, checkpoint every few minutes).
- Hot spares cost 1-2% of capacity but are what make the 90s target feasible.
- Mistakes: ignoring partial-allocation deadlock, relying on default communication timeouts, resuming from an uncommitted checkpoint, treating the object store as the only checkpoint path, and letting backfill starve large jobs.