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 4 of 6 · Lab · 30 min · revision 3

Game day: a simulated outage with assigned roles

Run a local Game Day drill: assign Incident Commander, Ops Lead and Comms roles, respond to two injected faults with a runbook, and produce a timeline with time to detect and time to mitigate.

Contentsand lesson path

What you will learn

  • Classify an incident by severity and run it with defined roles (incident commander, operations lead, communications) and a written timeline.
  • Triage from dashboards and runbooks and apply a mitigation (rollback, failover, scaling or feature flag) before investigating root cause.

Prerequisites: Observability

01. Goal and ground rules of a game day

You cannot find out whether your runbooks are clear, your alerts fire or your team works well together under pressure by waiting for a real outage. A game day is a planned exercise in which someone injects a fault on purpose, in staging or another safe environment, and the team responds as if it were real.

Automated chaos testing (for example Netflix's Chaos Monkey, which terminates instances at random) checks that the system survives failures. A game day checks the people: whether roles are clear, whether the runbook works and whether communication holds up. Agree three things before any fault is injected:

  • A limited blast radius. The blast radius is the part of the system a fault can affect. Target an isolated service, a staging cluster or a small canary share of traffic, chosen so that no customer data can be lost and any customer impact stays small and planned.
  • An abort word. Agree a word or emergency stop procedure. If the fault starts to affect real production work, any participant can call a halt, and the Chaos Master removes every injected fault at once.
  • Roles. Before the fault is injected, assign the Incident Command System roles: an Incident Commander, an Operations Lead, a Communications Lead, and a Chaos Master (the scenario designer who injects the fault and acts as the alerting system).

Game days usually grow through three levels:

  • Tabletop exercises: the team talks through an outage scenario step by step, on paper. Nothing can break, and it still finds missing runbooks, expired credentials and unclear roles.
  • Announced staging drills: the team books a time slot on a staging environment that mirrors production, injects real faults and checks the dashboards and failover live.
  • Controlled production experiments: experienced teams inject faults in working hours on a small canary share of live traffic, to check that circuit breakers trip and responders assemble within their agreed response targets.

During the drill, observers record time to detect (TTD), time to acknowledge (TTA), time to mitigate (TTM) and time to recover (TTR). Comparing these across drills shows whether the team is getting faster, as long as the scenarios are comparable.

Straight after the drill, hold a short debrief while memories are fresh; 15 minutes is enough for this lab. Go through what worked, which runbook commands or links were wrong, and where communication stalled. Write each finding down as an action with an owner. That is what turns the drill into real improvements, such as better telemetry or a scripted mitigation, rather than a box ticked.

02. Setting up the drill: service, monitor, runbook and roles

This is a drill you can run on one laptop in about 30 minutes. A small checkout service runs locally, a monitor prints its error rate every five seconds and raises an alert, and a Chaos Master injects one of two faults from a scenario card. The responders do not know which fault is coming.

What you need: Python 3.11 or later, Bash, curl and two terminal windows on the same machine. Create a folder gameday/ with the three files below and run chmod +x release.sh.

Roles: a Chaos Master (injects the fault, plays the alerting system and any other team the responders call), an Incident Commander, an Operations Lead (the only person who types commands into terminal 2) and a Communications Lead, who also keeps the timeline. With fewer people, the IC also keeps the timeline. Solo variant: play every role yourself; ask someone else to inject the fault at a random moment, or inject it yourself and wait one minute before you look at the monitor, and read the role checklist aloud as you go.

Python · gameday/checkout.py: the service
"""Checkout service for the game day. VERSION=v2.4.1 is the faulty release."""
import json
import os
import pathlib
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

VERSION = os.environ.get("VERSION", "v2.4.0")
FAULT_FLAG = pathlib.Path(__file__).with_name("payments-down.flag")
count = 0


class Handler(BaseHTTPRequestHandler):
    def reply(self, status, body):
        data = json.dumps(body).encode()
        self.send_response(status)
        self.send_header("Content-Type", "application/json")
        self.send_header("Content-Length", str(len(data)))
        self.end_headers()
        self.wfile.write(data)

    def do_GET(self):
        global count
        if self.path == "/healthz":
            return self.reply(200, {"status": "ok", "version": VERSION})
        if self.path != "/checkout":
            return self.reply(404, {"error": "not found"})
        count += 1
        if VERSION == "v2.4.1" and count % 20 < 7:  # 35%: connection pool bug
            return self.reply(500, {"error": "connection pool exhausted"})
        if FAULT_FLAG.exists() and count % 2 == 0:  # downstream outage drill
            return self.reply(503, {"error": "payment gateway timeout"})
        return self.reply(200, {"order": count, "version": VERSION})

    def log_message(self, *args):
        pass


ThreadingHTTPServer(("127.0.0.1", 8090), Handler).serve_forever()
Bash · gameday/release.sh: "deploys" a release and records it
#!/usr/bin/env bash
# Usage: ./release.sh v2.4.0|v2.4.1  - "deploy" one release of checkout.py on :8090
set -euo pipefail
cd "$(dirname "$0")"
VERSION="${1:?usage: release.sh <version>}"
if [[ -f checkout.pid ]] && kill "$(cat checkout.pid)" 2>/dev/null; then
  while kill -0 "$(cat checkout.pid)" 2>/dev/null; do sleep 0.2; done
fi
VERSION="${VERSION}" nohup python3 checkout.py > checkout.log 2>&1 &
echo $! > checkout.pid
echo "$(date -u +%H:%M:%S) ${VERSION}" >> deploy-history.txt
echo "$(date -u +%H:%M:%S) deployed checkout ${VERSION}"
Python · gameday/monitor.py: error rate and alert
"""Every 5 s: send 20 checkout requests, print the error rate, and raise an
alert when it is above 5% in two windows in a row. Usage: python3 monitor.py"""
import sys
import time
import urllib.error
import urllib.request
from datetime import datetime, timezone

URL = "http://127.0.0.1:8090/checkout"
WINDOWS = int(sys.argv[1]) if len(sys.argv) > 1 else 0  # 0 = run until Ctrl+C
firing, bad, n = False, 0, 0
while WINDOWS == 0 or n < WINDOWS:
    n += 1
    errors = 0
    for _ in range(20):
        try:
            urllib.request.urlopen(URL, timeout=2).read()
        except (urllib.error.URLError, OSError):  # includes HTTP 5xx
            errors += 1
    rate = 100 * errors / 20
    now = datetime.now(timezone.utc).strftime("%H:%M:%S")
    bad = bad + 1 if rate > 5 else 0
    note = ""
    if bad >= 2 and not firing:
        firing, note = True, "  ALERT CheckoutHighErrorRate FIRING"
    elif rate <= 5 and firing:
        firing, note = False, "  ALERT CheckoutHighErrorRate RESOLVED"
    print(f"{now} error_rate={rate:.0f}%{note}", flush=True)
    time.sleep(5)

Print the runbook and the incident channel template, or paste them into a shared document. The incident channel can be a real chat channel or a shared text file.

Runbook · CheckoutHighErrorRate
RUNBOOK  CheckoutHighErrorRate  (alert: error rate > 5% for 2 windows)
1. Impact: what share of checkouts fail? Read it from the monitor.
2. What changed? cat deploy-history.txt
3. If a release went out in the last 30 minutes and it is rollback-safe
   (no migration), roll back:  ./release.sh <previous version>
4. Otherwise read the errors:  curl -s http://127.0.0.1:8090/checkout
   A dependency error (for example "payment gateway timeout") goes to the
   owning team; ask them to restore it or switch to the fallback.
5. Recovered = two monitor windows in a row at or below 5%.
Template · incident channel messages
#inc-<date>-checkout
[hh:mm:ss] IC: Declaring P1 for checkout errors. I am IC. Ops: <name>. Comms: <name>.
[hh:mm:ss] Comms: Status: some checkouts are failing; next update in 10 minutes.
[hh:mm:ss] Ops: Runbook step 2: last deploy <version> at <time>. Proposing rollback.
[hh:mm:ss] IC: Approved. Go.
[hh:mm:ss] Ops: Rolled back. Watching two windows.
[hh:mm:ss] IC: Recovered. Closing the incident; postmortem owner: <name>.

03. Running the drill: two scenario cards and a timeline

  1. Start the service and the monitor. Everyone should see error_rate=0% lines before the drill starts, and the health check in terminal 2 should report v2.4.0. Agree an abort word now (for example "RED STOP"): saying it ends the drill and the Chaos Master restores v2.4.0 and deletes payments-down.flag.
Bash · Step 1: start the service and the monitor
# Terminal 1 (everyone watches this one)
./release.sh v2.4.0
python3 monitor.py
Bash · Terminal 2: check which release is serving
curl -s http://127.0.0.1:8090/healthz; echo
Expected output
{"status": "ok", "version": "v2.4.0"}
  1. Scenario card A: a bad release. The Chaos Master deploys v2.4.1, which fails about 35% of checkouts. The responders declare the incident, assign roles, follow the runbook and roll back. The output below came from a run in which the responders reacted at once; with people talking to each other, expect minutes rather than seconds.
Bash · Step 2: scenario card A
# Terminal 2. Chaos Master, without announcing it (note the time):
./release.sh v2.4.1
# Responders, once the alert fires: follow the runbook
cat deploy-history.txt
./release.sh v2.4.0
# Give the restarted service a second to start, then check which version serves
sleep 1; curl -s http://127.0.0.1:8090/healthz; echo
Illustrative output (from a real run; your clock times differ, and the number of bad windows depends on how fast you react)
# terminal 2: release, cat deploy-history.txt, rollback
02:07:51 deployed checkout v2.4.1
02:07:33 v2.4.0
02:07:51 v2.4.1
02:08:01 deployed checkout v2.4.0
# terminal 1 (monitor)
02:07:35 error_rate=0%
02:07:40 error_rate=0%
02:07:45 error_rate=0%
02:07:50 error_rate=0%
02:07:55 error_rate=35%
02:08:00 error_rate=35%  ALERT CheckoutHighErrorRate FIRING
02:08:05 error_rate=0%  ALERT CheckoutHighErrorRate RESOLVED
02:08:10 error_rate=0%
02:08:15 error_rate=0%
Expected output (the last command, after the rollback)
{"status": "ok", "version": "v2.4.0"}
  1. Scenario card B: a fault that is not in the release. Rotate the roles first. The Chaos Master creates payments-down.flag, which makes every second checkout fail with a payment gateway timeout. Nothing was deployed, so the runbook's rollback branch does not apply. Teams that roll back anyway see the fault continue: a rollback only removes faults that the release introduced. The responders must read the error, call the "payments team" and ask for the gateway to be restored.
Bash · Step 3: scenario card B
# Chaos Master, without announcing it:
touch payments-down.flag
# Responders: the runbook says "what changed?" Nothing was deployed.
for i in 1 2 3 4; do
  curl -s -w " HTTP %{http_code}\n" http://127.0.0.1:8090/checkout
done
# Ask the "payments team" (the Chaos Master) to restore the gateway:
rm payments-down.flag
Illustrative output (from a real run; times and order numbers differ, because the monitor shares the counter)
# curl during the fault
{"order": 81, "version": "v2.4.0"} HTTP 200
{"error": "payment gateway timeout"} HTTP 503
{"order": 83, "version": "v2.4.0"} HTTP 200
{"error": "payment gateway timeout"} HTTP 503
# terminal 1 (monitor)
02:08:15 error_rate=0%
02:08:20 error_rate=50%
02:08:25 error_rate=50%  ALERT CheckoutHighErrorRate FIRING
02:08:30 error_rate=50%
02:08:35 error_rate=0%  ALERT CheckoutHighErrorRate RESOLVED
02:08:40 error_rate=0%
  1. Deliverable: a timeline with TTD and TTM for each card. Build it from the incident channel, the monitor output and deploy-history.txt, not from memory. Time to detect (TTD) runs from the start of the fault to the alert or the declaration; time to mitigate (TTM) runs from the start of the fault to the first healthy monitor window. The example below is filled in from the card A run above.
Example · timeline for scenario card A
GAME DAY TIMELINE  scenario: A   date: 2026-11-17   times in UTC
02:07:51  fault injected (v2.4.1 deployed)          [Chaos Master]
02:08:00  alert CheckoutHighErrorRate firing         [monitor]
02:08:00  P1 declared; IC, Ops, Comms named          [IC]
02:08:00  runbook step 2: v2.4.1 deployed 02:07:51   [Ops]
02:08:01  rollback to v2.4.0 started                 [Ops]
02:08:05  first healthy window (mitigated)           [monitor]
02:08:10  second healthy window: recovered, closed   [IC]
TTD = alert - fault start                = 9 s
TTM = first healthy window - fault start  = 14 s
Customer impact: 02:07:51 to ~02:08:05, about 35% of checkouts failed
  1. Debrief for 15 minutes, using the timelines. Where did the runbook help or mislead? How long did it take to name an IC? Did anyone try a rollback in card B, and what told them it was the wrong fix? Stop the drill with kill "$(cat checkout.pid)" and Ctrl+C in terminal 1.

04. Check your understanding

Practice check · 3 questions

Game day purpose, aborts and declaring recovery

Three questions on running a game day safely.

Q1. Why run scheduled game days even when the automated unit and integration tests pass and cover all of the code?
Q2. During a staging Game Day simulation, the Ops Lead observes that network latency is unexpectedly spilling over into live production databases. What must occur immediately?
Q3. In a Game Day, rolling back the application restores error rates from 35% to 0%, but the team has not identified the buggy line of code. What should the IC do?
Practice only: not graded, not saved, not evidence.

05. Apply it

Design and run a third scenario card, a slow dependency, with the same gameday/ folder. This takes about 30 minutes.

  1. In checkout.py, add import time and a second flag file, payments-slow.flag. When it exists, make every second /checkout request call time.sleep(3) before it answers 200. The monitor waits at most 2 seconds per request, so it counts these as errors; its windows also take longer, because each slow request holds it for 2 seconds. BrokenPipeError lines in checkout.log are expected: they are the answers that arrived after the monitor gave up.
  2. Rotate the roles again. The Chaos Master creates payments-slow.flag without announcing it, and the responders follow the runbook. Note what the runbook's step 4 tells them, because curl now waits instead of printing an error.
  3. Write the card C timeline with TTD and TTM, in the same format as the card A example.

Produce: the changed checkout.py, the card C timeline, and one change to the runbook that would have helped (for example curl -s -m 2 -w " %{time_total}s\n" to show the response time). Compare TTD with card B: a slow dependency is often harder to recognise than one that fails fast.

06. Review prompt

Without looking back: what does a game day test that automated tests and chaos tools do not? Which three things must be agreed before a fault is injected, and why? How do you compute TTD and TTM from a timeline? Why can the IC declare recovery once users are no longer affected, even before the cause is known?

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