Kayavak / Workbench / Experiments
Workbench
Experiments
Every chapter ends with a lab: real code, run on a stated machine, with the numbers it gave. 291 of them, gathered here so you can find one by what it measures. Each says its setup and its limits; repeat it and compare your numbers.
This week's experiments
Three labs from different books, changing every Monday.
Information Theory 11 labs
- Surprise and information in PythonStart Here: What Information Is · Information Theory
Python 3.13 on the lab machine, 27 November 2026.
- Counting, packing and sortingCounting Possibilities: Bits, Logarithms and Questions · Information Theory
Python 3.13 on the lab machine, 27 November 2026.
- Probability measuredThe Probability You Need · Information Theory
Python 3.13 on the lab machine, 27 November 2026.
- Entropy measuredEntropy: the Average Surprise of a Source · Information Theory
Python 3.13 on the lab machine, 27 November 2026.
- Codes built and measuredCodes: Prefix Codes, Kraft's Inequality and Huffman Coding · Information Theory
Python 3.13 on the lab machine, 27 November 2026.
- The theorem measuredThe Source Coding Theorem: Why Entropy Is the Limit · Information Theory
Python 3.13 on the lab machine, 27 November 2026.
- Two variables at a timeJoint and Conditional Entropy, Mutual Information · Information Theory
Python 3.13 on the lab machine, 27 November 2026.
- Noise, codes and checksChannels and Noise · Information Theory
Python 3.13 on the lab machine, 28 November 2026.
- Capacity, measuredChannel Capacity and the Noisy-Channel Coding Theorem · Information Theory
Python 3.13 with NumPy on the lab machine, 28 November 2026.
- Real sourcesInformation Everywhere: Language, DNA, Randomness and Passwords · Information Theory
Python 3.13 on the lab machine, 28 November 2026.
- Models, losses and driftInformation in Machine Learning: Cross-Entropy and KL Divergence · Information Theory
Python 3.13 with NumPy and scikit-learn 1.9 on the lab machine, 28 November 2026.
Arithmetic and Numbers 12 labs
- Numbers meet a computerStart Here: What Numbers Are · Arithmetic and Numbers
Python 3.13 and Node.js 22 on the lab machine (a 2-core Linux container), November 2026.
- Bases in codePlace Value and Bases · Arithmetic and Numbers
Python 3.13 and Node.js 22 on the lab machine, November 2026.
- Adding with a machineAdding and Subtracting, and Why the Methods Work · Arithmetic and Numbers
Python 3.13 and Node.js 22 on the lab machine, November 2026.
- Multiplying and dividing in codeMultiplying and Dividing · Arithmetic and Numbers
Python 3.13 and Node.js 22 on the lab machine, November 2026.
- Primes and divisors in codeFactors, Multiples and Primes · Arithmetic and Numbers
Python 3.13 on the lab machine, November 2026.
- Exact fractions in codeFractions · Arithmetic and Numbers
Python 3.13 on the lab machine, November 2026.
- Decimals in codeDecimals and Percentages · Arithmetic and Numbers
Python 3.13 on the lab machine, November 2026.
- Ratios and rates in codeRatio, Proportion and Rates · Arithmetic and Numbers
Python 3.13 on the lab machine, November 2026.
- Negative numbers in codeNegative Numbers · Arithmetic and Numbers
Python 3.13 and Node.js 22 on the lab machine, November 2026.
- Powers and logarithms in codePowers, Roots, Scientific Notation and Logarithms · Arithmetic and Numbers
Python 3.13 on the lab machine, November 2026.
- Rounding, error and units in codeEstimation, Rounding, Error and Units · Arithmetic and Numbers
Python 3.13 on the lab machine, November 2026.
- The real line in codeThe Real Number Line · Arithmetic and Numbers
Python 3.13 on the lab machine, November 2026.
Foundations of Computing 9 labs
- Programming fundamentals, measuredProgramming Fundamentals & Paradigms · Foundations of Computing
The sections above explain the ideas.
- Data structures, measuredData Structures · Foundations of Computing
Every number in this lab comes from running the code shown (GCC 13 at -O2, JDK 21, Go 1.24, Rust 1.97, CPython 3.13, PostgreSQL 16) on a 2-core cloud sandbox.
- Algorithms, measuredAlgorithms · Foundations of Computing
Asymptotic analysis tells you how cost grows; experiments tell you where the crossovers are and which assumptions break.
- Discrete mathematics at workDiscrete Mathematics · Foundations of Computing
Discrete mathematics shows up in engineering as estimates you can trust and arguments you can check.
- Bits, numbers and text, measuredNumber Systems & Data Representation · Foundations of Computing
The bugs in this chapter are silent: no exception, just a wrong number or a garbled name.
- Seeing the hardware from softwareComputer Architecture · Foundations of Computing
You can't open the CPU, but you can make its behaviour visible from a C program and a timer.
- Watching the operating system workOperating Systems · Foundations of Computing
The kernel is invisible until you measure it.
- Protocols you can watchNetworking Fundamentals · Foundations of Computing
This book's sandbox can't reach the internet directly (its DNS and outbound traffic go through a proxy), which turns out to be a good teaching constraint: every protocol below is exercised on localhos
- Inside the toolchainCompilers & Runtimes · Foundations of Computing
Compilers and runtimes are programs you can watch.
The Web Frontend 21 labs
- The platform, measuredThe Web Platform · The Web Frontend
Every result below came from Chromium 153 (headless, driven by Playwright) talking to small Node servers on localhost.
- HTML, measuredHTML · The Web Frontend
Every result below came from Chromium 153 (headless, driven by Playwright) against small Node servers on localhost.
- The cascade and layout, measuredCSS · The Web Frontend
Each experiment below set a small page's HTML and CSS in Chromium 153 and read back what the browser computed (getComputedStyle) and where it put things (getBoundingClientRect).
- JavaScript's runtime, measuredJavaScript · The Web Frontend
The first two experiments ran in Chromium 153 (headless, via Playwright); the others in Node 22.
- What the checker does and doesn't doTypeScript · The Web Frontend
Everything below was run with TypeScript 7.0.2, the native Go compiler, and cross-checked with TypeScript 5.9.3 (the messages were identical), plus Node 22.22 (--experimental-strip-types).
- The DOM's costs and timing, measuredDOM & Browser APIs · The Web Frontend
All experiments ran in Chromium 153 (headless, 1000 × 700 window) through Playwright.
- Watching the engine workBrowser Internals · The Web Frontend
These experiments read Chromium 153's own counters through the DevTools protocol (Performance.getMetrics, SystemInfo.getProcessInfo, Target.getTargets) while Playwright drove the page, plus a Node server's request log.
- The network, observed from both endsFrontend Networking · The Web Frontend
Each experiment pairs Chromium 153 (via Playwright) with a small Node server that logs exactly what arrived.
- Accessibility, testedAccessibility · The Web Frontend
These experiments use axe-core 4.14 (the engine behind Lighthouse's accessibility audit and many CI tools), Playwright's accessibility-tree snapshots and keyboard driving in Chromium 153, and a ten-li
- Architecture you can measureUI Architecture · The Web Frontend
Three experiments in Chromium 153 and Node 22: the cost of the three update strategies, the bug that keys prevent, and an automated check for dependency direction.
- React's rendering behaviour, measuredReact · The Web Frontend
React 19 bundled with esbuild and run in Chromium 153, in production mode unless stated.
- Angular's reactivity, measuredAngular · The Web Frontend
The components below were compiled ahead of time with Angular 22's compiler (ngc, the compiler the CLI wraps), bundled with esbuild, and run in Chromium 153.
- Rendering strategies, measuredFull-stack Frameworks · The Web Frontend
Every strategy here was built by hand on a small Node server with React 19's own APIs (renderToString, renderToPipeableStream, hydrateRoot), which is what full-stack frameworks do underneath.
- State tools, measuredState Management · The Web Frontend
React 19 with Zustand 5.0 and TanStack Query 5, bundled with esbuild and run in Chromium 153 against a small Node API; the reducer and state-machine experiments in Start here ran in Node 22.
- Testing the testsFrontend Testing · The Web Frontend
Run on a small React project with Vitest 5.0, Testing Library, MSW 2, jsdom and Playwright 1.63 (Chromium).
- Performance, measuredFrontend Performance · The Web Frontend
All experiments ran in Chromium 153 through Playwright, emulating a mid-range phone with the DevTools protocol: CPU slowed 4× (Emulation.setCPUThrottlingRate), downloads limited to 10 Mbit/s (Network.
- Defences, verifiedFrontend Security · The Web Frontend
Each defence below was tested against a deliberately vulnerable page served from localhost, in Chromium 153, so you can see exactly what it stops and what it doesn't.
- Offline, parallel and compiled, measuredPWAs, Workers & WebAssembly · The Web Frontend
Experiments in Chromium 153 via Playwright; the WebAssembly modules were compiled from C with Clang 18 (clang --target=wasm32 -O2 -nostdlib -Wl,--no-entry), producing modules of 571 bytes and a few ki
- The toolchain, measuredBuild Tooling & Monorepos · The Web Frontend
Run with npm 10, esbuild, Vite 8.3.5 (with its Rust-based Rolldown bundler) and Turborepo 2.11 on Node 22.
- Deploys that don't break open tabsFrontend Deployment · The Web Frontend
These experiments used a Node static server standing in for a host or CDN, two builds of a tiny SPA (v1 and v2, each with a hashed main script and a lazily imported orders chunk), and Chromium 153.
- Telemetry from the browser, examinedFrontend Observability · The Web Frontend
Chromium 153 sending reports to small Node servers; the percentile experiment ran in Node 22 on simulated data.
The Backend 22 labs
- The language's sharp edges, measuredLanguage Foundations · The Backend
Run on JDK 21 (java -Dstdout.encoding=UTF-8 Lab.java, since Java prints ₹ as ?
- Four object-design bugs, reproducedObject-Oriented Programming and Its Alternatives · The Backend
Each experiment below is a classic design failure reduced to a few lines and run on JDK 21.
- Choosing the wrong collection, measuredCollections · The Backend
Run on JDK 21 with java -Xmx2g Lab.java; timings are from the third round, after the JIT has compiled the loops.
- Where erasure bites, and what generics costGenerics and Type Parameters · The Backend
Java experiments run on JDK 21 (unchecked warnings left visible on purpose); the last experiment uses Go 1.24 to compare three ways of writing generic code.
- Streams under loadFunctional Programming · The Backend
Run on JDK 21 on a 2-core machine (java -Xmx2g Lab.java); timings are from the last of five rounds.
- Five concurrency failures, reproducedConcurrency · The Backend
Compiled with JDK 21 (javac --release 21) and run on a 2-core machine; experiment 4 runs the same class on JDK 21 and JDK 25.
- Versions, compatibility and what an upgrade buysModern Java Through JDK 27 · The Backend
Compiled with JDK 21's javac; run on JDK 21 and on a JDK 25.0.2 runtime.
- Watching the JIT and the collectors workJVM Internals and Other Runtimes · The Backend
Run on JDK 21 on a 2-core machine.
- The hardware and the JIT, measuredMemory and Performance · The Backend
Run on JDK 21 on a 2-core machine, timings from the last of several rounds.
- Dependency conflicts and their fixesModules, Packaging and Dependency Conflicts · The Backend
Run with JDK 21 (and a JDK 25 runtime for the last experiment), using the two versions of the com.acme.money library from Start here: 1.0 has format and version; 2.0 changes format's output and adds formatWithGst.
- What makes builds fast, correct and reproducibleBuild Systems · The Backend
Gradle 8.14 on JDK 21, with a generated project of 400 classes (each with a record, a stream pipeline and a switch, and chains of classes calling each other); javac, jar and make by hand for compariso
- Three ways a healthy backend falls overBackend Fundamentals · The Backend
A JDK HttpServer with three endpoints, driven by a Java HttpClient load generator on the same 2-core machine (JDK 21, server started with -Dsun.net.httpserver.nodelay=true; chapter 45's lab shows why).
- API shapes under real network conditionsHTTP API Design · The Backend
PostgreSQL 16 for pagination (2 million orders, queried from Python with psycopg); a JDK HttpServer with a filter that adds a 40 ms delay per request to stand in for a mobile network round trip; JDK 21.
- Proxies, scopes and startup, observedSpring Core · The Backend
Run on JDK 21 with Spring Framework 7.0.9 (spring-context, spring-aop), using @EnableCaching with a ConcurrentMapCacheManager and @EnableAsync.
- What Boot decides, and what it costsSpring Boot · The Backend
Spring Boot 4.1.1 on JDK 21 (and a JDK 25 runtime for the AOT cache), using the CafeApplication from Start here.
- Spring MVC and Reactor under pressureSpring Web — MVC and WebFlux · The Backend
Spring Boot 4.1.1 (Spring MVC 7.0.9, Tomcat 11.0.24) and Reactor 3.8.7 on JDK 21, 2 cores; the OrdersApp from Start here plus three test endpoints (/api/slow sleeps 100 ms, /api/hang sleeps 20 s, /api
- The persistence problems behind most incidentsPersistence — JDBC, JPA, Hibernate and Spring Data · The Backend
JDK 21, PostgreSQL 16 on the same machine, PostgreSQL JDBC driver 42.7.3.
- Attacks against authentication, reproducedSpring Security and Modern Identity · The Backend
Password hashing with Python's bcrypt 5.0 and argon2-cffi 25.1 (and the JDK's PBKDF2 for comparison); JWT verification written by hand to show what libraries must check; CSRF and CORS reproduced in he
- Five ways asynchronous work goes wrongAsynchronous Work, Jobs and Messaging · The Backend
JDK 21 and PostgreSQL 16, with the database standing in for both a job queue and a broker (the failure modes are identical with Kafka, RabbitMQ or SQS; only the APIs differ).
- Resilience patterns, measuredResilience · The Backend
JDK 21 on a 2-core machine.
- Hit rates, stampedes and stale dataCaching · The Backend
JDK 21, PostgreSQL 16 and Redis 7.0 on one machine, using the small RESP client from Start here.
- How good is a test suite?Backend Testing · The Backend
JDK 21 with JUnit Jupiter 5.13, PostgreSQL 16, and the Spring Boot 4.1.1 OrdersApp from chapter 48.
Databases 10 labs
- Modelling mistakes, measuredThe Relational Model · Databases
PostgreSQL 16 driven from Python (psycopg) on a 2-core machine.
- SQL that's wrong, and SQL that's slowSQL from SELECT to Window Functions · Databases
PostgreSQL 16, with a generated dataset: 10,000 customers (9,000 of whom have ordered), 200,000 orders between January and May 2026, 3 lines per order, and one or two payment rows per order.
- MVCC, vacuum, durability and replication, observedPostgreSQL in Depth · Databases
PostgreSQL 16 on a 2-core machine, driven from Python and pgbench; experiment 5 adds a streaming replica on the same machine, created with pg_basebackup -R -X stream -c fast.
- Inside the storage layerStorage Engine Internals · Databases
PostgreSQL 16 (with pageinspect), SQLite 3 and RocksDB (through the rocksdict Python binding) on a 2-core machine with an SSD.
- Concurrency anomalies and lock troubleTransactions and Concurrency Control · Databases
PostgreSQL 16, with sessions driven from Python so interleavings are exact; experiment 2 uses 8 concurrent threads.
- Indexes that work, indexes that don'tQuery Optimisation · Databases
PostgreSQL 16 with 3 million orders (o2) and 200,000 customers (c2), best of five runs.
- Partitions, shards and failoverScaling Databases · Databases
PostgreSQL 16 on a 2-core machine; a streaming replica on the same machine (pg_basebackup -R -X stream -C -S replica1); a Python simulation for shard placement.
- The trade-offs of non-relational storesNoSQL Data Models and Stores · Databases
FerretDB 1.24 (a MongoDB wire-protocol server, here backed by PostgreSQL) accessed with pymongo; Redis 7.0 with a replica; PostgreSQL 16; DuckDB, all on one 2-core machine.
- Relevance, speed and approximate searchSearch Engines and Hybrid Search · Databases
Tantivy (a Lucene-style engine) from Python, PostgreSQL 16 full-text search, the all-MiniLM-L6-v2 embedding model (implemented in NumPy from its published weights; its similarities match the reference
- Backing up, breaking and restoringDurability, Backups and Recovery · Databases
A separate PostgreSQL 16 cluster initialised with --data-checksums, wal_level = replica, archive_mode = on and archive_command = 'test !
Distributed Systems 14 labs
- Latency, tails, order and slow replicasFoundations of Distributed Systems · Distributed Systems
Python HTTP servers and Toxiproxy on one 2-core machine.
- Brokers under real conditionsMessaging Systems · Distributed Systems
NATS JetStream 2.11 (single server, file storage) on a 2-core machine, driven by the nats-py client.
- Kafka client behaviour you can measureKafka in Depth · Distributed Systems
The franz-go 1.18 client against kfake (an in-memory cluster that implements the Kafka protocol: produce, fetch, groups, offsets, idempotent producers).
- Duplicates and losses, countedDelivery Semantics · Distributed Systems
NATS JetStream 2.11 and PostgreSQL 16 on one machine, driven from Python (nats-py, psycopg 3).
- Anomalies on real replicasConsistency Models · Distributed Systems
A 3-member etcd 3.6 cluster on one machine (members on 127.0.0.1–3; member 3 partitioned with iptables rules that drop its peer traffic while leaving clients able to reach it), and Redis 7 with a near
- Partitions on purposeCAP and PACELC · Distributed Systems
The 3-member etcd 3.6 cluster from chapter 69 (member 3 isolated with iptables), Redis 7 (one primary, one nearby replica, one replica behind a 3 ms Toxiproxy link), and a second Redis pair whose link
- Quorums, repair, clocks and real lagReplication · Distributed Systems
Experiments 1 and 2 use this book's Python Dynamo model (dyn.py: three replicas with random simulated delays of 1–3 ms, one at 20–40 ms; writes go to all and wait for W; reads ask R random replicas in parallel).
- A Raft cluster under load and failureConsensus · Distributed Systems
Throwaway etcd 3.6 clusters on one 2-core machine, each member on its own loopback address with its own data directory on the same disk; Python clients over etcd's HTTP gateway.
- Two-phase commit and sagas, measuredDistributed Transactions · Distributed Systems
PostgreSQL 16 on one machine (max_prepared_transactions = 20), two databases for 2PC and one database whose three tables stand in for three services for the saga.
- An idempotent payments API under retriesIdempotency · Distributed Systems
The book's payments API (Python ThreadingHTTPServer, psycopg 3 connection pool, PostgreSQL 16), with an idem_keys table (key primary key, request hash, status, stored response).
- Clocks that jump, and clocks that don't matterTime and Ordering · Distributed Systems
Python 3.13 on Linux.
- Limiters and overload, measuredRate Limiting and Traffic Control · Distributed Systems
Redis 7 on one machine with redis-py; experiments 1, 3 and 5 are simulations on generated traffic so that every limiter sees exactly the same requests.
- Elections, detectors, locks and watchesCoordination · Distributed Systems
The 3-member etcd 3.6 cluster (members on 127.0.0.1–3) through its HTTP gateway, from Python.
- Injecting failures with ToxiproxyDistributed Failure Modes · Distributed Systems
Services A and B from the on-ramp (Python ThreadingHTTPServer; A limits itself to 10 workers), with Toxiproxy 2 between A and B.
Infrastructure 6 labs
- The kernel under your serviceLinux · Infrastructure
Ubuntu 24.04, kernel 6.18, 2 vCPUs, 8 GB RAM, a virtio disk.
- Inside containers, measuredContainers · Infrastructure
Docker 29 (containerd, runc) on the volume's Ubuntu VM with cgroup v1, the tiffin:1.0 image (a static Go binary in a FROM scratch image) and an Alpine 3.22 base image built locally from its minirootfs.
- Builds, contexts, secrets and signalsDocker · Infrastructure
Docker 29 with BuildKit on the volume's VM, building the tiffin app (one vendored dependency) with the naive and multi-stage Dockerfiles from the on-ramp.
- Load balancing, health, pooling and timeoutsReverse Proxies and Gateways · Infrastructure
HAProxy 2.8 and NGINX 1.24 on the volume's 2-CPU VM, tiffin backends (with /work?ms=N simulating N ms of work), Toxiproxy to make one backend slow, and wrk as the load generator.
- How Kubernetes reactsKubernetes · Infrastructure
A single-node k3s 1.37 cluster (2 vCPUs, 8 GB) on the volume's VM, the tiffin image, and an Alpine image for helper pods.
- Five deployments under loadKubernetes Deployment Strategy · Infrastructure
The volume's single-node k3s 1.37 cluster; tiffin:2.2 pods (which drain in-flight requests on SIGTERM); an in-cluster load generator calling the Service about 40 times a second with a 2-second timeout
Cloud 7 labs
- Availability, elasticity, durability and distance in numbersCloud Fundamentals · Cloud
Python calculations and simulations.
- Start-up, cost, scaling lag and interruptionsCompute · Cloud
Experiment 1 measured real start-ups on the volume's VM; the others are calculations and simulations with AWS list prices for us-east-1 in October 2026: Lambda (arm64) $0.0000133334 per GB-second plus
- Filters, NAT, addresses and egress costsCloud Networking · Cloud
The miniature VPC from the on-ramp (Linux network namespaces, a router with policy routing, a NAT gateway namespace), the tiffin service listening on 8443 in web1, and Python's ipaddress module for address planning.
- Versions, parts, keys, classes and IOPSCloud Storage · Cloud
The AWS SDK for Python against moto 5.2 (an S3 API emulator), Python's cryptography library for envelope encryption, fio on the VM's virtual disk, and AWS us-east-1 list prices for October 2026 (S3 St
- Evaluating policies the way the cloud doesCloud Identity · Cloud
Two tools: moto's IAM enforcement (from the on-ramp) for real allow/deny on API calls, and a compact policy evaluator written for this lab that follows AWS's documented evaluation order (explicit deny
- Reading what your infrastructure code generatesCloud Architecture · Cloud
The CDK app from the on-ramp (aws-cdk-lib 2.275, Python), synthesised locally with different settings; the generated CloudFormation templates are inspected with Python.
- A Well-Architected review of the tiffin stackWell-Architected Thinking · Cloud
cdk-nag 2.38 (AwsSolutionsChecks) run against chapter 90's CDK app during synthesis, plus error-budget arithmetic and an indicative comparison of disaster-recovery strategies.
DevOps, CI/CD and IaC 5 labs
- Git's storage and tools, measuredGit · DevOps, CI/CD and IaC
Git 2.43 on Linux, local repositories (clones over file:// with --no-local so Git uses its real transfer protocol), and git-filter-repo for history rewriting.
- What makes pipelines fast, trustworthy and safeCI/CD · DevOps, CI/CD and IaC
GitHub Actions workflows run locally with act 0.2.90 on the volume's 2-CPU VM, each job in a fresh golang:1.24-alpine container; a small Go module with a deliberately flaky test.
- Drift, state, keys and refactoringInfrastructure as Code · DevOps, CI/CD and IaC
OpenTofu 1.13 with the AWS provider 6.20 and the random provider 3.7, against the moto emulator (reset before the lab); boto3 plays "someone using the console".
- Pruning, broken commits, secrets and drift windowsGitOps · DevOps, CI/CD and IaC
The chapter's minigitops reconciler (server-side apply with forced ownership, owner-labelled pruning, SOPS 3.11 with age 1.2 keys) against the k3s 1.37 cluster; a bare Git repository on the same machine plays GitHub.
- Migrations that don't take the site downRelease Engineering · DevOps, CI/CD and IaC
PostgreSQL 16 on the volume's VM, a table of 1,000,000 orders, Python with psycopg 3.
Observability and SRE 9 labs
- The price and the linksThe Signals of Observability · Observability and SRE
The Start Here services (Python, OpenTelemetry SDK 1.45, prometheus_client 0.26), Jaeger 2.14 and Prometheus 3.15 with exemplar storage enabled, after 400 orders.
- A Collector pipeline, its buffers and its pitfallsOpenTelemetry · Observability and SRE
OpenTelemetry Python SDK 1.45, OpenTelemetry Collector Contrib 0.149 and Jaeger 2.14 (in-memory storage).
- The cost, the collection and two real bugsLogging · Observability and SRE
Python 3 logging, the Start Here services, and OpenTelemetry Collector Contrib 0.149's file_log receiver.
- Cardinality, resets and percentile trapsMetrics · Observability and SRE
Prometheus 3.15 (1-second scrapes, 15 seconds for the high-cardinality job) scraping four small Python services built with prometheus_client 0.26: a counter labelled by route and status, the same coun
- Head sampling, tail sampling and broken contextDistributed Tracing · Observability and SRE
The Start Here services with lab switches: LAB_HEAD_RATIO (SDK parent-based ratio sampler), LAB_OTLP (send to a Collector instead of straight to Jaeger), LAB_FAIL_RATE=0.03 (3% of kitchen calls fail w
- Testing SLO alerts before production doesSLIs, SLOs, SLAs and Error Budgets · Observability and SRE
Prometheus 3.15's promtool test rules evaluates recording and alerting rules against input series you define, minute by minute, exactly as Prometheus would.
- A game day with real alertingIncident Management · Observability and SRE
A game day is a rehearsed incident: you break something on purpose, under controlled conditions, to test the alerts, the runbooks and the people.
- Timeouts, bulkheads, retries and breakers under faultReliability Engineering · Observability and SRE
One Python process runs every service with aiohttp 3.14 on localhost; a controllable dependency can answer normally (5 ms), fail fast (HTTP 503) or hang (10 s).
- Queues, overload, measurement traps and a profileProduction Performance Engineering · Observability and SRE
An aiohttp 3.14 server on one machine with c = 4 workers (an asyncio.Semaphore) and exponentially distributed service times averaging 10 ms (a sleep, so the machine's CPU isn't the bottleneck): capaci
Security 8 labs
- Least privilege and layered defence, measuredSecurity Foundations · Security
Linux setpriv (from util-linux) on the lab machine, run as root so it can drop privileges.
- Applied cryptography, measuredCryptography Foundations · Security
Python 3 with cryptography 50.0.1, bcrypt and argon2-cffi, plus OpenSSL 3.0.13, on one core of the lab machine.
- Web defences, verifiedWeb Application Security · Security
Python 3 with SQLite, nginx 1.24 and headless Chromium through Playwright, all on the lab machine.
- Tokens and authorisation, testedIdentity and Access · Security
PyJWT 2.15 with Ed25519 keys from cryptography, and small Python models of an orders API, on the lab machine.
- API defences, measuredAPI Security · Security
Pydantic 2.13, nginx 1.24 and Python models on the lab machine.
- Hardening a container and a cluster, measuredContainer, Kubernetes and Cloud Security · Security
Docker 29 and single-node k3s 1.37 on the lab machine; k3s ships kube-router's NetworkPolicy controller, so policies are enforced without an extra CNI.
- SBOMs, scanning, pinning, signing and reproducibilitySoftware Supply Chain Security · Security
pip-audit 2.10.1 (PyPI advisory source), pip 24.0 hash checking, Syft 1.33.0, cosign 2.5.3 and Go 1.24 in the golang:1.24-alpine container, on the lab machine.
- Threat modelling as codeThreat Modelling · Security
OWASP pytm 1.4.0 with Graphviz on the lab machine.
Testing 7 labs
- The cost and value of each test levelTesting Philosophy · Testing
pytest 9.1.1, psycopg 3.3 against PostgreSQL 16 on a Unix socket, and Playwright 1.63 (sync API) driving headless Chromium, all on the lab machine.
- Strong unit tests, measuredUnit Testing · Testing
pytest 9.1.1, coverage 7.17 with branch coverage, mutmut 3.8.1, and Go 1.24.7 with the race detector, on the lab machine.
- Integration tests against real dependenciesIntegration Testing · Testing
PostgreSQL 16 (local, Unix socket) through psycopg 3.3, SQLite 3 from Python's standard library, and a fake HTTP provider on http.server, all on the lab machine.
- A consumer-driven contract, end to endContract Testing · Testing
pact-python 4.2.0 (the Rust-based Pact core, specification V4) and two small Python services on the lab machine.
- End-to-end tests that survive changeEnd-to-End Testing · Testing
Playwright 1.63 for Python (sync API) with headless Chromium, pytest 9.1 and pytest-xdist, on the lab machine (2 CPU cores).
- Load testing a system with known capacityPerformance Testing · Testing
k6 1.3.0 on the lab machine (2 cores) against a Go service that models a kitchen: a semaphore of SLOTS concurrent orders, each taking WORK_MS.
- A chaos experiment with a hypothesis, a fix and an abortChaos and Resilience Testing · Testing
Toxiproxy 2.12.0 (proxy pg: 127.0.0.1:25433 → PostgreSQL 16 on 5433), two versions of a Python menu service using a psycopg connection pool of 4–8 connections, and k6 1.3 sending 40 requests per secon
System Design 15 labs
- Requirements as executable checksRequirement Analysis · System Design
Two versions of a Python orders service on the lab machine (v1 stores orders in a list; v2 in SQLite with a unique idem column), a Python script that encodes three non-functional requirements as check
- Measuring the numbers you estimate withEstimation · System Design
The lab machine is a 2-vCPU cloud VM with an NVMe-backed virtual disk.
- Load-balancing algorithms and failover, measuredFundamental Building Blocks · System Design
HAProxy 2.8.30 in HTTP mode on the lab machine, in front of three copies of the Go kitchen service from Volume 11's chapter 119 (64 concurrent slots each, so they don't saturate): k1 and k2 take 10 ms
- Linear, sub-linear and retrograde scalingScaling · System Design
On the lab machine (2 vCPUs): HAProxy 2.8 (balance leastconn) in front of 1, 2 or 4 copies of the Go kitchen service (4 slots × 20 ms each, so 200/s per copy) under k6 with 16 virtual users per server
- Failover and quorum loss, measuredAvailability · System Design
A three-member etcd 3.6.5 cluster on the lab machine (members on 127.0.0.1–3, default election timeout 1,000 ms and heartbeat 100 ms), and a shell writer calling etcdctl put with a 500 ms command time
- Hit ratios, stampedes and stalenessCaching Architecture · System Design
Redis 7.0.15 and PostgreSQL 16 on the lab machine, a Python client using redis-py and psycopg 3, and a dish table of 1,000 rows.
- Replicas, read-your-writes and partitioningDatabase Architecture · System Design
A fresh PostgreSQL 16 primary (port 5440) and a streaming replica created with pg_basebackup -R -X stream (port 5441), asynchronous, on the same host.
- Fan-out, redelivery, deduplication and backlogMessaging Architecture · System Design
NATS Server 2.11.9 with JetStream (file storage) on the lab machine and the nats-py 2.16 asyncio client.
- Isolation anomalies, reproduced and preventedConsistency Architecture · System Design
PostgreSQL 16 on the lab machine, psycopg 3, two threads per experiment.
- Retry amplification, jitter and deadlinesReliability Patterns · System Design
Three Python HTTP services on the lab machine chained A → B → C, each calling the next with configurable attempts and optional deadline propagation, plus a discrete simulation of 1,000 clients retrying against an outage.
- Dual writes versus the transactional outboxEvent-Driven Architecture · System Design
PostgreSQL 16, NATS Server 2.11.9 with JetStream, and Python (psycopg 3, nats-py) on the lab machine.
- Pagination, round trips and conditional requestsAPI Architecture · System Design
PostgreSQL 16 (the 1.37-million-row orders_flat table from chapter 127, with a B-tree index on id; a 200-row dish table), a Python http.server API using HTTP/1.1 keep-alive, and an http.client client
- Row-level security and per-tenant limitsMulti-Tenancy · System Design
PostgreSQL 16 on the lab machine with a shared t_orders table and an ordinary login role tiffin_app; and a discrete-event simulation (Python, seeded) of a 4-worker service shared by two tenants.
- The price of a second regionGlobal Systems · System Design
A PostgreSQL 16 primary (port 5440) and a streaming replica (5441) on the lab machine, with the replica's primary_conninfo pointed at Toxiproxy 2.12, which added 35 ms in each direction (70 ms round t
- Checking a case study's numbersCase Studies: Putting It All Together · System Design
PostgreSQL 16 on the lab machine and Python.
Software Architecture 9 labs
- Measuring code health and refactoring safelyClean Code · Software Architecture
lizard 1.24.3 and radon 6.0.1 on the lab machine, the psf/requests repository cloned from GitHub (6,496 commits, last commit 2026-10-26), and Hypothesis with pytest for the refactoring check.
- Liskov, interface size and dependency inversion, measuredSOLID · Software Architecture
pytest 9.1 on the lab machine with five MenuStore implementations (memory, JSON file, PostgreSQL 16, and two "improved" subclasses), a 400-test service suite, and a scan of the Go 1.24.7 standard libr
- Composing decorators and measuring indirectionDesign Patterns · Software Architecture
Python 3.13 and Go 1.24.7 on the lab machine.
- Invariants under random command sequencesDomain-Driven Design · Software Architecture
Hypothesis 6.170 with RuleBasedStateMachine on the lab machine (Python 3.13).
- Ports, adapters and an architecture testArchitecture Styles · Software Architecture
Python 3.13 on the lab machine: a tiffin package with core (domain and use case, ports as typing.Protocol) and adapters (in-memory, PostgreSQL 16 via psycopg 3, command line); pytest; import-linter 2.15.
- Enforcing module boundaries and pricing the networkModular Monolith · Software Architecture
Python 3.13 on the lab machine: a shop package with ordering, kitchen and billing modules, each exposing api.py with private _*.py internals; import-linter 2.15; and a call-cost benchmark using http.s
- Fan-out, tail latency and compound failureMicroservices · Software Architecture
Ten Python http.server services on the lab machine (ports 8411–8420, TCP_NODELAY, keep-alive), each sleeping 2–4 ms (uniform) except 1% of calls at 50 ms, and failing 0.5% of calls with HTTP 500.
- A sensitivity-checked decision and a fitness-function suiteArchitecture Decision Making · Software Architecture
Python 3.13 on the lab machine: a weighted decision matrix with automatic sensitivity analysis, and a fitness-function runner combining import-linter (the projects from chapters 139 and 140), a perfor
- LLD solutions under testLow-Level Design Case Studies · Software Architecture
Go 1.24.7 on the lab machine (2 vCPUs).
AI and ML Foundations 16 labs
- Inductive bias and learning curvesAI Foundations · AI and ML Foundations
scikit-learn 1.9.1 on the lab machine (2 vCPUs).
- Vectorisation, precision and reproducibilityPython for AI · AI and ML Foundations
Python 3.13.17 and NumPy 2.5.3 on the lab machine (2 vCPUs).
- Similarity, low rank and matmul throughputLinear Algebra · AI and ML Foundations
NumPy 2.5.3 with scipy-openblas on the lab machine (2 vCPUs).
- Derivatives, learning rates and vanishing gradientsCalculus · AI and ML Foundations
PyTorch 2.14.1 on the lab machine's CPU, float64 for the derivative checks and float32 elsewhere.
- Simulation as a statistics teacherProbability and Statistics · AI and ML Foundations
NumPy 2.5 and SciPy 1.18 on the lab machine; every result below comes from repeating a random experiment thousands of times, which is the most reliable way to check a statistical claim you're unsure of.
- Cross-validated comparisons on real tabular dataClassical Machine Learning · AI and ML Foundations
scikit-learn 1.9.1 and XGBoost 3.4.1 on the lab machine, using the Wisconsin breast-cancer dataset (569 × 30, binary) and the diabetes dataset (442 × 10, regression), both bundled with scikit-learn so
- Metrics, thresholds, calibration and leakageML Evaluation · AI and ML Foundations
scikit-learn 1.9.1 on the lab machine.
- Label noise, skew, validation and near-duplicatesData Engineering for AI · AI and ML Foundations
pandas 3.0 and scikit-learn 1.9 on the lab machine.
- An MLP from scratch in NumPyDeep Learning · AI and ML Foundations
NumPy 2.5 on the lab machine; full-batch gradient descent, He initialisation (N(0, 2/fan_in)), ReLU hidden units, softmax + cross-entropy output.
- Training loops, optimisers and modes in PyTorchPyTorch · AI and ML Foundations
PyTorch 2.14.1 (CPU, 2 threads) on the lab machine.
- Inductive bias under translationNeural Architectures · AI and ML Foundations
PyTorch 2.14.1 on the lab machine's CPU.
- Attention, from scratchTransformers · AI and ML Foundations
PyTorch 2.14.1 on the lab machine's CPU, float32.
- Training BPE tokenizers on this textbookTokenization · AI and ML Foundations
Hugging Face tokenizers 0.23.3 on the lab machine.
- Training a tiny GPT on a laptop CPULarge Language Models · AI and ML Foundations
PyTorch 2.14.1 on the lab machine (2 CPU threads).
- Samplers implemented and comparedLLM Decoding · AI and ML Foundations
The chapter 156 model (2.2 M parameters, validation loss 4.227) on the lab machine's CPU.
- Scaling, fine-tuning and LoRA on a tiny GPTThe Foundation-Model Lifecycle · AI and ML Foundations
PyTorch 2.14.1 on the lab machine (2 CPU threads), chapter 156's gpt.py and 2,048-token tokenizer.
Applied AI Systems 22 labs
- Embeddings for this textbook, measuredEmbeddings · Applied AI Systems
Setup. scikit-learn 1.9.1 and rank_bm25 on the lab machine (2 vCPUs).
- Recall, latency and memory of real ANN indexesVector Databases · Applied AI Systems
Setup. faiss-cpu 1.15.1 and hnswlib on the lab machine (2 vCPUs).
- Chunking, evidence and access control on a real corpusRetrieval-Augmented Generation · Applied AI Systems
Setup. rank_bm25 on the lab machine; the corpus is the main chapter text of Volumes 1–14 (159 chapters, about 900,000 words including code); the 879 glossary entries from the revision sheets are the q
- Evaluating retrieval honestlyRAG Evaluation · Applied AI Systems
Setup. The corpus and golden set from chapters 159 and 161: 4,251 heading-aware chunks of Volumes 1–14 and 879 glossary definitions as questions, each labelled with the chapter it belongs to.
- Supervised fine-tuning a tiny GPTFine-Tuning · Applied AI Systems
Setup. PyTorch 2.14.1 on 2 CPU threads; the 2.2 M-parameter GPT trained in chapter 156 (general validation loss 4.227).
- DPO on a tiny GPT, and how it games the objectivePreference Optimisation and Alignment · Applied AI Systems
Setup. PyTorch on 2 CPU threads.
- Quantising a tiny GPT's weightsQuantization · Applied AI Systems
Setup. PyTorch on 2 CPU threads; chapter 156's GPT (2,197,632 parameters, 2,162,688 of them in weight matrices).
- KV cache, prefill, decode and batching on a tiny GPTLLM Inference · Applied AI Systems
Setup. PyTorch on 2 CPU threads; chapter 156's GPT (4 layers, d = 192, 6 heads, 128-token context) with a hand-written KV-cache forward pass using the same weights.
- Constrained decoding with a tiny GPTStructured Outputs · Applied AI Systems
Setup. Chapter 156's 2 M-parameter GPT (trained on prose, never on this JSON format), its 2,048-token byte-level BPE tokenizer, PyTorch on 2 CPU threads, and Pydantic 2.13 for validation.
- A defended tool harnessTool Calling · Applied AI Systems
Setup. Python with jsonschema (Draft 2020-12) and SQLite; a refund_order tool over an orders table (A100 ₹900 and A101 ₹450 belong to cust-1, B200 ₹1,200 to cust-2); the conversation's user is cust-1.
- The arithmetic of agent reliabilityAgents · Applied AI Systems
Substitute, stated plainly: this lab is a simulation.
- Memory strategies under a context budgetAgent Memory · Applied AI Systems
Setup. A deterministic, model-free experiment in Python with rank_bm25.
- Crashing a workflow 200 timesAgent Orchestration · Applied AI Systems
Setup. A ~40-line workflow engine (wf.py) with three steps: plan (stands in for a model call), charge (inserts a refund charge) and email (inserts a sent email), with state in SQLite.
- A real MCP server and a careful clientTool and Context Protocols · Applied AI Systems
Setup. The official MCP Python SDK, version 2.3.0 (MCPServer server class, Client with StdioServerParameters), Python 3.13, on the lab machine.
- A tiny CLIP and the arithmetic of modalitiesMultimodal AI · Applied AI Systems
Setup. PyTorch on 2 CPU threads; scikit-learn's 1,797 handwritten digits (8 × 8 greyscale), 1,400 for training and 397 held out.
- A diffusion model you can train in 20 secondsGenerative Media · Applied AI Systems
Setup. PyTorch on 2 CPU threads; scikit-learn's 1,797 handwritten digits (8 × 8, scaled to [−1, 1]).
- How an eval lies, and how to catch itAI Evaluation · Applied AI Systems
Setup. PyTorch on 2 CPU threads.
- Three defences, measured honestlyAI Security · Applied AI Systems
Setup. Plain Python on the lab machine.
- Tracing a small AI pipeline with OpenTelemetryAI Observability · Applied AI Systems
Setup. OpenTelemetry Python SDK 1.45.1 with an in-memory span exporter (no tracing backend is installed on the lab machine; an OTLP exporter to Jaeger, Tempo, Langfuse, Phoenix or a vendor would receive the same spans).
- A model release with MLflowAI MLOps · Applied AI Systems
Setup. MLflow 3.17.2 with a SQLite tracking store and model registry, scikit-learn 1.9.1, on the lab machine.
- A streaming model server, naive and batchedAI Serving and Infrastructure · Applied AI Systems
Setup. FastAPI 0.162 with sse-starlette under uvicorn 0.54 (one process), chapter 156's tiny GPT with a KV cache, PyTorch on 2 CPU threads, on the lab machine.
- Caching and cost, measuredAI Production Architecture · Applied AI Systems
Setup. Python and scikit-learn on the lab machine.
Product Engineering 7 labs
- How fragile is a prioritised backlog?Product Fundamentals · Product Engineering
Setup. NumPy on the lab machine.
- The statistics behind discovery methodsProduct Discovery · Product Engineering
Setup. NumPy and SciPy on the lab machine.
- Product metrics in SQLProduct Metrics · Product Engineering
Setup. PostgreSQL 16 on the lab machine.
- Auditing a form, automatically and by keyboardUX Fundamentals · Product Engineering
Setup. Chromium via Playwright (pre-installed) and axe-core 4.10.2 on the lab machine.
- Measuring ambiguity and finding gapsRequirements Engineering · Product Engineering
Setup. Python 3.13 and Hypothesis with pytest on the lab machine.
- Three trade-offs, measuredTechnical Trade-offs · Product Engineering
Setup. Python 3.13 with psycopg 3.3 and redis-py 8.1, PostgreSQL 16 (fsync on, fdatasync, ext4 on the lab VM's virtual disk) and Redis on the lab machine.
- Checking case 1's numbersCase Studies: Product Engineering End to End · Product Engineering
Setup. PostgreSQL 16 with the synthetic TiffinBox dataset from chapter 183's lab, and SciPy.
Production Deployment 8 labs
- A walking skeleton and its gatesThe Application Lifecycle · Production Deployment
Setup. Python 3.13 on the lab machine; a FastAPI app with one rule (can_skip: a delivery can be skipped until 20:00 the evening before) and a POST /skip endpoint; four pytest tests (19:59 allowed, 20:
- Measuring the request pathReference Production Architecture · Production Deployment
Setup. On the lab machine: nginx 1.24 as the reverse proxy (plain HTTP on one port, HTTPS with a self-signed 2048-bit RSA certificate on another, keepalive to the upstream), a FastAPI app under uvicor
- Capacity and evidence for a readiness reviewProduction Readiness · Production Deployment
Setup. The FastAPI menu service from chapter 188's lab (one uvicorn process, a 4-connection psycopg pool, a PostgreSQL aggregate per request) on the lab machine; k6 1.3 with the constant-arrival-rate
- Artefacts, configuration and secrets across environmentsEnvironment Strategy · Production Deployment
Setup. On the lab machine: pip/setuptools wheel builds, GNU tar, Pydantic 2.13 for configuration validation, git, and gitleaks 8.21.2 (downloaded from its GitHub release).
- Locks, rewrites and backfills on PostgreSQLDatabase Deployment Safety · Production Deployment
Setup. PostgreSQL 16 on the lab machine; a subs table with 2,000,000 rows (158 MB); Python with psycopg 3 driving background traffic from 4 connections (one query every ~10 ms each) while each change runs.
- Three rolling deploys under loadZero-Downtime Deployment · Production Deployment
Setup. HAProxy 2.8 in front of two uvicorn/FastAPI instances on the lab machine.
- An accidental DELETE and two ways backDisaster Recovery · Production Deployment
Setup. A separate PostgreSQL 16 cluster on the lab machine with wal_level=replica, archive_mode=on and an archive_command copying each completed WAL segment to an archive directory (standing in for ob
- Making injections A and D impossibleCase Study — Launch Week Game Day · Production Deployment
Setup. PostgreSQL 16 and Python on the lab machine.
Specialization Depth 11 labs
- Measuring how well you can measure yourselfThe Mastery Ladder: What Depth Means and How to Measure It · Specialization Depth
Setup. NumPy and SciPy on the lab machine, plus a count of the quiz questions in this textbook's published volumes.
- Virtual threads, pinning and garbage collectors on the JVMJava and Spring at L5/L6 · Specialization Depth
Setup. OpenJDK 21.0.12 on the lab machine (2 CPUs, so 2 virtual-thread carriers), single-file Java programs.
- The connection-count curveSQL, PostgreSQL and Concurrency at L5/L6 · Specialization Depth
Setup. PostgreSQL 16 and pgbench on the lab machine (2 CPUs); pgbench -i -s 10 (1 million pgbench_accounts rows, about 150 MB, fully cached); 8-second runs with -j 2 client threads.
- Raft in practice with etcdNetworking, Distributed Systems and System Design at L5/L6 · Specialization Depth
Setup. etcd 3.6.5 on the lab machine, clusters of 1, 3 and 5 members, each on its own loopback address (127.0.0.1–5) with fresh data directories and default timeouts (heartbeat 100 ms, election 1,000 ms).
- Cgroups, quotas and the throttling trapDocker, Kubernetes, Cloud and CI/CD at L5/L6 · Specialization Depth
Setup. The lab machine's Linux kernel with the cgroup v1 cpu controller; a cgroup with a 100 ms CFS period and quotas set by writing cpu.cfs_quota_us (−1 = unlimited, 100000 = 1 CPU, 50000 = 0.5 CPU,
- The costs you can't see on a dashboardSecurity, Observability and AI Integration at L5/L6 · Specialization Depth
Setup. Python 3.13 on the lab machine with prometheus_client and tracemalloc (Experiment 1), and hmac with time.perf_counter_ns (Experiment 2).
- Search three ways in PostgreSQLBreadth at L3/L4: Frontend, Angular, React, Search, NoSQL, GPU/ML · Specialization Depth
Setup. PostgreSQL 16 on the lab machine; a docs table of 106,920 passages (the 5,346 chunks of this textbook's Volumes 1–14 from Volume 14b's lab, repeated 20 times), 105 MB.
- The rendering pipeline and the event loop, measuredFrontend Depth I: HTML, CSS, JavaScript, TypeScript, the Browser and Accessibility · Specialization Depth
Setup. Chromium (Playwright's pre-installed build, headless) on the lab machine; a page with a "Skip" button and 2,000 div rows.
- Loading and layout stability, measuredFrontend Depth II: React, Performance, Security, Testing, Architecture, Deployment · Specialization Depth
Setup. A small Python HTTP server on the lab machine serving one menu page four ways, a script that takes 0.8 s to respond, and a real 600 × 300 PNG that takes 0.5 s; Chromium (headless, Playwright) l
- Python concurrency for AI workloadsAI Depth I: Python, ML Fundamentals, LLM Application Architecture, RAG, Evaluation · Specialization Depth
Setup. CPython 3.13.17 (standard build, GIL enabled) on the lab machine (2 CPUs), NumPy with BLAS threading pinned to 1 thread per call (OMP_NUM_THREADS=1, OPENBLAS_NUM_THREADS=1) so parallelism comes
- Fair, correct rate limiting for a shared modelAI Depth II: Security, Inference, Agents, Observability, Deployment · Specialization Depth
Setup. Redis 7 on the lab machine and Python with redis-py (Experiment 1, real); a discrete-event simulation of a shared model backend with a capacity of 20 requests per second (Experiment 2), with Po
Learning Sequence 14 labs
- An HTTP server in C, and why it behaves as it doesPhase 1 — CS Foundations · Learning Sequence
Setup. gcc with -O2 on the lab machine (2 CPUs); a 40-line C server (socket, bind, listen, accept, recv, send; HTTP/1.1 keep-alive; TCP_NODELAY) in two modes: iterative (serve one connection until it
- One API, three executorsPhase 2 — Java and Backend Foundation · Learning Sequence
Setup. OpenJDK 21 on the lab machine (2 CPUs); a single-file service on the JDK's com.sun.net.httpserver.HttpServer with a /skips resource: GET returns a count, POST validates a body of the form {"day
- The data-integrity bugs every business app must preventPhase 3 — Spring Production Backend · Learning Sequence
Setup. PostgreSQL 16 on the lab machine, driven from Python with psycopg 3.
- Four slow queries on 2 million rowsPhase 4 — Data · Learning Sequence
Setup. PostgreSQL 16 on the lab machine; c200 with 50,000 customers and o200 with 2,000,000 orders (random customer, a timestamp within the last year, amount, status), analysed.
- How a dashboard should fetch its dataPhase 5 — Frontend · Learning Sequence
Setup. A FastAPI backend on the lab machine with four endpoints (/api/orders, /api/skips, /api/revenue, /api/kitchens), each taking 150 ms, and an aggregated /api/dashboard that calls all four concurr
- A container's walls, built by handPhase 6 — Infrastructure · Learning Sequence
Setup. The lab machine's Linux kernel; unshare from util-linux for namespaces; the cgroup v1 memory controller for a limit; Python for the workloads.
- What infrastructure-as-code state knowsPhase 7 — Cloud and DevOps · Learning Sequence
Setup. OpenTofu 1.13.2 on the lab machine.
- Dual writes vs the outbox, under crashesPhase 8 — Distributed Systems · Learning Sequence
Setup. PostgreSQL 16 and Redis Streams (standing in for a message broker) on the lab machine.
- Threshold alerts vs burn-rate alertsPhase 9 — Observability and SRE · Learning Sequence
Setup. A simulation in NumPy (no real service is needed to compare alert rules, and simulation lets the incidents be identical for every rule): 30 days × 1,440 minutes, 200 requests per minute, backgr
- Audit, harden, audit againPhase 10 — Security · Learning Sequence
Setup. A deliberately small FastAPI app on the lab machine: two users (priya, arun), two orders held in memory, POST /login returning a bearer token, GET /orders/{id}, and an endpoint that throws an error.
- Checking back-of-the-envelope estimatesPhase 11 — System Design · Learning Sequence
Setup. Python with NumPy for the collision and cache simulations, and redis-benchmark against a local Redis 7 on the lab machine.
- The three projects on one taskPhase 12 — AI Foundation · Learning Sequence
Setup. scikit-learn's handwritten digits (1,797 images of 8 × 8 pixels, scaled to 0–1), split 70/30 with stratification: 1,257 training images and 540 test images, the same for every model.
- Retrieval depth, context cost and tool routingPhase 13 — AI Application Engineering · Learning Sequence
Setup. The retrieval set from Volume 14B's embeddings lab: the main chapters of Volumes 1–14 split into 5,346 chunks of about 200 words, and 879 glossary definitions from the revision sheets used as q
- Routing between a cheap path and a large modelPhase 14 — AI Production · Learning Sequence
Setup. The 879 queries and 5,346 chunks from the Phase 13 lab.
Capstone 11 labs
- Where a request's time goesThe System, Its Boundaries and the Build Order · Capstone
Setup. One lab machine with 2 CPUs.
- Getting live updates to the browserThe Frontend Layer · Capstone
Setup. An aiohttp server on the lab machine with an in-memory event log.
- A hung dependency in JavaThe Backend Layer · Capstone
Setup. OpenJDK 21 on the lab machine (2 CPUs).
- Searching dishes, and signed linksThe Data Layer · Capstone
Setup. PostgreSQL 16 on the lab machine.
- Replay, schema change and a poison eventThe Event Layer · Capstone
Setup. Redis 7 Streams on the lab machine, standing in for a Kafka topic: an append-only log with IDs, read sequentially from any position.
- Validation, retries and evaluation sizeThe AI Layer · Capstone
Setup. NumPy simulations on the lab machine.
- A CDN in front of the origin, and the price of a handshakeThe Platform Layer · Capstone
Setup. nginx on the lab machine (2 CPUs), in three roles:
- Catching a bad canary, and a tamper-evident audit logThe Operations Layer: Observability and Security · Capstone
Setup. Python on the lab machine.
- Breaking dependencies and resourcesFailure Exercises I: Dependencies, Resources and Capacity · Capstone
Setup. The slice of TiffinBox from chapter 211A's lab on one 2-CPU machine: nginx → a FastAPI app (uvicorn, 2 workers, httptools) → PostgreSQL 16 (1 M orders) and Redis 7.
- Duplicates, deployments, certificates and AI failuresFailure Exercises II: Duplicates, Deployments, Credentials and AI · Capstone
Setup. PostgreSQL 16, nginx, Python and OpenSSL on the lab machine.
- Six real failure drillsFailure Exercises II: Duplicates, Deployments, Credentials and AI · Capstone
Setup. On the lab machine: PostgreSQL 16, Redis 7, nginx 1.24 and a small FastAPI order service (GET /menu cached in Redis for 5 s, POST /orders with a deliberately slow 300 ms payment step) in two ve
Revision and Mastery 5 labs
- The memory hierarchy, and the cost of a unit of concurrencyConcepts to Revisit Forever I: Computer Science and Java · Revision and Mastery
Setup. The lab machine: an Intel Xeon at 2.3 GHz with 2 vCPUs (a cloud VM; its reported cache sizes are those of the host), gcc -O2, OpenJDK 21.
- Lost updates and write skew in PostgreSQLConcepts to Revisit Forever II: Backend, Data and Distributed Systems · Revision and Mastery
Setup. PostgreSQL 16 on the lab machine, driven by Python (psycopg 3) with one connection per thread.
- The event loop, attention by hand, and availability arithmeticConcepts to Revisit Forever III: Infrastructure, System Design, Frontend and AI · Revision and Mastery
Setup. Node.js 22, NumPy and PyTorch on the lab machine.
- Measuring churn from the registriesTechnology Churn Policy: Memorise, Understand, Track · Revision and Mastery
Setup. A Python script on the lab machine queried the public npm registry (registry.npmjs.org/<package>) and the PyPI JSON API (pypi.org/pypi/<package>/json) on 5 November 2026, and computed for each
- One request through every layer, timedThe Final Operating Model · Revision and Mastery
Setup. On the lab machine (2 CPUs):
Data Engineering for Analytics 9 labs
- The same data in a row store and a column storeHow Analytical Databases Work · Data Engineering for Analytics
Setup. The lab machine (2 CPUs).
- History rewritten, revenue doubledModelling Data for Analysis · Data Engineering for Analytics
Setup. DuckDB on the lab machine.
- Join strategies and a hot key in SparkBatch Processing and Spark · Data Engineering for Analytics
Setup. Apache Spark 4 (PySpark) in local mode on the lab machine: local[2] (one JVM, 2 cores), 2 GB driver memory, 8 shuffle partitions, UI off.
- A dbt project that stops bad dataTransformations as Code: ELT and dbt · Data Engineering for Analytics
Setup. dbt Core 1.12 with the dbt-duckdb adapter on the lab machine (the CLI also noted that a newer major version of dbt is available; the concepts here carry over).
- A backfill with flaky workersOrchestration and Backfills · Data Engineering for Analytics
Setup. DuckDB on the lab machine; chapter 01's 5 million orders as the source.
- Event time, watermarks and an outageStream Processing · Data Engineering for Analytics
Setup. A small event-time windowing engine written in Python on the lab machine (no external streaming system: the logic is the point, and it's the same logic Flink or Kafka Streams apply).
- Pruning, small files and a rollbackLakehouses and File Formats · Data Engineering for Analytics
Setup. DuckDB and PyArrow on the lab machine; chapter 01's 5 million orders.
- Five silent failures in 60 days of loadsData Quality, Contracts and Observability · Data Engineering for Analytics
Setup. A Python simulation on the lab machine of 60 daily order loads with realistic variation: about 13,700 orders a day, a ±12% weekly pattern, random noise (σ = 300 rows), a tiny background null ra
- Bytes scanned, masked views and a reversible pseudonymGovernance, Privacy and Cost · Data Engineering for Analytics
Setup. DuckDB and PyArrow on the lab machine; chapter 01's 5 million orders (one year), as one unpartitioned zstd Parquet file and as a copy partitioned by month (12 files).
Mobile Engineering 9 labs
- The frame budgetPlatforms, Lifecycle and the Main Thread · Mobile Engineering
Setup. Node.js 22 on the lab machine, standing in for an app's UI runtime (a single event loop, like a UI thread) with worker_threads standing in for background threads.
- Identity and stable inputs in a declarative runtimeNative UI and App Architecture: Android and iOS · Mobile Engineering
Setup. A small declarative UI runtime in Python on the lab machine, written to mimic the decision Compose and SwiftUI make: for each item, if an item with the same identity existed last render and all
- Crossing the boundaryCross-Platform Frameworks · Mobile Engineering
Setup. Node.js 22 on the lab machine, as an analogy for a cross-platform runtime talking to native code (the mechanism, not React Native itself).
- One screen over three networksNetworking on Mobile Networks · Mobile Engineering
Setup. On the lab machine: an aiohttp API serving 20 orders (each with kitchen, dish, status, ETA, amount, timestamp) either one per request (/orders/{i}) or all at once (/orders), and a user-space "m
- Two devices, one planOffline-First and Sync · Mobile Engineering
Setup. A Python simulation on the lab machine.
- What an image costs in memoryPerformance and Memory · Mobile Engineering
Setup. Python with Pillow and NumPy on the lab machine.
- An hour of radio timeBackground Work, Push and Battery · Mobile Engineering
Setup. A Python model on the lab machine of a cellular radio, using assumed values typical of published LTE measurements (real values vary by device, network and generation):
- An interceptor, a pinned key and a leaked secretMobile Security · Mobile Engineering
Setup. Python on the lab machine with the cryptography library and the standard ssl module.
- A bad build in a staged rolloutTesting, Release and Observability · Mobile Engineering
Setup. A NumPy simulation on the lab machine.
Internationalisation 7 labs
- One string, four lengthsUnicode and Text · Internationalisation
Setup. Python 3.13 on the lab machine with Unicode 15.1 data (unicodedata) and the regex module (2026.9.29), whose \X matches one extended grapheme cluster.
- One table, many ordersComparing, Sorting and Searching Text · Internationalisation
Setup. PostgreSQL 16.15 on the lab machine, built with ICU, holding a one-column table of 18 names: dish and place names in English, German, French and Turkish, plus 10 idlis and 2 dosas.
- A cut-off, a gap, an overlap and a reportTime, Dates and Time Zones · Internationalisation
Setup. Python 3.13 with zoneinfo reading the system's IANA tz database, and PostgreSQL 16.15.
- Formatting and exact moneyLocales: Numbers, Currencies, Plurals and Money · Internationalisation
Setup. Two scripts on the lab machine.
- One label, six languagesTranslating the Interface · Internationalisation
Setup. Chromium (headless, via Playwright 1.x on Node.js 22) renders the "Skip tomorrow's lunch" label in English, German, Hindi, Tamil, Telugu and an automatically generated pseudo-locale, each three
- Mirroring and reorderingRight-to-Left and Bidirectional Text · Internationalisation
Setup. Two parts. Layout: Chromium (headless, Playwright, Node.js 22) renders a header row (a title and a "more" icon in a flex container) four ways: physical margin-left: auto and logical margin-inli
- Phones, look-alike domains and byte limitsInternationalised Data and Infrastructure · Internationalisation
Setup. Python 3.13 on the lab machine with phonenumbers (the Python port of Google's libphonenumber), the standard library's IDNA codec, and unicodedata to find each character's script from its name;
Senior Engineering Craft 7 labs
- Checking a design docDesign Docs and RFCs · Senior Engineering Craft
Setup. A 30-line Python checker (lint.py) reads Markdown design docs and reports: word count; which of eight standard sections (context, goals, non-goals, proposal, alternatives, risks, rollout, open
- The shape of 643 merged pull requestsCode Review · Senior Engineering Craft
Setup. A full clone of the Flask repository (github.com/pallets/flask, 5,566 commits at the time of the lab) and a Python script using only git.
- Simulating a planEstimation and Planning · Senior Engineering Craft
Setup. Two Python 3.13 scripts using only the standard library, with a fixed random seed.
- How fragile is the winner?Making Technical Decisions · Senior Engineering Craft
Setup. A Python 3.13 script (standard library only, fixed seed) computes weighted scores for three options against four criteria, using the weights and 1–5 scores from the start of the chapter, which
- Who knows the code?Mentoring and Growing Engineers · Senior Engineering Craft
Setup. The Flask clone from chapter 02's lab (HEAD at 30 October 2026) and a Python script calling git blame --line-porcelain -w HEAD on each of the 24 .py files in src/flask.
- Measuring two versions of one messageCommunication and Influence · Senior Engineering Craft
Setup. A Python 3.13 script measures the two versions of the CDC update from the start of the chapter (both written for this lab): word and sentence counts; average words per sentence; the Flesch read
- Work in progress and flowLeading Technical Work · Senior Engineering Craft
Setup. A Python 3.13 simulation (standard library, fixed seed) of a four-engineer team over 400 working days.