Troubleshooting guide
High CPU usage on a Linux server: find the cause
High CPU is either useful work you need more capacity for, or waste you can remove. A few commands tell you which, and which process is responsible.
3 min read9 sectionsUpdated
On this page
| Field | Meaning | High usually means |
|---|---|---|
| us | User space | Your application is busy: real work or inefficient code |
| sy | Kernel | Many system calls, context switches, networking |
| wa | Waiting for I/O | Disk bottleneck, not CPU; check iostat |
| st | Steal | The hypervisor gives your VM less CPU; noisy neighbours or burst credits exhausted |
| si / hi | Interrupts | Very high network packet rates |
# Threads inside the busy process
top -H -p <pid>
# What is it doing? Sample stacks for 30 seconds (perf package)
sudo perf top -p <pid>
sudo perf record -F 99 -p <pid> -g -- sleep 30 && sudo perf report
# Language-specific profilers
py-spy top --pid <pid> # Python
jcmd <pid> Thread.print # Java thread dump
node --cpu-prof app.js # Node.js CPU profileCommon causes
- Traffic growth: CPU tracks request rate. Scale out or optimize hot paths found in traces.
- A runaway job or loop: one process at 100% of one core regardless of traffic.
- Garbage collection pressure: memory near the heap limit makes the runtime collect constantly.
- Regex or JSON on large inputs: catastrophic backtracking or huge payloads.
- Crypto mining malware: unknown processes using CPU constantly. Investigate as a security incident.
- Steal time: burstable instances that ran out of credits.
Containers and CPU limits
A container limited to 0.5 CPU at 100% of its limit is throttled while the host may look idle. Check throttling in /sys/fs/cgroup/cpu.stat (nr_throttled, throttled_usec) and measure usage as a share of the limit. VitalRix infrastructure monitoring shows CPU as a share of the cores an instance may use, taken from its container limit when there is one, and alerts per instance when CPU stays too high.
What is a normal load average?
Compare it with the number of cores. A load of 4 on a 4-core machine means fully busy; above that, tasks are waiting. A high load with low CPU usage usually means tasks waiting on disk.
Is 100% CPU always bad?
Not if latency is fine and it is temporary, such as a batch job. It is bad when request latency rises, which shows up in p95 and p99.
Related reading
- PostgreSQL high CPU usage: how to find the cause: Diagnose PostgreSQL high CPU: use pg_stat_statements to rank queries by total time, spot missing indexes and stale statistics, and read EXPLAIN properly.
- High load average on Linux: what it means and how to fix it: Understand Linux load average: how it relates to CPU count, why I/O wait raises it with idle CPUs, and how to find the processes responsible using vmstat.
- High iowait on Linux: how to find the cause: Diagnose high iowait on Linux with iostat and iotop: read await and %util correctly, find the process doing the I/O, and fix slow queries and swap.
- 500 Internal Server Error: how to find the cause: A 500 error means your code failed. Find the exception behind it fast with logs, traces and error tracking, and learn how to prevent repeats.
- Java high CPU: how to find the thread with a thread dump: Find which Java thread causes high CPU: match top -H thread IDs against jstack output, read thread states, spot GC problems and use async-profiler safely.
- What is TTFB (time to first byte)?: Time to first byte explained: what TTFB measures, the 0.8 second threshold, the phases that add up to it, how to measure it and how to cut it.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.