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

    Exercise answers

    • Answer: Simulate the month-end rush
    • Answer: A deferrable-work batch pipeline against a mock

2 · Latency, resilience and capacity

  • 5Latency engineering for agents
  • 6Response caching and failover
  • 7Load testing and capacity planning
CapstoneMonth-end readiness for an agent fleetReference implementation

Module 1 · Throughput under limits · Lesson 4

Backpressure, load shedding and batching

What to do when demand exceeds capacity for hours, not seconds. Compute backlog and drain time, order work by criticality with aging, admit or shed at the edge, push back on producers, and move deferrable work into batches.

75 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uvGet an OpenRouter keyOpenRouter or a local model?Local models with Ollama

By the end of this lesson you can

  • Compute backlog growth, drain time and FIFO waiting time for a load spike from arrival and service rates
  • Design priority classes for an agent fleet, with aging to prevent starvation, and quantify their effect on critical work
  • Implement admission control that sheds or defers work whose expected wait exceeds its deadline
  • Propagate backpressure upstream to webhooks, queues and sweeps instead of buffering without bound
  • Decide when to micro-batch items into one call and when to move work to the Message Batches API, including the data-handling trade-off

On this page

  • Intuition: the airport on a bank holiday
  • The arithmetic of overload
  • Worked example: last Friday of the month
  • Priority, aging and admission
  • Priority classes
  • Aging
  • Admission control and shedding
  • Backpressure: pushing back upstream
  • Batching
  • Micro-batching: several items in one call
  • The Message Batches API: a separate pool
  • Misconceptions and limits
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Intuition: the airport on a bank holiday
  2. 02The arithmetic of overload
  3. 03Priority, aging and admission
  4. 04Backpressure: pushing back upstream
  5. 05Batching
  6. 06Misconceptions and limits
  7. 07Connections
  8. 08Summary

Sources & further reading

  • Queueing, Predictions, and LLMs: Challenges and Open ProblemsPaper · Michael Mitzenmacher, Rana Shahout · 2025A survey of scheduling with predictions such as estimated service times, and the open problems in applying it to LLM serving, where output length is unknown in advance. It frames the priority and admission decisions in this lesson.
  • Fairness in Serving Large Language ModelsPaper · Sheng et al. · 2024OSDI 2024. The trade-off between fairness, priority and utilisation when a shared LLM service is overloaded.
  • Handling Overload (Site Reliability Engineering, chapter 21)Lab research · Alejandro Forero Cuervo · Google · 2016Read "Criticality". Four classes from CRITICAL_PLUS to SHEDDABLE, propagated from request to request, and the principle that batch work is the first to be shed.
  • Batch processing (Claude API docs)Docs · AnthropicLimits (100,000 requests or 256 MB per batch), most batches done within an hour, 24-hour expiry, 29-day result retention, separate rate limits, best-effort caching and ZDR ineligibility.
  • Inngest priorityDocs · InngestPriority as an expression evaluated per event, within a default range of -600 to 600 seconds, which reorders queued runs but adds no capacity.
  • Rate limits, Message Batches API section (Claude API docs)Docs · AnthropicThe separate Batches limits per tier, including the maximum number of batch requests waiting in the processing queue.
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.

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