Skip to content

Ch 20: Building Production AI Systems - Introduction

Track: Advanced | Try code in Playground | Back to chapter overview

Read online or run locally

You can read this content here on the web. To run the code interactively, either use the Playground or clone the repo and open chapters/chapter-20-building-production-ai-systems/notebooks/01_reliability_patterns.ipynb in Jupyter.


Chapter 20: Production AI Systems — Notebook 01 (Reliability Patterns)

Real services face bursts, flaky dependencies, and overload. Three patterns handle most of it: rate limiting, circuit breaking, and backoff.

What you'll learn

Topic Section
Token-bucket rate limiting §1
Circuit breaker state machine §2
Exponential backoff with jitter §3

Time estimate: 3.5 hours


Key concepts

  • Token bucket — allows short bursts up to a capacity, then sustains a steady rate.
  • Circuit breaker — stop hammering a failing dependency; fail fast, recover gradually.
  • Backoff + jitter — spread retries to avoid synchronized thundering herds.

Token buckets tame bursts, circuit breakers contain failing dependencies, and backoff with jitter prevents retry storms. Together they keep a service standing under stress.

Run the full notebook in the chapter folder for code and outputs.


Generated by Berta AI