Q: You have been given a runbook for handling a "database replication lag" incident, but it's out of date. What should a well-structured SRE runbook contain?
A well-structured runbook is the difference between a 5-minute resolution and a 2-hour scramble. It should be written for the worst case: an on-call engineer at 3 AM who has never seen this specific failure before.
Want to master this scenario in a live sandbox? KodeKloud's PostgreSQL Database Administration & High Availability Course covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: "In an interview, I explain my systematic Linux troubleshooting methodology using Brendan Gregg's USE method. The interviewer is testing: Operational documentation, runbook standards, incident response.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."
Initial Diagnostics & Root Cause Analysis
A well-structured runbook is the difference between a 5-minute resolution and a 2-hour scramble. It should be written for the worst case: an on-call engineer at 3 AM who has never seen this specific failure before.
- Title and ownership: "Database Replication Lag Remediation" — Owner: @database-team, Last updated: [date]
- Overview: One paragraph describing what this runbook addresses and when to use it.
- Alert trigger: Which monitoring alert triggers this runbook (link to alert definition).
- Impact assessment:
- What breaks if replication lag exceeds 30s? 5min? 30min?
- Which services are affected?
- Customer-facing impact description
- Diagnostic steps (copy-paste commands):
Remediation & Permanent Safeguards
Essential sections:
# Check replication lag
mysql -e "SHOW SLAVE STATUS\G" | grep Seconds_Behind_Master
# Check for long-running queries on primary
mysql -e "SHOW PROCESSLIST" | grep -v Sleep
- Remediation steps: Ordered from least risky to most risky:
- Step 1: Kill long-running queries on primary
- Step 2: Increase replication parallel workers
- Step 3: Failover to standby (with explicit commands)
- Escalation path: Who to call if the runbook doesn't resolve the issue, with contact details.
- Rollback instructions: How to undo each remediation step if it makes things worse.
- Title and ownership: "Database Replication Lag Remediation" — Owner: @database-team, Last updated...
- Overview: One paragraph describing what this runbook addresses and when to use it.
- Alert trigger: Which monitoring alert triggers this runbook (link to alert definition).
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Applying exclusive-lock DDL table migrations on live production databases during peak traffic windows when configuring given runbook handling DDL migrations that acquire an exclusive table lock block all concurrent queries, queuing connections until the database connection pool exhausts.
- Allowing high-frequency queries to trigger full table scans without appropriate composite indexing when configuring given runbook handling Sequential table scans saturate database CPU and disk I/O, evicting frequently queried data from the buffer cache and causing cascading timeouts.
- Disabling referential integrity constraints during bulk ETL imports without post-import consistency validation when configuring given runbook handling Skipping relational consistency checks risks introducing orphaned records and referential integrity violations into production tables.
- Relying on database snapshot backups that have never been verified through automated restoration drills when configuring given runbook handling Backups that have never been tested with automated restore verification frequently fail during real disaster recovery scenarios.