Check why your server is slow: CPU, memory and disk
Updated 27 Nov 2026
When your site is slow or your server stops responding, the cause is almost always one of three things: the CPU is busy, memory is full, or the disk is full. These commands show which, in a few minutes.
Connect with SSH and run them as a user with sudo.
1. Get the overview
uptime
nproc
uptime shows the load average for the last 1, 5 and 15 minutes. nproc shows how many CPU cores you have. If the load is regularly higher than the number of cores, the server is overloaded.
2. CPU: what's busy?
top
Press P to sort by CPU and M to sort by memory. Press q to quit. In the top lines, look at:
%Cpu(s)us and sy: time spent running programs. High means something is working hard.- wa: time waiting for the disk. Above 10 to 20 most of the time means the disk is the bottleneck, often because memory is low and the server is swapping.
htop is easier to read. Install it with:
sudo apt install -y htop
htop
Note the name of the program at the top: php-fpm, node, mysqld, apache2 and so on. That's where to look next.
3. Memory: is it full?
free -h
Look at the available column, not free. Linux uses spare memory for cache, which is good. If available is under about 10% of the total and Swap used is high, the server is short of memory.
See the biggest users:
ps aux --sort=-%mem | head -n 10
Check whether Linux has been killing programs to free memory:
sudo journalctl -k | grep -i 'out of memory'
If you see lines here, your app was stopped because memory ran out. Add swap as a safety net (see Add swap memory to a small VPS), reduce what's running, or upgrade the plan.
4. Disk: is it full?
df -h
Look at the Use% for /. Above 90% causes trouble; at 100% databases stop and websites break.
Find what's using the space:
sudo du -xh / --max-depth=1 2>/dev/null | sort -h | tail -n 10
Then go one folder deeper, for example:
sudo du -xh /var --max-depth=1 2>/dev/null | sort -h | tail -n 10
Common causes and safe clean-ups:
| What | Clean up with |
|---|---|
| System logs | sudo journalctl --vacuum-size=200M |
| Downloaded packages | sudo apt clean |
| Old kernels and packages | sudo apt autoremove |
| Docker images | docker system prune (removes stopped containers and unused images) |
Don't delete files you don't recognise, especially in
/var/lib. Database files live there. Old backups and log files in your own app folders are usually safe to move off the server.
5. Common fixes
- One app using all the CPU: restart it (
sudo systemctl restart php8.3-fpm, orpm2 restart appfor Node.js) and check its logs for a loop or error. Use the PHP version your server has. - A busy database: slow queries or missing indexes. Check the database's slow query log.
- Sudden high load from strangers: check your web server's access log for floods of requests, and make sure the firewall only allows the ports you need. See Set up a firewall on Ubuntu with UFW.
- Always short of memory or CPU: your site has outgrown the plan. Upgrading is often cheaper than the time spent fighting it.
Need a server? Order a Cloud VPS and get root access within minutes. For help, open a ticket and choose Technical.