Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 2 of 6 · Concept · 15 min · revision 3

Mitigate first: stopping the damage before explaining it

Stop customer harm before diagnosing the cause: choose a fast, usually reversible mitigation (rollback, feature flag, load shedding, circuit breaker, scaling) from the evidence, and check when a rollback is not safe.

Contentsand lesson path

What you will learn

  • Triage from dashboards and runbooks and apply a mitigation (rollback, failover, scaling or feature flag) before investigating root cause.

Prerequisites: Observability

01. Why it matters

While an outage lasts, users fail to pay, sign in or load their data. If you have a service level agreement (SLA, a contract that promises a level of service), each minute may also count against it. Finding the root cause can take hours: reading traces, reproducing a race condition, reviewing a week of changes. Users cannot wait for that.

So incident response separates two jobs. Mitigation stops or reduces the harm now, usually with a move that is quick and can be reversed. Diagnosis explains why the failure happened, and it can continue calmly once users are safe. This lesson shows the common mitigations, when each one fits, when the most obvious one (a rollback) is unsafe, and how to keep evidence for the diagnosis while you mitigate.

02. Mitigate first, investigate later

Under pressure, engineers want to understand the failure: why did this function throw a null pointer exception, and where did the deadlock start? That curiosity is useful later. During the incident, the first question is a different one: what is the quickest safe way to stop users being hurt? Google's SRE book lists this as the first best practice of incident management: "Prioritize. Stop the bleeding, restore service, and preserve the evidence for root-causing." Teams often shorten the idea to mitigate first, investigate later. Preserving the evidence (logs, a copy of the bad config, the time of each action) is what lets the investigation happen once users are safe.

In practice, you choose a mitigation from the evidence you already have (what changed recently, which resource is saturated, which dependency is failing) instead of waiting for proof of the cause. If the move does not help, you undo it and try the next one. The investigation continues afterwards, with users protected.

03. Six common mitigations

Most outages can be reduced with one of a short list of rehearsed moves. Pick the one that the evidence supports:

  1. Roll back a recent change. Google's SRE book reports that roughly 70% of outages are caused by changes to a live system: a new release, a configuration change or a database migration. If error rates climb right after a release that the runbook marks as rollback-safe (no irreversible migration), roll back without waiting to prove that the new code was at fault; rolling back removes user impact while developers inspect the change offline. If the release changed the schema or data, first confirm that the previous version can run against it, or use the release's feature flag instead.

  2. Turn off a feature or trip a circuit breaker. A feature flag is a runtime switch that turns a feature on or off without a deploy; a circuit breaker stops calling a dependency that keeps failing and returns a fallback instead. If an outage is tied to a non-essential service or a third-party API (such as a recommendation engine timing out), turning the feature off lets the page degrade gracefully while the core flow, such as checkout, keeps working.

  3. Scale out. When the worker nodes run at 98% CPU and the request rate has quadrupled because of an unplanned marketing campaign, the mitigation is more capacity, not a rollback. Running kubectl scale deployment/web-service --replicas=30 adds capacity once the new pods are scheduled, have pulled their image and pass readiness, which often takes a minute or more, and longer if new nodes must be added. It helps only when the service itself is the bottleneck: if a shared database or downstream service is saturated, more replicas open more connections and make things worse, so check before you scale.

  4. Shed load. When database connection pools or message brokers are saturated, services can drop low-priority work (such as analytics events or report generation) to keep capacity for user-facing requests. This is also called graceful degradation.

  5. Move traffic away from a failing zone or region. A cloud region contains several availability zones, each one or more separate data centres. If one zone loses network connectivity or hosts, a load balancer stops sending requests to the instances there, provided the service runs in more than one zone. If a whole region degrades, DNS failover (for example Amazon Route 53 health checks with failover routing) or a global load balancer can send users to a healthy standby region.

  6. Rate-limit and stop retry storms. When a downstream service degrades, aggressive client retries often make the failure spread. Ingress controllers and API gateways can enforce token-bucket rate limits per client and answer excess requests with 429 Too Many Requests or 503 Service Unavailable plus a Retry-After header. Backoff itself is implemented by clients: well-behaved clients honour Retry-After and retry with exponential backoff and jitter, which keeps retry storms from stalling backend recovery.

