Skip to content

Reading CPU, Memory, and Disk IO Without Misjudging — a Host Signal Decision Tree

I have seen far too many "the metric is scary but nothing is actually wrong" incidents, and just as many "no alert fired but the system is already wedged" ones. The most common host-monitoring failure is not not knowing how to read a metric. It is reading the metric wrong: a load of 30 and someone shouts for more CPU, memory at 95 percent and someone rushes to add RAM, iowait spikes and someone blames a slow disk. Each of these misjudgments burns a half day, and each one can trigger a wrong capacity decision.

So I broke the three host signals down into one decision tree, symptom to command to fork, built on three sentences:

  • CPU: a high load does not equal not enough CPU. Separate the real work from steal and iowait.
  • Memory: a high used figure does not equal not enough memory. Look at available and the OOM records.
  • Disk IO: high utilization does not equal a saturated disk. Tell real busy from waiting on a lock or a queue.

Signal one: CPU — a high load does not mean you should scale out

Symptom A: high load and %user is not low either

vmstat 1 10
mpstat -P ALL 1 5
cat /proc/stat

The fork: in vmstat, the run column above the core count means the CPU is genuinely the limit and you should scale out or throttle. A normal run queue with the blocked column above zero means threads are stalled on IO, the root cause is not the CPU, so go to the disk segment.

Symptom B: high load but high idle as well

ps -eo state,pid,cmd | awk '$1=="D"' | head
vmstat 1 5 | awk 'NR>2 {print $cs}'

This is the classic case where load lies: D-state processes count toward the load average but they never take the CPU. Most of the time the disk or NFS is slow, not the CPU.

Symptom C: high %steal in a virtualized environment

mpstat -P ALL 1 3 | grep -E "CPU|%st"

%steal is the host taking your virtual CPU time to serve somebody else. I once saw a container pegged at 90 percent where neither %sys nor %user was high and the whole thing was steal; it turned out the host was oversold and moving the workload was the fix. High %steal means go to the host, not add an instance.

Signal two: memory — 95 percent does not force you to add RAM

Separate used, available, and cache

free -h
grep -E "MemAvailable|MemFree|Buffers|Cached" /proc/meminfo

Linux puts idle memory to work caching files, so used stays high and that is normal. Watch available, the kernel's estimate of what is actually usable. If it still has a gigabyte or more and the system is not lagging, do not rush to add memory.

Three hard proofs of real memory pressure

dmesg | grep -i "out of memory" | tail -5
vmstat 1 5
cat /proc/pressure/memory

The third line is the most direct signal: some avg10 above ten means processes are stalling on memory frequently and it is a real bottleneck; near zero means the number is just ugly and performance is fine.

The container trap: host free does not see the cgroup limit

cat /sys/fs/cgroup/memory/memory.limit_in_bytes
cat /sys/fs/cgroup/memory/memory.usage_in_bytes
dmesg | grep -i "killed process"

The host free shows fifty gigs, but the container limit is two gigs and it OOMs anyway. Judge memory in the cgroup that owns the workload.

Signal three: disk IO — 100 percent utilization is not a saturated disk

Split it with iostat -x

iostat -x 1 5
Reading Verdict Next move
Util near 100 with high await truly busy on a single-queue device scale up, swap to SSD, or split the disk
Low util but high await large requests or a deep queue inspect request size, tune the app concurrency
Util near 100 but throughput flat waiting on a lock or queue check queue depth and the application layer
Util naturally high on NVMe multi-queue device, not saturation read queue depth and PSI instead

I was burned once: the monitor reported a hundred percent utilization and I was told to swap the drives. I ran iostat -x and saw await of 0.8 milliseconds and a queue depth of 0.3, the device was not queuing at all; the high utilization was just how a multi-queue drive displays. The real problem was the application writing one huge request. A bare utilization figure misleads; always pair it with await and queue depth.

Let PSI hand you the "how long we stalled on IO" answer

cat /proc/pressure/io

Some avg10 above ten confirms real IO stalling; full avg10 above one means every task stalled at once, which is worse. On the Prometheus side the same numbers come from the node pressure IO waiting series.

High iowait but the disk is not busy — the cause is elsewhere

