Linux SRE Runbook: Taming a Production Server Under High Load
Scenario
It's 2 AM and your pager goes off. A critical application server is showing a load average of 30 on a 16-core machine. Customer requests are timing out. This runbook is your guide to systematically diagnose and resolve such issues without escalating the incident.
Symptoms
- Load average consistently exceeds the number of CPU cores (check with
nproc). - SSH session feels sluggish; commands take seconds to return.
- Application latency spikes, and health checks start failing.
uptimeshows high 1-, 5-, and 15-minute averages.
Diagnosis Steps
-
Quick Snapshot
Runuptimeandcat /proc/loadavgto confirm the load. Also note the CPU count (nproc). This sets the baseline. -
Find the Hottest Processes
Usetop -b -n 1 | head -30for a snapshot. Or interactivehtopif installed. For a cleaner listing, use:bash ps -eo pid,ppid,user,cmd,%cpu,%mem --sort=-%cpu | headLook for processes consuming the most CPU. If nothing obvious, check I/O and memory next. -
CPU vs I/O Bound
Runvmstat 1 5. Theus(user),sy(system), andwa(I/O wait) columns are key. Ifwais consistently high (e.g., >30%), the issue is disk I/O. Ifus/sydominate, it's CPU-bound. -
Drill into Disk I/O
For I/O-bound systems, useiostat -x 1to see per-device utilization and queue length.iotop(if available) shows per-process I/O. Look for processes like log daemons, database checkpoints, or backups hammering the disks. -
Check Memory Pressure
Usefree -mand check for swap usage. A system that is swapping heavily can appear to have high load. Look atdmesgforoom-killermessages. High memory pressure can also cause OS-level thrashing. -
Review System Logs
Suddenly, check for errors in the last few minutes:bash journalctl -p err -n 100 --since "10 min ago"Look for disk errors, systemd service failures, or repeated crashes. -
Trace the Process
If a specific process is stuck in a loop, attachstracecarefully. For example, trace system calls for 10 seconds and summarize:bash timeout 10 strace -c -p $PIDThis can reveal endless futex calls (lock contention) or file I/O. For deeper kernel profiling,perf top(as root) may show hot functions.
Risk Controls
- Do not kill processes blindly. Always check with
ps -o user,pid,cmd -p $PIDto see what it is and who owns it. - Use
kill -TERM(graceful) beforekill -KILL. - If the process is not critical, reduce its priority instead:
renice +20 -p $PID. - For I/O-heavy processes, use
ionice -c3 -p $PIDto set idle class. - Never modify a configuration file without copying it first. Use
cp file file.bak. - Test any systemd unit changes with
systemd-analyze verify /path/to/service.
Rollback Plan
- If you changed a service config, validate it and then restart:
systemctl restart my-service. - If you removed a suspected cron job, restore the crontab from backup.
- If you installed a temporary tracing package, uninstall it after the incident.
- Always document what you changed and when, so you can revert if needed.
Verification
- Re-run
uptimeand confirm load average drops to a healthy range (e.g., <= 1.5x CPU count for your workload). - Hit the service with a few test requests:
curl -w "@curl-format.txt" -o /dev/null -s https://your-api/healthto measure latency. - Watch
vmstatandiostatfor 5-10 minutes to ensure the system is stable. - Check logs for any new errors:
journalctl -p err --since "5 min ago".
When to Submit an OpsGlobal Ticket
OpsGlobal provides 24/7 remote SRE support. Submit a ticket when: - The load remains high after you've addressed the obvious process or I/O issue. - You suspect a kernel bug, driver issue, or filesystem corruption that requires deep expertise. - The root cause is not clear, and the business is losing money while you search. - You need a second opinion on a complex configuration or performance tuning task.
Our SREs can analyze kernel crash dumps, use advanced tracing tools, and help you build a long-term fix. You'll also get a post-incident report to improve your monitoring.
Remember, a systematic approach saves time. Don't panic, follow this runbook, and know when to ask for help.
Use cases
Useful for teams handling DevOps issues and needing a clear troubleshooting and delivery workflow.
Problem background
A practical guide for SREs to systematically diagnose and resolve high load on Linux production servers, with commands, risk controls, and escalation guidance.
Troubleshooting steps
Confirm impact and recent changes, collect logs, configuration and metrics, then apply fixes from low to high risk.
Command examples
Replace sample resource names with real values and store passwords, tokens and keys in environment variables.
Risks
Before production changes, confirm backups, access boundaries, change windows and rollback paths.
Rollback plan
Keep original configuration and release versions; roll back config, images or database changes if metrics degrade.
Deliverables
Root-cause notes, key commands, remediation steps, verification results and follow-up recommendations.
Need help with a similar technical issue?
If your servers, Kubernetes, Docker, CI/CD, databases or monitoring systems have similar issues, submit logs and config files for remote diagnosis.