One VM sits at 100% CPU and the app on it is slow. How do you find what's actually burning the CPU?

BeginnerTroubleshootingDisk, memory and CPU
Answer

Likely causes → A hot loop, a regex or JSON parse on huge input, a GC storm, a crypto-miner on a compromised box, or simply more traffic than the box can handle.

Diagnose → Narrow from process to thread to function:

top -c                         # which process; check us vs sy vs st
pidstat -u -p <pid> 1 5
top -H -p <pid>                # which thread
sudo perf top -p <pid>         # which function (native)
py-spy top --pid <pid>         # Python
jcmd <pid> Thread.print        # Java: match hot thread id in hex (nid)

An unknown process name or binary in /tmp means treat it as a security incident.

Fix → Roll back if a deploy introduced it, scale out if it's real load, or kill and fix the runaway job.

Prevent → Per-process CPU metrics (process-exporter), continuous profiling (Pyroscope, Parca), and CPU alerts based on saturation, not single spikes.

All Real-World Interview questions Roadmap: Interview readiness

More on Disk, memory and CPU