High CPU usage can slow down your server. Here's how to monitor and diagnose it.
Real-Time Monitoring
topPress 1 to see per-core usage. Press P to sort by CPU. Press q to quit.
Snapshot
mpstat 1 5Shows CPU stats every 1 second, 5 times. Install with apt install sysstat.
Find CPU-Hungry Processes
ps aux --sort=-%cpu | head -20Load Average
uptimeLoad averages show system load over 1, 5, and 15 minutes. On a single-core system, a load of 1.0 means 100% utilization. On a 4-core system, 4.0 is 100%.