ENع
→Incidents
الدرس 20 · التشغيل

Incident response

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

12 دقيقة11 خطوة5 أسئلةAdvanced
عن هذا الدرس

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.

ستتعلّم

حدّد ما تشعر بأنك أتقنته. هذا التقييم الذاتي لا يؤثر في درجة الدرس.

شكل 20 · تفاعلي
01 / 11

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
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. 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
  2. A 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%
  3. 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 fast
  4. The 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 minutes
  5. Page 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 hours
  6. Declare 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 else
  7. Keep 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 news
  8. Stop 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, calmly
  9. Recover 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 closed
  10. Learn 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 culprits
  11. Time 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

اختبار يتاح بعد الخطوة الأخيرة.