Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Scaling AI Systems

Free · sign in to start and track progress

1 · Throughput under limits

  • 1Rate limits and quotas
  • 2Concurrency and flow control
  • 3Retries, backoff and overload
  • 4Backpressure, load shedding and batching

2 · Latency, resilience and capacity

  • 5Latency engineering for agents
  • 6Response caching and failover
  • 7Load testing and capacity planning

    Exercise answers

    • Answer: Load test a fleet slice against a mock
    • Answer: Write a capacity plan for doubling the fleet
CapstoneMonth-end readiness for an agent fleetReference implementation

Module 2 · Latency, resilience and capacity · Lesson 7

Load testing and capacity planning

Prove the fleet holds under month-end load by replaying recorded traces against a mock model server, then turn the measurements into a capacity plan with Little's law, utilisation, burstiness, Erlang C and pooling, and decide what changes as customers and cases grow.

90 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uv

By the end of this lesson you can

  • Explain why LLM workloads are load tested against a mock model server, and build one that reproduces latency, streaming and rate limits
  • Build a workload model from recorded traces and drive it with Locust, including a month-end load shape and TTFT as a custom metric
  • Find the knee of the latency-throughput curve and report goodput against per-step targets
  • Compute queueing delay from utilisation and burstiness with the M/D/1 and Kingman formulas, and size worker pools with Erlang C and square-root staffing
  • Produce a capacity plan for fleet growth that combines tier, batch offload, model mix, pooling and headroom

On this page

  • Part 1: load testing an LLM fleet
  • Why not test against the real API?
  • A mock model server
  • A workload from traces
  • Driving the load with Locust
  • What to report
  • Part 2: queueing theory for capacity planning
  • Utilisation and the knee
  • Sizing worker pools with Erlang C
  • Pooling and fairness
  • Part 3: a capacity plan for growth
  • Misconceptions and limits
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Part 1: load testing an LLM fleet
  2. 02Part 2: queueing theory for capacity planning
  3. 03Part 3: a capacity plan for growth
  4. 04Misconceptions and limits
  5. 05Connections
  6. 06Summary

Sources & further reading

  • BurstGPT: A Real-world Workload Dataset to Optimize LLM Serving SystemsPaper · Wang et al. · 2024Real LLM traffic is bursty and failure-prone. Read the analysis of request concurrency and response lengths before choosing arrival processes for a load test.
  • Vidur: A Large-Scale Simulation Framework For LLM InferencePaper · Agrawal et al. · 2024MLSys 2024. Simulates LLM serving deployments instead of load testing every configuration on GPUs. Relevant if you self-host; read the motivation for why simulation beats exhaustive testing.
  • Etalon: Holistic Performance Evaluation Framework for LLM Inference SystemsPaper · Agrawal et al. · 2024Argues that TTFT, time between tokens and normalised latency each miss parts of the user experience, and proposes metrics that capture stalls. Useful when choosing what a load test reports.
  • Performance Modeling and Design of Computer SystemsBook · Mor Harchol-Balter · Carnegie Mellon University · 2013Chapters 6 (Little's law and operational laws), 14 (M/M/k server farms) and 15 (capacity provisioning and square-root staffing) are the theory behind this lesson's sizing.
  • GuideLLMDocs · vLLM projectA load generator for OpenAI-compatible and vLLM servers with synchronous, concurrent, constant, Poisson and sweep profiles, and TTFT and inter-token latency distributions. The tool to use against a self-hosted or OpenAI-compatible endpoint.
  • Locust custom load shapesDocs · LocustLoadTestShape and tick(), which returns a user count and spawn rate about once a second; the basis for the month-end shape in this lesson.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 6 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks