Debugging production
When production breaks, first stop the harm, then find the cause with data, one hypothesis at a time.
Updated since you finished it. We changed this lesson after you marked it done. Your progress is kept.
What broke
On 18 November 2025 at 11:05 UTC, Cloudflare changed the access rights on one of its databases. From 11:20, its network began to fail to deliver core traffic. Many websites behind Cloudflare showed error pages. 1
An automated test caught the problem at 11:31. At 11:35 the team opened an incident call. 1
The team first thought it was a huge DDoS attack. Two things pointed that way. Cloudflare had recently fought a wave of very large attacks. And its status page, which runs outside Cloudflare, went down at the same time. That was a coincidence, but it made some people think an attacker was hitting both. 1
The errors were strange, too. The network failed, recovered, then failed again. The real cause was a file of bot features that was rebuilt every five minutes. The database cluster was being updated step by step, so each run could make a good file or a bad one. 1
The bad file came from the database change. A query started to return duplicate rows, so the file doubled in size. The proxy had a limit of 200 features and normally used about 60. The bigger file went over the limit, and the proxy failed. 1
At 14:24 the team stopped making new files, and a test with an older file worked. By 14:30 core traffic was mostly flowing again. Every service was back at 17:06. 1 Note what misled them: a coincidence, and a symptom that came and went.
It happens for real
Cloudflare · 18 Nov 2025Cloudflare outage: a feature file grew too bigFor several hours, many sites behind Cloudflare showed 5xx error pages, and dashboard logins and Access sign-ins also failed. Roblox · 28 Oct 2021Roblox outage: 73 hours down after Consul brokeRoblox was fully down for most of 73 hours, and players came back in steps only on the fourth day. All incidents tagged “config”The idea in simple words
In production, real users are hurting while you debug. So you have two goals, in this order:
- Stop the harm. This is called mitigation.
- Find the cause. Then fix it so it does not come back.
Google's SRE book says that in a big outage, you may want to start hunting for the root cause at once. Its advice: "Ignore that instinct!" Instead, make the system work as well as it can for now. 2
After that, use a loop. Look at the data. Make one guess, called a hypothesis. Test it. If the test says no, make the next guess. The book calls this the hypothetico-deductive method. 2
The key idea. Mitigate first, debug second. Then let data, not the loudest opinion, choose between hypotheses, and test them one at a time.
How it works
Step through one incident from the alert to the postmortem.
- An SLO alert pages you. The error rate on checkout has jumped from 0.2% to 6%. Users are failing to pay right now.
- Do not hunt for the cause yet. First make users safe: roll back the last deploy, turn off a feature flag, or shed load. Keep some logs and one bad host for later.
- Ask what changed just before the errors started. Look at deploys, config and flags, traffic, and the services you depend on.
- Pick the most likely explanation and write it down as one hypothesis. A good hypothesis says what you should see if it is true.
- Test it. Split the errors by version, region, tenant or time. If the data says no, go back and try the next hypothesis. A clear no is useful too.
- The data agrees, and you can explain the whole story. Often it is not one cause but several conditions that met at the same time.
- Write a blameless postmortem. Each action, like a validation check or a kill switch, gets an owner and a date, so the same failure is less likely to come back.
1. Stop the bleeding
The fastest safe action is usually one of these:
- Roll back the last deploy or config change. In one Google emergency, an engineer pushed another config change to roll back the first one, and services began to recover. 3
- Turn off a feature flag for the new code path.
- Shed load or move traffic. The SRE book gives examples: send traffic away from a broken cluster, or turn off subsystems to reduce load. 2
Fast action can still save evidence, such as logs. 2 Take a minute to save logs, a heap dump, or one bad host out of traffic. If you feel overwhelmed, pull in more people. 3
2. Ask "what changed?"
A system tends to keep running until something acts on it, such as a config change or a new kind of load. So start with recent changes. 2 Check four kinds:
- Deploys: code, images, OS updates.
- Config: settings, feature flags, firewall rules, generated data files.
- Traffic: a spike, a new customer, a bot, a new client version.
- Dependencies: databases, caches, cloud services, other teams' APIs.
In the Cloudflare story, the change was in a database, not in the proxy that failed. 1 So look beyond your own service.
3. Read the right signals
The observability lesson covers metrics, logs and traces. Two short checklists tell you where to look first.
The RED method is for services. For each one, check rate (requests per second), errors (how many fail) and duration (how long they take). 7
The USE method is for resources like CPU, memory, disks and network. For every resource, check utilization, saturation and errors. 6 Saturation means extra work the resource cannot handle yet, often waiting in a queue. 6
Tom Wilkie, who created RED, says RED cares about how happy your users are, and USE about how happy your machines are. 7 Start with RED to find the service that hurts, then use USE on its machines.
4. Test one hypothesis at a time
Write each hypothesis down, for example: "The new connection pool is too small." Say what data would prove it wrong.
Test the most likely idea first, and think about risk to the system: "when you hear hoofbeats, think of horses not zebras." 2
Take notes on each idea, each test and each result. Do not ignore a clear "no": negative results are useful too. 2
5. Narrow it down
Split the problem in two, again and again. The SRE book calls this divide and conquer, or bisection. 2 You can split by:
- Time: what happened in the minute before the first error?
- Region or zone: is one region bad and the others fine?
- Version: do errors come only from hosts on the new build?
- Tenant: is it one customer, one card type, one app version?
Each good split roughly halves the search.
6. Follow one request
Metrics tell you that something is wrong. A trace and its logs show what happened to one request. When service A calls service B, A sends a trace ID and a span ID with the call, in the W3C traceparent header. 8 OpenTelemetry can add these IDs to your log records. 9 The trace ID then works as a correlation ID: search for it and see that request's logs in every service.
Safe experiments in production
Sometimes you must test in production. Change one thing, on one host or a canary, and know how to undo it. Such tests can also change the results of the next test. 2
Common traps
The SRE book lists traps that send teams the wrong way. 2
- Wrong symptoms: looking at metrics that do not matter, or misreading what a metric means.
- Old causes: "it happened once, so it must be happening again."
- Coincidences: two things that move together by chance.
Add two more. Confirmation bias means you see only the data that fits your first idea. Chasing the loudest symptom means you fix the error that fills the logs, not the one that came first.
The worst trap is many people changing things at once. Google tells of an engineer whose change, made without telling anyone, made an outage worse. Its rule: only the operations team changes the system during an incident. 4
Incident roles
Google uses clear roles. 4
- The incident commander holds the overall picture and gives out the work.
- Operations makes the changes.
- Communication sends regular updates to people outside the call.
- Planning handles longer jobs, like filing bugs and handing over to the next shift.
PagerDuty adds: "the Incident Commander is NOT a resolver." 10 The commander leads; experts fix.
The blameless postmortem
A postmortem is a written record of an incident: its impact, the actions taken, the root causes and the follow-up steps. 5 A blameless postmortem looks for the contributing causes "without indicting any individual or team." 5 As Google puts it, you cannot fix people, but you can fix systems and processes. 5
Blame makes engineers stay silent, and silence makes incidents longer. 11 So ask "what" and "how", not "who" or "why". 11
Cloudflare's follow-up list is a good example: check its own generated config files like user input, and add more global kill switches. 1
Trade-offs
| Option | Speed | Risk | Use it when |
|---|---|---|---|
| Roll back | Yes Minutes, if automated. | Low, unless data or schema changed too. | A change lines up with the start of the errors. |
| Roll forward (ship a fix) | No Write, review, deploy. | Medium. A rushed fix can add a bug. | Rollback is impossible, like after a one-way migration. |
| Turn off a feature flag | Yes Seconds. | Low, if the "off" path was tested. | The new code is behind a flag. |
| Shed load or move traffic | Yes Minutes. | Medium. Some users fail on purpose. | Overload, or one region is broken. |
| Wait and investigate | No Users keep failing. | High for users. | Impact is small and stable, and quick actions could make it worse. |
Simple rule: if a change lines up with the start of the errors, undo it first and ask questions later.
At work: how a senior uses this
- Ask in the first five minutes: "Are users hurting? What changed in the last hour? How fast can we undo it?"
- Make rollback and flag-off a single, tested command. Practise it on a quiet day.
- Keep one timeline in the incident channel: each change, hypothesis and test, with the time.
- Say hypotheses as "I think X, because Y. If I am right, we will see Z." When a theory fits too well, look for data that would break it.
- Write the postmortem within a few days. Name systems and gaps, not people. Give every action item an owner and a date.
With AI
What to ask the agent
"Here are 2,000 log lines from the checkout service between 14:00 and 14:20. Group the errors by type. For each group, give the count, the first time it appeared and three example trace IDs."
"Here is our deploy log and config history for the last 24 hours. List every change that happened in the 30 minutes before 14:05."
"Draft a blameless postmortem from this incident channel export. Use 'the on-call engineer', not names. Mark every claim you could not find in the export."
What to check yourself
- Every cause the AI gives is only a hypothesis. It can sound sure and still be wrong. Ask for the exact log lines, then open them yourself.
- The counts and times match your dashboards. Summaries can drop or merge errors.
- The AI saw the whole time window, not just the part that fit in its context.
- No secrets or personal data went into the prompt.
- You still do the reasoning. In Anthropic's January 2026 trial, 52 mostly junior engineers learned a new Python library, Trio. One group had an AI assistant. The AI group scored 50% on the quiz and the hand-coding group 67%. The biggest gap was on debugging questions. 12 People who asked for explanations and conceptual answers learned more. 12 The study was small and tested learning only shortly after the task. 12
Check yourself
Your progress is saved only in this browser. Export it to keep it safe.
You have finished 5 lessons. Your progress lives only in this browser. Export a copy so you don’t lose it.
Go deeper
Show 12 sources and related lessons
- Cloudflare, “Cloudflare outage on November 18, 2025” (official postmortem) (opens in a new tab)
The full timeline, the wrong first theory of a DDoS attack, and why the errors came and went. - Chris Jones, “Effective Troubleshooting”, Google, Site Reliability Engineering, chapter 12 (opens in a new tab)
The troubleshooting loop, "stop the bleeding" first, recent changes, bisection and the common traps. - Corey Adam Baye, “Emergency Response”, Google, Site Reliability Engineering, chapter 13 (opens in a new tab)
Real Google emergencies, including a config change that was fixed by rolling it back. - Andrew Stribblehill, “Managing Incidents”, Google, Site Reliability Engineering, chapter 14 (opens in a new tab)
Incident roles, the danger of people changing things on their own, and when to declare an incident. - John Lunney and Sue Lueder, “Postmortem Culture: Learning from Failure”, Google, Site Reliability Engineering, chapter 15 (opens in a new tab)
What a blameless postmortem is, when to write one, and how to make action items stick. - Brendan Gregg, “The USE Method” (opens in a new tab)
A checklist for resources such as CPU, memory, disks and network. - Grafana Labs, “The RED Method: How to instrument your services” (Tom Wilkie's method) (opens in a new tab)
Rate, errors and duration for every service, and how RED differs from USE. - OpenTelemetry documentation: Context propagation (opens in a new tab)
How a trace ID moves from one service to the next in the traceparent header. - OpenTelemetry documentation: Logs (opens in a new tab)
How log records carry the trace ID and span ID, so logs and traces line up. - PagerDuty Incident Response documentation: Different Roles (opens in a new tab)
What the incident commander, scribe, experts and liaisons each do. - PagerDuty Postmortem documentation: The Blameless Postmortem (opens in a new tab)
Why blame makes incidents longer, and how to ask questions without blame. - Anthropic, “How AI assistance impacts the formation of coding skills” (29 January 2026) (opens in a new tab)
A trial with 52 mostly junior engineers learning the Trio library. The AI group scored lower, most of all on debugging questions.
Real incident: Cloudflare, 18 Nov 2025: Cloudflare outage: a feature file grew too big
Real incident: Roblox, 28 Oct 2021: Roblox outage: 73 hours down after Consul broke
Case studies: Stripe: Canonical log lines: one rich log line per request
Related: Observability, SLOs and error budgets · Safe deploys and config changes · Incident response and postmortems · Distributed tracing in practice · Feature flags and entitlements · Skill atrophy and deliberate practice (coming soon)