Unit 9 of 12 · about 4 hours · measure

Long-prefill, decode-heavy, mixed, bursty, priority and cancellation workloads

A policy tuned on chat traffic meets a pasted document sooner or later. Adversarial workloads reveal each policy's failure mode while the fix is still cheap.

You'll be able to

  • Predict queue and phase behavior for long-prefill, decode-heavy, mixed, bursty, priority and cancellation workloads.
  • Compare policies on at least three workload distributions with latency, goodput, memory, fairness and error evidence.
  • Keep one workload where the preferred policy regresses and explain it from traces.

Covers

Long-prefill and decode-heavy workloadsMixed-length and bursty workloadsPriority and cancellation workloads
1

Read

In this order, only the parts listed

0 of 3 done

  1. Sarathi-Serve capacity workloads and SLOsSarathi-Serve: Tackling Throughput-Latency Tradeoffs in LLM Inference

    Section 5 (arXiv:2403.02310v3) capacity evaluation: openchat_sharegpt4 with median prompt 1730 tokens against arxiv_summarization with median 7059, under strict and relaxed latency SLOs with Fig 10 and Fig 11; Section 5.4 ablation of chunking and hybrid batching in isolation and combined

    Use the workload shapes and SLO split as your design template. Treat the capacity multiples as the paper's results on its hardware, not targets.

  2. Workload model and extension pointsLLM Inference: From scratch, one token at a time - Module 05

    Code lab workload model: lognormal prompts and outputs with Poisson arrivals; the follow-up exercises for a KV memory cap with recompute preemption and a priority queue with aging

  3. Mixed-length workload that motivates refillHands-On LLM Serving and Optimization - Chapter 6, batching and scheduling

    Continuous Batching for LLM Online Inference (pp.192-194): Fig 6-3 uneven lengths causing idle time and Fig 6-4 in-flight refill; reproduce this shape as the first adversarial mix before adding bursts, priorities and cancels

2

Focus on

  • Each workload attacks one mechanism: long prefills attack inter-token latency, decode-heavy mixes attack the memory cap, mixed lengths attack convoys, bursts attack the queue, priorities attack starvation, and cancels attack cleanup.
  • Freeze the corpus across policies. Same arrivals, same lengths, same seed; only the policy changes, or the comparison measures the workload instead of the scheduler.
  • Report tails, fairness and errors beside throughput. The adversarial signal lives in p99, maximum wait, preemption counts and leaked blocks, not in the mean.
  • Keep the losing workload in the report. A policy without a documented regression is an untested policy, and the checkpoint requires one.
Common mistakes · 3
  • Tuning on one friendly workload. Chat-only traffic hides prefill stalls, document-only traffic hides convoys, and steady rates hide bursts; the suite needs all of them.
  • Regenerating the workload per policy run. Fresh random draws confound policy effects with sampling noise, so generate once, save the corpus and replay it.
  • Averaging the adversarial tail away. A mean over a bursty run can look healthy while every burst request missed its SLO; percentiles and per-request timelines carry the verdict.
3

Try it yourself

Closed-book, before checking anything