The decision tree below puts these checks in order. Note that the rollback step applies only to a release that is marked rollback-safe.

YAML · runbooks/mitigation-decision-tree.yaml rapid triage workflow
mitigation_decision_tree:
  step_1a_recent_release_rollback_safe:
    condition: Deployed within last 60 minutes AND release marked rollback-safe?
    action: Roll back with the service's tested command (helm rollback)
  step_1b_recent_release_not_rollback_safe:
    condition: Deployed within last 60 minutes, release NOT marked rollback-safe?
    action: Turn off the release's feature flag, or roll forward a reviewed fix
  step_2_load_spike:
    condition: Request volume > 2x baseline with high CPU on the service itself?
    action: Scale out replicas or enable rate limiting
  step_3_dependency_failure:
    condition: Third-party API or downstream DB timing out or saturated?
    action: Trip circuit breaker, turn off non-critical feature, or shed load
  step_4_zone_or_region_impairment:
    condition: Cloud provider reporting zone or region degradation?
    action: Drain the failing zone; fail over to standby region if region-wide

04. Keeping evidence without prolonging the outage

Mitigation comes first, but it does not have to destroy every clue. If you restart a whole Kubernetes Deployment, the memory state, thread dumps and local crash files of the failing containers disappear with them.

A useful compromise is quarantine before restart: take one misbehaving Pod out of service, then fix the rest. Change the label that the Service selects on (kubectl label pod/web-crash-89 app=quarantine --overwrite). The Service stops sending the Pod traffic, and if the Deployment selects on the same label, as most do, its ReplicaSet stops counting the Pod and starts a replacement. The quarantined process keeps running with its memory and open files intact. You can then restart or roll back the rest of the fleet.

With the Pod out of traffic, run inspections that do not change it: a Java Virtual Machine (JVM) thread dump with jcmd <pid> Thread.print, the process memory map in /proc/<pid>/maps, or a short packet capture with tcpdump inside the Pod's network namespace. Copy the results to durable storage, such as an object storage bucket, and then delete the quarantined Pod.

05. Check your understanding

Practice check · 3 questions

Choosing a first mitigation

Three questions on mitigation when the obvious move is unsafe or does not help.

Q1. Ten minutes after a release that dropped a database column, errors spike. The runbook marks this release as not rollback-safe. What is the best first step?
Q2. Traffic doubles. The app pods sit at 40% CPU, but the shared database is at 100% and queries are queuing. Which first step is reasonable?
Q3. Why re-label a misbehaving Pod to remove it from Service endpoints before restarting the rest of the workload fleet?
Practice only: not graded, not saved, not evidence.

06. Apply it

Turn the decision tree into a runbook entry for one real service. This takes about 25 minutes. Use a service you know, or the checkout service from the game-day lab, where ./release.sh <version> is the rollback command.

  1. Copy runbooks/mitigation-decision-tree.yaml from this lesson. For each step, replace the action text with the exact command or console step for your service, and add a verify: line that names the metric and the value that shows the step worked (for example "error rate below 1% for 5 minutes").
  2. Add a releases: list with the last three releases (or three made-up ones) and mark each rollback_safe: yes or no, with a short reason such as "config change only" or "drops a column".
  3. Walk three alerts through your tree and write down which step each one lands on, and why: a release 20 minutes ago that changed only an HTTP client timeout, with errors rising; a threefold traffic spike with the app pods at 95% CPU and the database at 40%; a fraud-scoring API that starts timing out.

Produce: the edited YAML file and three short lines with your answers. If one alert matches two steps, decide which check should come first and reorder the tree.

07. Review prompt

Without looking back: what is the difference between mitigation and diagnosis, and why does mitigation come first? For rollback, scaling out, a feature flag and load shedding, name the evidence that points to each one. When is a rollback unsafe, and what do you do instead? How does quarantining a Pod keep evidence while users are protected?

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check