June 12, 2026 · 5 min read
High CPU on a VPS — common causes and fixes
Sustained high CPU slows every service on the box. Identify the process with top or htop, fix runaway workers or attacks, and scale or optimize before blindly upgrading.
High CPU on a VPS means something is consuming processor time continuously—a runaway process, traffic spike, crypto miner, or inefficient query loop. Find the process first; rebooting without diagnosis often brings the problem back.
Step 1: Identify the consumer
top -o %CPU
# or
htop
ps aux --sort=-%cpu | head -15
Note PID, USER, and COMMAND.
Step 2: Common causes
| Process type | Typical fix |
|---|---|
| App workers (node, php-fpm, java) | Scale workers, fix infinite loop, optimize query |
mysql / postgres | Slow query log, missing index, run EXPLAIN |
find, tar, backup job | Schedule off-peak, ionice/nice |
kdevtmpfsi, unknown miner | Security incident—kill, audit, rotate keys |
| Syn flood / bot traffic | Rate limit at CDN, fail2ban, review access logs |
Step 3: Deeper look at one PID
sudo strace -p PID -c # brief syscall summary—careful on prod
ls -l /proc/PID/exe
cat /proc/PID/cmdline
For web traffic spikes: tail -f /var/log/nginx/access.log and check for abusive IPs.
Step 4: Mitigate now
- Restart only the misbehaving service after you know what it is
- Temporary:
reniceor cgroup CPU limit on non-critical jobs - Long-term: caching, DB indexes, horizontal scale, CDN
Avoid
- Rebooting the whole VPS as step one
- Killing
systemdor database processes without understanding load - Unlimited worker counts in app config on a small VPS
AI-assisted diagnosis
Describe “CPU at 100%” to an AI DevOps Copilot and approve read-only commands first (top, ps, log tails). Ohuriya AI is built for VPS owners who need that workflow safely. Connect · 502 errors
Quick answers
How do I find what is using CPU on Linux?
Run top, then press P to sort by CPU, or use htop. For per-process detail: ps aux --sort=-%cpu | head -15.
Can high CPU cause 502 errors?
Yes. Starved app workers cannot respond—Nginx returns 502. Fix CPU or add capacity, then restart sluggish services.
When should I upgrade my VPS instead of tuning?
When legitimate load consistently exceeds 70–80% CPU after optimization, or when you need headroom for traffic spikes. Profile first—do not pay for a bigger box hiding a bug.