Write a TTFT/ITL/throughput client and benchmark vLLM
Colab T4 · freescript180 minrequiredGoal · bench.py, your own asyncio load generator, producing a percentile table and a throughput-latency curve for a vLLM server at five concurrency levels.
- 1Start vllm serve Qwen/Qwen2.5-0.5B-Instruct --dtype half --max-model-len 2048 on the T4 (or reuse p3-vllm-l1).
- 2Write bench.py using httpx or the openai AsyncOpenAI client with stream=True; for each request record send time, time of first content chunk and time of every subsequent chunk.
- 3Build a prompt set of 200 requests with prompt lengths sampled 64-512 tokens and max_tokens sampled 32-256, fixed seed, temperature 0.
- 4Implement closed-loop mode with a semaphore for concurrency C and open-loop mode with Poisson arrivals at rate R; run 20 warm-up requests first and discard them.
- 5For each run compute TTFT p50/p90/p99, ITL p50/p99, TPOT mean, E2E p99, request throughput and output token throughput (count tokens by re-tokenizing the output text).
- 6Sweep C in 1, 4, 16, 32, 64 and write a CSV row per run; plot output tokens per second versus TTFT p99 and ITL p99.
- 7Run vllm bench serve --backend openai-chat with matching settings at C 16 and compare its TTFT and throughput with yours; explain any gap above 10 percent.
- 8Write a one-page report with setup table, results table, two plots, the saturation point and limitations.
- Deliverable
- bench.py, results.csv, two PNG plots and report.md.
- Check
- Output token throughput at C 32 is at least 4x that at C 1; your TTFT p50 at C 16 is within 15 percent of vllm bench serve; all tokens-per-second numbers use re-tokenized counts.
- Fallback
- Point bench.py at the CPU toy server from p3-llm-serving-architecture-l1 or vLLM's CPU backend; the absolute numbers will be small but the client, percentiles and curve shape are the same.