Inference, Serving & Production·Question 30 of 76Intermediate

How do you load test an LLM service so the numbers actually mean something?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Most LLM load tests are wrong in the same three ways: closed-loop load, unrealistic prompts, and reporting means.

Full worked answer

Most LLM load tests are wrong in the same three ways: closed-loop load, unrealistic prompts, and reporting means.

Open loop, not closed loop. A closed-loop test (N workers, each sends a request and waits) throttles itself when the server slows down, so you never observe the queue building. That is coordinated omission, and it hides exactly the failure you are testing for. Generate arrivals from a Poisson process at a target rate, independent of responses:

import asyncio, random

async def open_loop(rate, duration, send, next_prompt):
    loop = asyncio.get_event_loop()
    end, tasks = loop.time() + duration, []
    while loop.time() < end:
        await asyncio.sleep(random.expovariate(rate))  # do not wait on responses
        tasks.append(asyncio.create_task(send(next_prompt())))
    return await asyncio.gather(*tasks)

Realistic token distributions. Sample input and output lengths from production logs, including the tail; a fixed 512-in/128-out synthetic workload tells you nothing about a service that occasionally sees 100K-token prompts. Critically, get the prefix-cache realism right: replaying one identical prompt gives a ~100% cache hit rate and a fantasy TTFT. Mirror your real ratio of shared to unique prefixes.

Sweep, don't spot-check. Ramp the rate from idle to saturation and plot TTFT and ITL percentiles against throughput. What you want is the knee, and the maximum rate at which you still meet the SLO. Report goodput at the SLO, plus P50/P95/P99, never the mean. Tools like vLLM's serve benchmark and GuideLLM do the sweep and the Poisson arrivals for you.

Warm up and hold. Weight load, CUDA graph capture and compilation make the first requests unrepresentative. Discard the warm-up window and measure at steady state for a fixed duration.

Then test the ugly parts: behaviour past saturation (does it queue, shed, or fall over?), preemption rate, a mixed multi-tenant workload, and a long soak for leaks and fragmentation. Against a provider API, you are mostly testing your own rate limits and their variance by time of day, so do not tune to a single run.

What a good answer covers

  • Most LLM load tests are wrong in the same three ways
  • A closed-loop test (N workers, each sends a request and waits) throttles itself when the server slows…
  • That is coordinated omission, and it hides exactly the failure you are testing for
  • Sample input and output lengths from production logs, including the tail; a fixed 512-in/128-out…
  • Critically, get the prefix-cache realism right

Key terms: Open loop, not closed loop · Realistic token distributions · Sweep, don't spot-check · goodput · Warm up and hold

Interviewer follow-ups to expect

  1. Why does a closed-loop test with 100 workers understate P99 latency?

  2. How would you design the prompt corpus for a benchmark of an agentic workload?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep