Diagnosing a slow VPS starts with one question: is the bottleneck CPU, memory, or disk? Guessing wrong wastes an afternoon tuning the wrong thing, and on a small server the three bottlenecks feel alike from the outside. A slow page can mean a busy CPU, a swapping database, or a disk that cannot keep up, and each one has a different fix. This walkthrough uses three tools you already have, htop, iotop, and vmstat, to find which one it is in about ten minutes.
Run the checks in order: CPU first, then memory, then disk. The order matters because a memory problem looks like a CPU problem and a disk problem looks like both. If you have not measured your server before, this guide to checking VPS resource usage with htop, df, and free covers the basics, and this walkthrough of monitoring disk, RAM, and CPU usage with htop and Glances shows how to watch all three together over time.
Diagnosing a Slow VPS: Start with htop and the CPU
Open htop and look at the load average in the top right, not just the CPU bars. The load average shows three numbers: the last minute, the last five minutes, and the last fifteen minutes. On a 2-core VPS, a load of 2 means the CPUs are fully busy. A load of 4 means twice as much work is waiting as the CPUs can handle. A load that stays above the core count for fifteen minutes is a real bottleneck, not a spike.
Next, sort by CPU with the P key and look at the top rows. A single process using 100 percent of one core is normal for a busy worker; eight processes each using 25 percent means the load is spread out. Press H to collapse threads into their parent process, which makes the picture clearer: a PHP-FPM pool shows as one entry instead of fifteen workers.
Watch the CPU states in the header. A high sy value means the kernel is busy, which often points to too many small files being opened or too many network connections. A high wa value means the CPU is waiting on disk, which is not a CPU problem at all, it is a disk problem wearing a CPU costume. That distinction is why you check the disk next instead of buying a bigger CPU.
If one process dominates the CPU, find out what it is doing before you kill it. A backup job at 3 a.m. is expected. A PHP worker stuck at 100 percent for an hour is a runaway script or an infinite loop, and the fix is in the code, not in the server size.
Memory: The Number That Lies to You
Run free -h and read the available column, not the free column. Linux uses spare memory as disk cache, so free is almost always low on a healthy server. Available is the memory you can actually use. If it sits under 200 MB on a 2 GB VPS, the server is close to trouble, and if it hits zero, the kernel starts killing processes.
Then run vmstat to see whether the server is swapping:
vmstat 2 5
The si and so columns show swap in and swap out, in kilobytes per second. Zeros mean no swapping, which is good. Steady numbers above zero mean the server is moving memory to disk and back, which is slow: disk is orders of magnitude slower than RAM, so a swapping database feels like a broken database. The fix is less memory use, not more swap. Lower a buffer pool, shrink the PHP-FPM worker count, or move a service off the box.
The r column in vmstat shows how many processes are waiting for CPU, and the b column shows how many are blocked on disk. A high b with low CPU use is a disk bottleneck. A high r with high CPU use is a CPU bottleneck. Those two columns, read together, tell you more than the load average alone.
If memory is the problem, the next step is finding which process uses it, which is a separate job with its own tools. A database with a buffer pool that is too big and a PHP pool with too many workers are the two usual suspects on a small VPS, and both have tuning guides: the database side in this MySQL 8.4 tuning guide for a 2 GB VPS and the PHP side in the PHP-FPM tuning guide.
Disk: iotop Shows Who Is Writing
Disk slowness hides behind everything else, because a slow disk makes the CPU wait and makes memory look full. Install iotop if it is not already there, then run it with the option that shows only processes doing I/O:
sudo apt install -y iotop
sudo iotop -o -P
The -o flag hides idle processes, and -P shows processes instead of threads. The two columns to watch are DISK READ and DISK WRITE. A backup job writing hundreds of megabytes is expected. A database writing constantly at a high rate is not, and it usually means the buffer pool is too small and the database is flushing to disk too often, or a log is growing without rotation.
Check the disk itself with df -h and df -i. The first shows space, the second shows inodes. A disk that is full stops writes entirely, and a disk that is out of inodes does the same thing while df -h still shows free space. Both failures look like a broken app from the outside. A log file that grew to tens of gigabytes is the usual cause, and du -sh /var/log/* finds it in seconds.
For a baseline of what the disk can do, this guide to testing VPS disk and network speed shows how to measure read and write speed. A VPS on a busy host can have a disk that is slow for everyone, and no amount of tuning fixes a noisy neighbor. If the baseline is bad and the provider cannot fix it, moving to a different host is the honest answer.
Put the Three Tools Together
A real diagnosis uses all three tools in one pass. Open three terminal windows or use tmux: htop in one, vmstat 2 in the second, and iotop -o in the third. Then load the site or reproduce the slow request and watch what changes.
The pattern tells you the answer. CPU bars full, load above the core count, vmstat r high, and iotop quiet means a CPU bottleneck: a slow query, a heavy plugin, or a worker pool that needs tuning. Memory available near zero, vmstat si and so above zero, and a database at the top of htop means a memory bottleneck: shrink a buffer pool or a worker pool. CPU waiting on disk, vmstat b high, and iotop showing heavy writes means a disk bottleneck: a log, a backup, or a database flushing too often.
Write down the numbers before and after each fix. A load average of 4.2 before and 1.1 after is evidence the fix worked. A feeling that the site is faster is not evidence, and it will not help you the next time the same problem appears. Keep a short note with the date, the symptom, the numbers, and the fix. The next slow VPS will be diagnosed in minutes instead of hours, because you will recognize the pattern.