Skip to content
$ lynuxpro
← All system designs

SENIOR · 14 MIN · MLOPS · PLATFORM · SRE

LLM inference platform

An AI gateway, per-model queues, GPU servers with continuous batching, caching, autoscaling on tokens and smart routing between models.

Peak load
2,000 tokens/s per replica
Availability target
99.9%
RTO: back up within
10 min
RPO: data you can lose
n/a (stateless)

← Swipe sideways to see the whole diagram →

ClientEdge / networkData storeQueue / streamMLInfrastructureasync / background

The question

"Design a platform that serves several large language models to many internal apps with good latency and reasonable GPU cost."

Requirements

  • An OpenAI-style API for apps, with authentication, quotas and usage per team.
  • Low time-to-first-token for chat; high throughput for batch jobs.
  • Use expensive GPUs efficiently and scale with demand.
  • Survive a GPU node or a whole model pool failing.

Quick numbers

ItemAssumptionResult
Model70B parameters, 16-bit~140 GB of weights: needs at least 2 x 80 GB GPUs
Same model, 4-bit quantized~35 GBfits on one 80 GB GPU with room for KV cache
One replica~2,000 output tokens/s with batching50 concurrent chats at ~40 tokens/s each

How it works

  1. Apps call the AI gateway: it checks keys, enforces quotas, logs usage per team and routes to a model.
  2. Repeated prompts can be answered from a response cache (exact match, or semantic match for some use cases).
  3. Requests wait in per-model priority queues (chat before batch).
  4. Inference servers (vLLM, TensorRT-LLM or TGI) use continuous batching and a paged KV cache to serve many requests on one GPU at once.
  5. Model weights load from object storage onto fast local NVMe; warm replicas stay loaded because cold starts take minutes.
  6. The autoscaler adds or removes replicas based on queue depth and tokens per second, not CPU.

Key decisions

DecisionChoiceWhy
Batchingcontinuous batchingmuch higher GPU use than one request at a time
Model sizeroute easy tasks to small modelsbig cost savings with little quality loss
Quantization8-bit or 4-bit where quality allowsfewer GPUs per replica
Scaling signalqueue depth, tokens/s, time to first tokenmatches what users feel
Fairnessper-team quotas and prioritiesone batch job can't starve chat

What breaks and how it heals

  • GPU node fails: the gateway retries on another replica; keep N+1 replicas for critical models.
  • Traffic spike: queue with timeouts, shed batch traffic first, scale out (slowly, because weights are large).
  • Model update goes wrong: canary new model versions with quality and latency checks.

High availability and disaster recovery

TargetNumberHow it is met
Availability99.9%at least N+1 replicas per model across 2 zones
GPU node failsrequests retriedthe gateway retries on another replica
Cold start~5 minutes for 140 GB of weights at ~500 MB/skeep warm replicas; cache weights on local NVMe
Lost GPU capacity in a regionRTO 10 minutesfall back to a smaller model or a second region; reserved GPU capacity for critical models
DataRPO not applicableservers are stateless; chat history lives in its own database with backups

What interviewers listen for

  • GPU memory math (weights + KV cache) and batching.
  • Latency metrics specific to LLMs: time to first token, tokens per second.
  • Cost control: routing, quantization, caching and autoscaling on the right signal.