# Top processes by CPU usagetop -bn1 -o %CPU | head -20# Alternative using psps aux --sort=-%cpu | head -15
Look for processes consuming a disproportionate amount of CPU. Common causes include runaway scripts, unoptimised database queries, bot traffic, and compromised processes such as crypto miners.
# Memory overviewfree -h# Top processes by memoryps aux --sort=-%mem | head -15
In the free -h output, focus on available memory and swap used. If swap usage is significant, your server is under genuine memory pressure.
Linux uses available memory for disk caching, so high memory usage is not always a problem. The concern is when available memory is very low and swap is being used heavily.
Check application logs, cron jobs, and scripts for the root cause.Database (MySQL / MariaDB)
# Check active queriesmysql -e "SHOW FULL PROCESSLIST;"
Common fixes: add indexes to frequently queried tables, optimise slow queries, tune the InnoDB buffer pool size.Web server under load
# Check active connectionsss -s# Check access logs for spikestail -f /var/log/nginx/access.log
Consider rate limiting, caching, or blocking abusive IPs if traffic is from bots or an attack.OOM killer eventsWhen Linux runs out of memory, the kernel terminates processes to free RAM. Check if this has happened:
dmesg | grep -i oom
If OOM kills are occurring regularly, reduce your application’s memory footprint or upgrade your plan.
If your server consistently runs above 80% CPU or memory usage under normal load after optimisation, the workload has outgrown the plan. See Upgrading Your VPS.