Incident lab: GPU memory at 90% while the weights are 35 GB of 48 GB
A team thinks the engine leaks memory: the GPU sits at 90% all day although the weights are only 35 GB of 48 GB, and p99 TTFT passes 20 s at peak. Work out where the memory really goes, size the KV cache from the startup log, show why only about nine requests fit, and compare the fixes (FP8 KV cache, a higher memory budget, a shorter max_model_len, a restart) with numbers.
By Sandip Maity, Applied AI Engineer
Key takeaways
- vLLM-style engines reserve gpu_memory_utilization of the card at startup, so 90% memory used is normal at any load; it is not a leak.
- The number that matters is the KV cache left after weights, activations and overheads: here 5.5 GB, about 21,000 tokens.
- Divide the KV cache by tokens per request (prompt plus output) to get how many requests can run at once; here about nine.
- FP8 KV cache doubles the pool; a higher gpu_memory_utilization helps if nothing else shares the GPU; a shorter max_model_len does not enlarge the pool and rejects long prompts.
- Read the startup log lines on KV cache size and maximum concurrency after every model, engine or GPU change.
Goal: answer a ticket that blames a memory leak. Find out where the memory goes, what really limits the replica at peak, and which change fixes it, with numbers for each option.
You need: the simulator from How to work an inference incident and about 45 minutes. Background: VRAM math and vLLM for serving.
Honest limits. The simulator's memory split follows the way vLLM sizes its KV cache, but real profiling numbers (activations, CUDA graphs, non-PyTorch memory) depend on the model, the engine version and the GPU. Read your own startup log. Quality effects of an FP8 KV cache are not simulated; you must measure them.
#The ticket
$ python3 incident_sim.py memory brief
TICKET from the platform team: 'The RAG model's GPU sits at 90% memory all day, but the weights are
only 35 GB of 48 GB. We think vLLM leaks memory. At the afternoon peak, p99 TTFT goes past 20 s.
Should we restart it nightly or buy bigger GPUs?' Decide what is really happening and what to change.
Start with: dashboard, then startup-log.#Step 1: compare quiet and peak
$ python3 incident_sim.py memory dashboard
Dashboard: GPU memory at 90% while the weights are 35 GB of 48 GB
02:00 (quiet) 14:00 (peak)
Requests per second (in) 0.09 0.25
TTFT p50 763 ms 1.49 s
TTFT p99 3.13 s 37.26 s
Inter-token latency p50 56 ms 61 ms
Inter-token latency p99 59 ms 703 ms
Output tokens per second 37 98
Unfinished at end of window 2 5
Errors per minute (400/429/timeout) 0.0 0.0
GPU utilisation 86% 100%
GPU memory used 43.2 / 48 GB (90%) 43.2 / 48 GB (90%)Before you read on, answer:
- Does GPU memory behave like a leak?
- What changes between 02:00 and 14:00, apart from traffic?
- What would you check next, and why?
The rest is Pro
Keep reading this full lab
Pro unlocks this full lab, including 1 animated diagram, every advanced lesson, the hands-on labs and completion certificates.
One year
$25
365 days, no auto-renewal
Lifetime Best value
$75
pay once, keep it forever
7-day refund, no questions asked. One payment, no auto-renewal.Compare plansHave a licence key?
Not ready? Keep learning free
Free lessons from Incident Labs, no sign-up. Or follow the free roadmap →
Not ready? Take the free 5-day email course
One short email a day for five days, each built on a free lesson, then the occasional new lesson or offer. Unsubscribe in one click.
Still to come in this lab
- Step 2: memory is a reservation, not a leak
- Step 3: read the startup log
- Step 4: how many requests fit at peak?
- Step 5: compare the fixes with numbers
- Step 6: write the reply
- On a real system
- Checklist
- Exercise
- Going deeper
You will be able to answer
- Why does GPU memory read about 90% at 2 a.m. and at peak alike?
- The startup log says the KV cache holds 20,976 tokens. RAG requests average 1,800 prompt tokens and 400 output tokens. About how many can run at once?
- Someone lowers max_model_len from 8,192 to 4,096 and p99 TTFT improves. Why is that not a real fix?
- Which change doubles the KV cache without new hardware?
Articles that build on this lesson