Tutorials
Hands-on walkthroughs: build the thing, run it, and check that it works.
Node.js Production Failure Lab
15 partsHow One Report Can Slow Down an Entire Site: Event Loop Blocking in Node.js
Product pages are slow, the database is innocent, and the culprit is a CSV report. A step-by-step walk through Node.js's single-threaded event loop, told through a production incident.
21 min read60 min hands-onbeginner
Why Does the Service Die Every Four Minutes? Memory Leaks and Unbounded Caches in Node.js
The API restarts every few minutes, and the logs contain a single FATAL line. We trace, step by step from heap graphs to heap snapshots, how a marketing campaign turned a cache into a memory leak.
26 min read60 min hands-onbeginner
How One Failed Email Can Take Down an Entire API: Unhandled Promise Rejections in Node.js
The error alert keeps flapping, and customers who see 'Bad Gateway' place their order again. Step by step, from 502 graphs to a stack trace, we trace how the unhandled rejection of a confirmation email sent in the background kills the entire Node.js process.
29 min read45 min hands-onbeginner
Idle CPU, Fast Partner, Slow Checkout: DNS, the libuv Thread Pool and Keep-Alive in Node.js
The tax service answers in 30 ms and the API's CPU is idle, yet placing an order takes two seconds. We trace, step by step, how a new connection per request, dns.lookup and the libuv thread pool build an invisible queue.
28 min read90 min hands-onintermediate
Googlebot Arrived, the Database Fell Over: Finding a Missing Index with pg_stat_statements and EXPLAIN
Postgres CPU is at 100%, every endpoint waits for seconds, and the API itself is idle. We trace, step by step, how an innocent purchase counter on product pages scans 1.2 million rows, how Googlebot turns that into an outage, and how to add the index to a live table without locking it.
25 min read60 min hands-onbeginner
Every Query 0.04 ms, the Page Half a Second: the N+1 Query Pattern and the Cost of a Network Round Trip
The mobile app's new My Orders screen takes half a second; the database is relaxed, the API is idle and every query runs in under 0.1 ms. From the staircase-shaped trace in Jaeger we follow, step by step, the N+1 query pattern, why latency grows linearly with the number of queries, and how the fix brings it down to three fixed queries.
27 min read45 min hands-onbeginner
No Errors, No CPU, No Response: How One Database Connection Leaking on an Error Path Freezes an API
A minute after every restart the API freezes: no errors, no logs, CPU idle, requests simply never get an answer. We walk step by step through the anatomy of a connection pool, a connection that leaks on an error path, the idle in transaction session in pg_stat_activity, and the timeout that turns a silent hang into a visible error.
31 min read75 min hands-onintermediate
Why Checkout Locks Up on Black Friday: Waiting for Payment Inside a Transaction, and Hot Rows
On Black Friday night checkout takes seconds and product pages slow down too, yet neither the API's nor the database's CPU is busy. We follow row lock waits step by step: a transaction that waits on the payment service while holding a lock, why pg_stat_statements counts lock waiting as execution time, and the fix that cuts lock time from half a second to tens of milliseconds.
35 min read90 min hands-onadvanced
How an Optional Service Takes Down Product Pages: Timeout Budgets, Cancellation and Graceful Degradation
In the busiest hour of the week product pages won't load; there are no 5xx at the edge, the API's latency panel looks normal, and the recommendations service's dashboard is green. We follow step by step why requests that never finish don't show up in any histogram, how a few slow requests lock up a fixed number of workers, and how to replace a 30-second timeout with a 250 ms budget that really cancels the request, plus a fallback.
31 min read75 min hands-onintermediate
The App Said "Payment Failed" and the Card Was Charged Four Times: Retries, Idempotency Keys and a Unique Constraint
Customers get four orders, four card authorizations and four confirmation emails for a single purchase, while the app tells them the payment failed. We trace why a timed-out request keeps running on the server, the Idempotency-Key header the API ignores, and the key + unique constraint + 409/Retry-After fix that collapses retries into a single order.
35 min read90 min hands-onintermediate
A Ten-Second Blip, an Outage That Won't End: Retry Storms and Metastable Failure
The tax provider has a ten-second failover and it's over; checkout, however, doesn't come back, and restarts change nothing. We trace step by step how retries multiplied across layers keep a dependency in permanent overload, how abandoned work eats its capacity, and the retry budget + jitter fix that breaks the loop.
32 min read90 min hands-onadvanced
Zero-Downtime Deploys Promised, 150 Errors per Deploy Delivered: The Missing Half of Graceful Shutdown
The API runs as two replicas, deploys replace them one at a time, and the proxy probes each replica's /ready every 2 seconds. Even so, ~150 requests fail with 502 on every deploy. We look step by step at what the code's 'graceful' shutdown skips, how a load balancer finds out that a replica is gone, and the recipe for zero errors in a rolling deploy (announce, drain, close).
29 min read75 min hands-onintermediate
When the Check Meant to Keep the Site Up Takes It Down: Readiness and Correlated Failure
A few times an hour, every page on the site returns 503 for ten seconds, then recovers on its own. The API logs no errors and no instance restarts. The culprit is a readiness check written 'to be more robust': because it asks about a shared dependency, it pulls both instances out of rotation at the same moment. We walk through what belongs in readiness and what doesn't, why you have to measure at the edge, and what fail-open does for you.
26 min read60 min hands-onintermediate
A Queue Doesn't Lose Work, It Makes It Wait: Consumer Lag, Partitions and a Worker That Can't Keep Up
Orders go through fine, but confirmation emails arrive late: first by a few minutes, then by close to an hour. The CPU is idle, the broker is idle, the database is idle. The culprit is a worker that handles messages one at a time and a topic with a single partition. We walk through reading consumer lag, calculating a consumer's capacity as concurrency ÷ latency, and processing concurrently while committing offsets without losing messages.
29 min read90 min hands-onadvanced
How Does a Single Message Stop an Entire Queue? Poison Messages, Unbounded Retries and the Dead-Letter Topic
The worker is running, its CPU is idle, the email provider is up and answering in 100 ms; yet for an hour not a single confirmation email has gone out. The culprit is one order from a customer with a broken address, and a sequential consumer that retries it forever. We walk through recognizing a poison message, why the offset doesn't budge, skipping it by hand with rpk group seek, and parking the message together with its reason in a dead-letter topic. The final part of the series.
33 min read75 min hands-onadvanced