Incident response
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
عن هذا الدرس
When a live service breaks, the team's job is to get users working again fast, then learn from it. Follow one incident end to end: a bad release makes 2.5% of checkout requests fail, an SLO burn-rate alert pages the on-call engineer, she takes command as incident commander, a comms lead keeps everyone told, and the ops lead rolls the release back with kubectl. Then a blameless postmortem turns the timeline into lessons.
When something breaks
An incident is an unplanned problem that hurts users, or soon will. Incident response is how a team gets the service working again fast, then learns from it. Follow one: a bad release of a shop's checkout service.
incident = unplanned, hurts users (or will)
respond detect → page → take command
→ mitigate → recover
learn postmortem → action items
goal: restore service first, learn secondاقرأ الدرس خطوة بخطوة
When something breaks
An incident is an unplanned problem that hurts users, or soon will. Incident response is how a team gets the service working again fast, then learns from it. Follow one: a bad release of a shop's checkout service.
incident = unplanned, hurts users (or will) respond detect → page → take command → mitigate → recover learn postmortem → action items goal: restore service first, learn secondA bad release
At 14:00 version v2 of checkout goes live. It has a bug: 2.5% of requests now fail, up from 0.05%. Nobody on the team has noticed yet. Users just see an error page.
14:00 deploy v1 → v2 traffic 2,000 requests a minute v1 errors 1 a minute = 0.05% v2 errors 50 a minute = 2.5%Error budget and burn rate
The team promises that 99.9% of requests succeed: an SLO (service level objective). The 0.1% left over is the error budget. Burn rate is how fast errors use it up: 2.5% failing ÷ 0.1% allowed = 25 times too fast.
SLO 99.9% succeed error budget 0.1% may fail burn rate = error rate ÷ error budget v1: 0.05% ÷ 0.1% = 0.5 fine (below 1) v2: 2.5% ÷ 0.1% = 25 too fastThe alert fires
Google's SRE workbook suggests paging when the burn rate over the last hour reaches 14.4, which spends 2% of a 30-day budget. The hour's average climbs as bad minutes pile up and crosses 14.4 at 14:35: 14.79.
last hour = 120,000 requests 14:34 34 bad min → 1,726 errors → 14.38 14:35 35 bad min → 1,775 errors → 14.79 ≥ 14.4 >>> burn(1775, 120_000) >= 14.4 True time to detect: 35 minutesPage the on-call
The alert pages the on-call engineer: whoever's turn it is to answer, day or night. A page is an urgent alert that rings their phone. She acknowledges it at 14:38, so everyone knows someone is on it.
14:35 page → on-call engineer 14:38 acknowledged page = urgent, wakes a human ticket = can wait for working hoursDeclare and take command
Users can see the errors, so she declares an incident and becomes incident commander (IC). The IC coordinates and keeps a live incident document. She hands the hands-on fixing to an ops lead and the updates to a comms lead.
declare early: users see it IC holds the big picture, decides, keeps the live incident document Ops the only ones changing the system Comms updates everyone elseKeep everyone told
The comms lead is the public face of the response. They post regular updates, here on the status page: "Checkout errors. We are working on it. Next update 15:15." Questions go to them, so the people fixing things are not interrupted.
status page, 14:42 Checkout errors. We are working on it. Next update 15:15. regular updates, even when there is no newsStop the bleeding first
The errors began with the 14:00 release, so at 14:44 ops rolls it back before hunting the bug. In Kubernetes that is one command: kubectl rollout undo. Mitigate first, find the root cause later.
14:44 $ kubectl rollout undo deployment/checkout deployment.apps/checkout rolled back v2 → v1, the last version that worked mitigate first: stop the harm root cause: later, calmlyRecover and resolve
By 14:47 errors are back to 0.05%: the incident is mitigated. The team watches until the service is clearly healthy, then the IC declares it resolved at 15:10 and the last status update goes out.
14:47 errors 2.5% → 0.05% mitigated 15:10 healthy for a while resolved mitigated = users are fine again resolved = the incident is closedLearn without blame
Afterwards the team writes a blameless postmortem: what happened, the timeline, why the bug got through, and action items such as testing new releases on a few users first. It looks for causes, not culprits, so people tell the whole truth.
postmortem impact 2.5% of checkouts failed timeline from the live incident doc causes why tests missed the bug actions canary releases, a faster alert blameless: causes, not culpritsTime to detect and mitigate
The timeline gives the numbers to improve: 35 minutes to detect (14:00 to 14:35), then 12 more to mitigate. Users saw errors for 47 minutes. Faster alerts and safer releases shrink both next time.
time to detect 14:00 → 14:35 35 min time to mitigate 14:35 → 14:47 12 min user impact 14:00 → 14:47 47 min shrink detect: a shorter window at a higher burn rate pages sooner (but with more false alarms) shrink impact: canary releases, quick rollback
أسئلة سريعة: 5
اختر إجابة واحدة لكل سؤال. يمكنك تغيير اختياراتك قبل التحقق منها.
01A service's SLO is 99.9% successful requests. Right now 2.5% of requests fail. What is the burn rate?
The error budget is 100% − 99.9% = 0.1%. Burn rate = error rate ÷ error budget = 2.5% ÷ 0.1% = 25: the budget is being spent 25 times faster than the SLO allows.
02Google's SRE workbook suggests paging at a burn rate of 14.4 over one hour. Why 14.4?
A 30-day budget lasts 720 hours at burn rate 1. Burning at 14.4 for one hour uses 14.4 ÷ 720 = 2% of it, which the workbook treats as worth waking someone up for.
03During the incident, who should be changing the production system?
The SRE book says the operations team should be the only group modifying the system during an incident. The IC coordinates and keeps the big picture; comms keeps people told.
04Errors started right after a release. What is the usual first move?
Mitigate first. Rolling back (in Kubernetes: kubectl rollout undo deployment/checkout) is a quick, generic mitigation when an outage lines up with a release; the root cause can be found calmly afterwards.
05What makes a postmortem blameless?
A blameless postmortem assumes everyone acted with good intentions on the information they had, and focuses on causes and action items. Blame makes people hide mistakes, so the same failure comes back.
المسرد
- Incident
- An unplanned problem that hurts users, or soon will, and needs a coordinated response.
- SLO (service level objective)
- A target for how reliable a service should be, such as 99.9% of requests succeeding.
- Error budget
- The failures an SLO allows: 100% minus the SLO. For a 99.9% SLO, 0.1% of requests may fail.
- Burn rate
- How fast a service uses its error budget: the error rate divided by the error budget. A burn rate of 1 uses the budget up exactly at the end of the SLO period.
- Page
- An urgent alert that interrupts the on-call engineer right away, day or night. Less urgent problems become tickets.
- Incident commander (IC)
- The person who coordinates the response, holds the big picture, assigns roles and keeps the live incident document.
- Mitigation
- Anything that stops the harm to users, such as a rollback, even before the root cause is known.
- Blameless postmortem
- A written review after an incident covering impact, timeline, causes and action items, focused on causes rather than culprits.
الملاحظات والمصادر
- The checkout service, its traffic (a steady 2,000 requests a minute) and the clock times are invented for teaching; the burn-rate sums follow from those numbers exactly.
- The SRE workbook pairs the 1-hour window with a 5-minute short window: it pages only when both burn at 14.4 or more, so the page also stops about five minutes after the errors stop. The code card shows the long window only.
- Google's incident process is based on the Incident Command System used by emergency services. The SRE book names four roles: incident command, operations, communication and planning. The commander holds every role not handed out, so a small incident may need only an IC.
- kubectl rollout undo returns a Deployment to its previous revision. Rolling back is a generic mitigation: quick and blunt. It only helps when the problem came with the release, and it cannot undo changes such as a database migration.
- The code card is real Python 3. Run it and page is True, because burn(1775, 120_000) is about 14.79; one minute earlier, burn(1726, 120_000) is about 14.38, below 14.4.
- Google SRE workbook, ch. 5: Alerting on SLOs (burn rate, table 5-8)
- Google SRE book, ch. 14: Managing Incidents
- Google SRE workbook, ch. 9: Incident Response
- Google SRE book, ch. 15: Postmortem Culture: Learning from Failure
- Google SRE book, ch. 4: Service Level Objectives
- Google SRE book, ch. 3: Embracing Risk (error budgets)
- Google SRE book, ch. 11: Being On-Call
- Kubernetes docs: Deployments, Rolling Back a Deployment
- kubectl reference: kubectl rollout undo
- PagerDuty Incident Response documentation
اختبار يتاح بعد الخطوة الأخيرة.