Unit 5 of 12 · about 4 hours · explain, derive

Priorities, deadlines, fairness, starvation and head-of-line blocking

FCFS treats unequal work equally, so one pasted document can delay every request behind it. Priority fixes that for some users by hurting others, which is why fairness needs an explicit definition.

You'll be able to

  • Explain priority classes, deadlines, fairness, starvation, priority inversion and head-of-line blocking with scheduler examples.
  • Derive the convoy delay a long prompt imposes on short requests behind it under FCFS.
  • Define an aging rule that bounds maximum wait without abandoning priority order.

Covers

Priority classes and deadlinesFairness, starvation and priority inversionHead-of-line blocking and convoy effects
1

Read

In this order, only the parts listed

0 of 3 done

  1. Queueing policy, fairness and the starvation trapLLM Inference: From scratch, one token at a time - Module 05

    Concept 05: FCFS against shortest-job-first with unknown output lengths; the priority and fairness discussion with its unclear unit of fairness in requests, tokens or GPU time; the starvation trap of decode-priority policies

  2. Latency-aware scheduling and tiered quality of serviceAI Systems Performance Engineering - Chapters 16 and 18, scheduling and admission

    Latency-Aware Scheduling and Dynamic Routing (p.1001) with the six-prompt two-GPU routing example; Quality of Service (p.1147) with configs/qos.yaml reserving 10%, 30% and 60% of prefill and decode workers for premium, standard and free tiers

  3. Iteration-level FCFS and the batch-size tradeoffOrca: A Distributed Serving System for Transformer-Based Generative Models

    Section 4.2 iteration-level FCFS definition: an earlier arrival runs the same or more iterations than a later one; the max batch size knob trading throughput against latency

2

Focus on

  • FCFS is fair in arrival order but blind to size, so a long prefill at the head blocks every short request behind it. That convoy is head-of-line blocking in scheduler form.
  • The fair unit is a choice, not a fact. One 100k-token request and a thousand 100-token requests consume comparable resources through different shapes, so state whether you equalize requests, tokens or GPU time.
  • Any strict priority can starve the bottom class under sustained load, because higher-priority work always exists. Aging raises a waiter's priority with its wait until it must win.
  • Reserved capacity shares the machine under contention; it does not promise latency. A premium tier with 10% reserved still queues when its own demand exceeds that share.
Common mistakes · 3
  • Promising that priority lowers latency for everyone. It redistributes wait from one class to another; the total work is unchanged and the bottom class waits longer.
  • Reading a reserved fraction as a latency guarantee. reserved_fraction splits workers under contention, so a tier still queues past its share and still suffers its own convoys.
  • Reaching for shortest-job-first to fix convoys. Output length is unknown at admission and predictions are poor, so exact SJF is unavailable; size-aware admission needs an honest proxy such as prompt length.
3

Try it yourself

Closed-book, before checking anything

Closed-book, derive convoy delay under FCFS with the module's Llama-3-8B on H100 model, whose prefill runs at : one 100000-token prompt ahead of ten 100-token prompts adds about to every short request's TTFT, independent of their size. Then state an aging rule, such as effective priority rising linearly with wait, that bounds any request's wait under continuous decode-priority load.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.Why does FCFS produce convoys even though it is fair?Answer

    It orders by arrival without regard to size. A long prefill at the head occupies the shared hardware while short requests behind it wait, so small jobs pay for work unrelated to their size.

  2. 2.What makes priority inversion possible in a serving scheduler?Answer

    A low-priority request holds a contended resource, such as the running batch or KV blocks, while a high-priority waiter cannot proceed until it releases. The priority order says the waiter matters more, but the resource order serves the holder first.

  3. 3.A decode-priority scheduler never idles under load. Why can a new request still starve?Answer

    There is always more decode work under sustained load, so prefills never win an iteration. Without aging, a request can wait unboundedly while the machine looks fully utilized.

  4. 4.Premium reserves 10% of workers. Does a premium request skip queueing?Answer

    No. The reserve protects premium from free-tier contention, not from premium-tier contention. Past its share it queues like everyone else.

You're done when

You derive a convoy delay without notes and can show which workload starves under each policy you studied.

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

  • Hands-On LLM Serving and Optimization - Chapter 6, batching and schedulingChi Wang and Peiheng Hu (O'Reilly) · primary

    Read "Request Batching and Scheduling-Level Optimizations" in Chapter 6: dynamic, continuous and chunked-prefill batching. Rebuild each policy in a small event simulator and state the user-visible metric it can improve or harm.

  • Sarathi-Serve: Tackling Throughput-Latency Tradeoffs in LLM InferenceMicrosoft Research · required

    Focus on chunked prefills, stall-free batching and the throughput-latency trade-off. Implement a fixed-token chunk policy and preserve a workload where chunking loses to the simpler scheduler.

  • 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.