Notes
1 · Scope
Step one, scope it before you touch anything. What exactly is wrong: slow, errors, or completely down? Since when, and what changed around then, a deploy, a config change, a traffic spike? Is it everyone or some users, one server or all of them? How bad is it for users right now? Write times down from the first minute. Most incidents are caused by a change, so the timeline is half of the answer.
- what exactly is wrong? slow, errors, down?
- since when? what changed? (deploy, config, traffic)
- everyone or some users? one server or all?
- how bad? users affected now?
- write times down as you go
2 · The service
Step two, the service itself. systemctl status: is it running, has it restarted? journalctl for the last thirty minutes of its logs, where the cause is often written plainly. curl the health check with timing, which shows the status code and how long it took. And ss shows whether anything is listening on its port at all. These four commands answer most down-or-slow questions in under a minute.
$ systemctl status shoprung
$ journalctl -u shoprung
--since "30 min ago"
$ curl -s -w ' %{http_code}
%{time_total}s\n'
localhost:8080/api/health
{"status":"UP",...} 200
$ ss -tlnp | grep 8080 3 · Resources
Step three, if the service looks fine but slow, run the resource pass: uptime for load against the CPU count, dmesg for kernel complaints, vmstat for the run queue and swapping, d f for space and inodes, free for available memory, iostat for disks, and ps sorted by CPU. It is the USE method from episode fourteen in one screen. Now let's apply all of this to four real faults.
$ uptime load vs nproc
$ dmesg -T | tail OOM, disk
$ vmstat 1 5 r, si/so, wa
$ df -h; df -i space, inodes
$ free -m available
$ iostat -xz 1 disks
$ ps -eo pid,pcpu,pmem,comm
--sort=-pcpu | head Case 1 · CPU contention
Case one, slow but not down. Users saw ShopRung's slowest requests go from one point six to thirteen milliseconds. The resource pass proved it: load climbing towards four on two CPUs, vmstat showing four runnable tasks at ninety nine percent user time, and ps listing six shell loops at about thirty two percent each. We mitigated by renicing them to the lowest priority, which brought the ninety fifth percentile back to four point five. The real fix is asking why batch work runs on the web server at all.
symptom: p95 1.6 ms → 13.0 ms proof: load rising toward 4 on 2 CPUs; vmstat r=4, us=99 ps: six sh loops ~32% each mitigate: renice -n 19 → p95 4.5 ms root cause: why did a batch job run on the web server?
Case 2 · Disk full
Case two, a full disk. Symptoms are scattered: write errors, crashes, odd failures in unrelated places. The proof is quick: d f showed zero available, one hundred percent, and writes failed with no space left on device. Find what grew with du, one level at a time, sorted by size. Mitigate by rotating or compressing logs and clearing known caches, never by deleting database files. Then fix it for good: log rotation from episode nineteen and an alert at eighty percent.
symptom: errors writing, app crashes, odd failures proof: df -h → 0 avail, 100% dd: No space left on device find it: du -xh --max-depth=1 / | sort -h | tail mitigate: rotate or compress logs, clear known caches fix: rotation, alert at 80%
Case 3 · Deleted, full
Case three, someone already cleaned up, and nothing changed. A teammate deleted a huge log, but the disk was still full. lsof plus L one proved a process still held the deleted file: python three, a hundred megabytes, marked deleted. We stopped the holder and usage dropped to twenty four kilobytes. In production, reload the service so it reopens its logs, or truncate the file through slash proc if you cannot restart it.
symptom: big log deleted, disk still 101 MB used proof: lsof +L1 python3 1110 ... 104857600 /mnt/lab/big.log (deleted) mitigate: restart/reload the holder, or truncate via /proc/<pid>/fd/<n> result: 24K used
Case 4 · OOM kill
Case four, the app dies with no error of its own, and comes back after a restart. The exit code was one three seven, SIGKILL. dmesg said python three invoked the OOM killer, and the cgroup counted one OOM kill at exactly a hundred megabytes. Mitigate by restarting, and raise the limit only if the peak is genuine. The real fix is finding the leak, by graphing the process's resident memory over time.
symptom: process vanishes, restarts, exit code 137 proof: dmesg: "python3 invoked oom-killer"; cgroup oom_kill 1 at 104,857,600 bytes mitigate: raise the limit if peak is legit; restart fix: find the leak; RSS graph
4 · Mitigate first
Notice the pattern in all four. First mitigate, so users are fine again: roll back the change, restart, renice, add capacity or fail over. Make one change at a time and note it, then confirm with the same measurement that showed the symptom, like the ninety fifth percentile or d f. Only then hunt for the root cause, calmly, and finally make the change that stops it happening again.
- mitigate: roll back, restart, renice, add capacity, fail over: users OK again
- one change at a time, noted
- confirm with the same measurement as the symptom
- then root cause, calmly
- then the fix that stops it happening again
5 · Write it up
Last step, write it up, even for small incidents. What users saw and when. A timeline of detection, mitigation and resolution. The evidence, meaning the commands and numbers that proved the cause. The root cause, and the follow-ups: a new alert, log rotation, a memory limit, a runbook. Keep it blameless. Part twelve turns this into full postmortems. A team that writes these stops having the same incident twice.
- what users saw, and when timeline: detect, mitigate, resolve (with times)
- evidence: the commands and numbers that proved it
- root cause
- follow-ups: alert, rotation, limit, runbook
- blameless (part 12)
Common mistakes
Mistakes. Restarting everything first, which destroys the evidence, like the OOM log or the open file. Making several changes at once. Never asking what changed. Deleting open log files or database files under pressure. Trusting a guess without proof. Keeping no notes, so nobody learns. And stopping at the mitigation, so the same fault returns next week.
- restarting first, so evidence is lost
- several changes at once
- not asking "what changed?"
- rm of open files or DB files
- trusting a guess without proof
- no notes, so no learning
- fixing the symptom only
Say it like this
In the interview: first I scope it: what exactly, since when, what changed, who is affected. Then the service: status, recent logs, and the health check with timing. Then a USE pass over the machine: load against cores, vmstat, d f and d f minus i, free, iostat and dmesg. I mitigate first, one change at a time, confirm with the same measurement, then find the root cause and write it up with follow-ups.
- "I scope it: what, since when, what changed, who is affected.
- Then the service: status, logs, health check with timing. Then a USE pass: load, vmstat, df, free, iostat, dmesg. I mitigate first, one change at a time, confirm, then find root cause and write
- it up."