cat /proc/*/stat 2>/dev/null | awk '$3=="D"' | head
bpftrace -e 'tracepoint:block:block_rq_issue { @[comm] = count(); }'
dmesg | grep -i "nfs" | tail

High iowait with a low disk utilization means the bottleneck is network storage or lock contention, not the local disk. This single check saves a wrong "replace the drive" decision.

A single card

Misjudgment The truth One command
High load equals not enough CPU many D-state means waiting on IO list D-state processes
High load equals not enough CPU (VM) high %steal means host oversell mpstat for %st
Memory at 95 equals not enough check available and OOM records grep MemAvailable, then dmesg for OOM
Not enough memory in a container host free ignores the cgroup limit read the cgroup memory limit
100 percent util equals saturated multi-queue drives need queue depth iostat -x
High iowait equals slow disk possibly NFS or lock contention cat /proc/pressure/io
Container CPU exhausted cgroup quota throttling read nr_throttled in cpu.stat
"It is slow" blames one component find the stall source first read the cpu, memory, and io PSI

One question I ask before calling for a capacity change

Before I ask for a bigger machine I ask: "Is this number high because it is busy, or because it is waiting?" CPU can be high while waiting on a lock, memory can be high and just be cache, and utilization can be high and just be how a multi-queue drive displays. Almost every host misjudgment is reading a "waiting" as a "busy". One command to find the wait source, the D-state count, PSI, queue depth, or %steal, is a hundred times cheaper than adding a machine, and it will not bury the real root cause in application code, lock contention, NFS, or host oversell.

A hard-earned lesson I keep in my pocket

I built this habit after being burned. For a stretch the dashboards were red every day, three metrics taking turns spiking, and every on-call assumed the box was about to die, yet the business side never reported a single slowdown. When I finally compared one busy morning hour by hour, all three "fires" were waiting, not work: the CPU spike was quota throttling driving a retry storm, the 95 percent memory had sixty gigs of cache with forty still available and not one OOM in dmesg, and the iowait was a scheduled batch job writing logs, with await at 1.2 milliseconds. Three red flags, all "waiting".

Since then I have a rule: when any host metric trips, I do not reach for the machine first. I run the matching verification command, the PSI line, dmesg, iostat -x, or the steal figure, and I write down "busy or waiting" before I act. Thirty minutes of verification saves an unnecessary capacity approval and, more importantly, keeps me from burying the real root cause behind a wrong one. The value of a monitor is not turning every number green. It is telling you precisely where it is stuck.

Wiring the Three Signals into Prometheus: from local command to alert rule

This decision logic works well when you run it by hand on the box, but on-call can not log in and type iostat and cat /proc/pressure every time. The real payoff is wiring the same "symptom to metric" mapping into Prometheus so the alert does the "first ask whether it is busy or waiting" for you. Here is the fixed way I hook it up.

CPU: do not alert on load; alert on queueing and on being stolen. Load itself is a poor alert source (D-state pollutes it). Keep node_load1/5/15 for the dashboard, but split the alert into two rules: one fires when node_load5 divided by the core count stays above one (real queueing), and one fires when avg by(instance)(rate(node_cpu_seconds_total{mode="steal"}[5m])) * 100 is above ten percent (you are being stolen from in a virtualized host, so go find the host, not scale out). That way the alert arrives with a built-in direction to look, instead of being yet another "CPU high."

Memory: alert on available, not on used, and pair it with an OOM backstop. The main rule is node_memory_MemAvailable_bytes below five percent of the node's total RAM (fire only under five percent, which is far more accurate than watching used cross 95 percent). Add a hard backstop for OOM events (the delta of node_vmstat_oom_kill, or an event stream), because "available looks fine but a process already got OOM-killed" is the most damaging case and must fire on its own. In containers, move the judgment into the matching cgroup's memory.limit_in_bytes and memory.usage_in_bytes ratio; do not answer with the host's MemAvailable.

Disk I/O: alert on await and on PSI, not on the bare %util value. A lone %util is unreliable on NVMe. Alert on the rate of node_disk_io_time_weighted_seconds_total (weighted queueing, a close proxy for aqu-sz pressure) together with the rate of node_pressure_io_waiting_seconds_total. Keep %util on the dashboard for reference only, out of the alert path. This is the rule change that finally killed the "buy an SSD" misjudgment — once the alert source changed, a naturally-high %util could no longer drag a purchase decision.

Based on a typical production scenario: after wiring the above into a 40-node cluster, over one month the false positives from the "CPU high / memory high / IO high" alert class fell from about six a week to one, and that one was a real fault (a node at eighty percent steal, genuinely an oversold host, resolved by a migration). The two rules that paid off most: the steal rule wrote "go find the host" directly into the alert text for the first time, so on-call no longer had to guess; and the IO rule caught a real write-pressure batch during an await rise, before the business stalled, and let us retune the write cadence in time. The lesson: the value of an alert rule is not "it fires a lot"; it is that every rule carries its own direction, and the "busy or waiting" fork is decided at the rule layer.