Closed-book, specify a six-request adversarial set: one 8000-token prefill, three short chats, one simultaneous arrival pair, and one request cancelled mid-decode. Predict for unchunked continuous batching: worst inter-token latency near one full prefill cost during the long prefill (about 186 ms in the module's Llama-3-8B on H100 example; recompute it for your model and GPU), the burst pair queues behind the running batch, and the cancel must free its blocks or memory accounting drifts. Then run it and compare prediction against trace.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Which workload breaks a decode-priority scheduler, and what is the visible symptom?Answer

    Sustained overload with fresh arrivals. Prefills never win an iteration, so new requests queue unboundedly while decoders look busy; the symptom is growing TTFT with flat token output.

  2. 2.Why pair a long-prefill workload with a cancellation workload?Answer

    Long prefills raise preemption and eviction pressure, which exercises the paths cancels also use. A leak that is invisible at low churn becomes measurable when both run together.

  3. 3.Two policies tie on throughput but differ on the bursty workload. What decides?Answer

    Tail and fairness evidence: p99 and maximum wait during bursts, preemption counts, and whether any burst request starved. Throughput already failed to discriminate.

  4. 4.Why must the corpus stay fixed across policies?Answer

    Otherwise arrival and length differences explain the outcome as well as the policy does. A frozen corpus with a fixed seed isolates the scheduler as the only variable.

You're done when

Three frozen workloads rank two policies differently and you explain each ranking from request traces, including one regression.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 15 more in the section

Also in this section

  • Orca: A Distributed Serving System for Transformer-Based Generative ModelsUSENIX OSDI · required

    Study iteration-level scheduling and selective batching, including the workload assumptions. Reproduce one scheduling timeline by hand and use it as the correctness baseline for the simulator.

  • AI Systems Performance Engineering - Chapters 16 and 18, scheduling and admissionChris Fregly (O'Reilly) · required

    Read "Dynamic Batching, Scheduling, and Routing" in Chapter 16 and "SLO-Aware Request Management and Fault Tolerance" in Chapter 18 (early rejection, quality of service).

  • Nano-vLLM - Scheduler, Block Manager and Engine LoopGeeeekExplorer · required

    Trace scheduler.py with llm_engine.py and block_manager.py. Add event logging in your own fork or project, explain every transition, and implement one bounded admission or chunking change with regression tests.

  • Mini-SGLang - Scheduler and Overlap SchedulingSGLang Project · required

    Read docs/structures.md, scheduler implementation and tests/core/test_scheduler.py, then compare overlap scheduling with the Nano-vLLM loop. Use the online benchmark only after fixing the same workload and hardware contract.

  • AI Systems Performance Engineering - Continuous Batching LabChris Fregly · support

    Run the Chapter 15 baseline and optimized continuous-batching pair under CPU-safe or available-GPU settings. Inspect the shared comparison contract and re-measure rather than quoting bundled deltas.

  • TensorTonic Language Modeling from Scratch - Simulate Continuous Decode BatchingTensorTonic · support

    Solve after the continuous-batching unit, then compare its admission rule with your own simulator.

  • LLM Inference Systems Laboratory - SchedulerRoadmap-Final · support

    Add token and memory admission, chunking, priority, cancellation, overload and fairness to the simulator, then carry one policy through the real engine path with a reference fallback.

  • vLLM v0.31.0 serve CLI and scheduler argumentsvLLM Project · reference

    Look up scheduler flags and defaults: --max-num-seqs, --max-num-batched-tokens, --max-num-active-seqs, --enable-chunked-prefill, --long-prefill-token-threshold and --scheduling-policy. Runtime defaults vary by GPU class, so check them against the installed v0.31.0 behavior.

  • vLLM v0.31.0 metrics designvLLM Project · reference

    Read the WAITING, RUNNING and PREEMPTED request states and the queue, inference, prefill and decode interval definitions. Swapped-preemption metrics are legacy in v1. The exported counters, including vllm:num_requests_waiting_by_reason and vllm:num_preemptions, are listed on the Production Metrics page, https://docs.vllm.ai/en/v0.31.0/usage/metrics/

  • vLLM v0.31.0 benchmark CLIvLLM Project · support

    Use vllm bench serve with --request-rate for offered-load sweeps, and vllm bench throughput and vllm bench latency for offline endpoint and phase baselines. Fix the dataset, lengths, request rate, warmup and sampling, and keep raw per-request results; do not copy example rates as targets.

  • vLLM v0.31.0 online servingvLLM Project · reference

    Read the /abort_requests endpoint and the Responses cancel API for request cancellation. Verify client-disconnect aborts on your engine; the page does not cover them.

  • vLLM v0.31.0 LoRA adaptersvLLM Project · reference

    Read per-request LoRARequest serving, server-wide --lora-modules with max_loras and max_lora_rank, and why adapter-slot pressure rewards grouping same-adapter requests.

  • vLLM v0.31.0 structured outputsvLLM Project · reference

    Read the xgrammar and guidance backends, the choice, regex, json, grammar and structural_tag options in StructuredOutputsParams, and the --structured-outputs-config.backend flag.

  • vLLM v0.31.0 multimodal inputsvLLM Project · reference

    Read limit_mm_per_prompt, content hashing with multi_modal_uuids in Cached Inputs, and the video pruning flags as examples of encoder-side scheduling cost.

  • TensorTonic Language Modeling from Scratch - Route Cache-Aware Prefill RequestsTensorTonic · support

    Solve after the affinity unit: assign each request to a feasible worker by longest cached prefix, lowest projected uncached load, greatest remaining capacity, then lowest worker id, with -1 when infeasible.