Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Linux

Why is my VPS slow? Find the bottleneck step by step

Why a VPS feels slow and how to prove it: CPU steal, memory pressure, disk waits, network and DNS, the application and Windows RDP, with commands to check.

CloudSat teamNovember 18, 20267 min read
A speedometer drawn in thin glowing lines with its needle resting low, and small server blocks queued behind it
On this pagePin down what "slow" means

"The server is slow" can mean a dozen different problems, and the fix for one does nothing for the others. A bigger plan will not cure a slow DNS resolver, and a faster disk will not help a single-threaded process that has maxed out its core. The way through is to name the symptom precisely, then measure one resource at a time: CPU, memory, disk, network, and finally the application. The commands below run on any current Linux distribution; a short section at the end covers Windows servers.

Pin down what "slow" means

Write down what is slow, for whom and since when. Typing lag in SSH points at the network or a saturated CPU. Slow pages with a responsive shell point at the web stack or the database. A slow remote desktop has its own causes. Then time a request from your own computer, and again from the server itself:

curl -o /dev/null -s -w 'dns %{time_namelookup}s  connect %{time_connect}s  tls %{time_appconnect}s  first byte %{time_starttransfer}s  total %{time_total}s\n' https://shop.example.com/

If the first byte arrives late from both places, the server is slow to answer. If it is quick from the server but slow from your desk, look at the network and the distance between you and the server.

A two-minute first look

nproc                 # number of vCPUs
uptime                # load averages over 1, 5 and 15 minutes
top                   # press 1 for per-core lines; watch us, sy, wa and st
free -h
df -h && df -i

A load average well above the vCPU count means work is queueing. On Linux the load also counts processes waiting for disk, so a high load with idle CPUs points at storage. On the CPU line of top, us and sy are time spent running code, wa is time spent waiting for I/O, and st, steal, is time the hypervisor gave your vCPU to another guest.

CPU: busy, or waiting its turn?

mpstat -P ALL 1 5     # per-core usage, from the sysstat package
vmstat 1 10           # the st column shows steal over time
ps -eo pid,user,%cpu,%mem,etime,cmd --sort=-%cpu | head -n 15

One core at 100% while the others idle means a single-threaded bottleneck: a Node.js process, a PHP worker, Redis or a game server loop. More vCPUs will not help it, while a faster core will, as the guide to cores and clock speed explains. All cores busy means real demand, or a runaway process. Steal that stays high for long periods means the host is contended; collect the numbers with sar and raise them with your provider.

Be suspicious of a process you do not recognize holding a core at 100%, especially one started from /tmp or /dev/shm with a random name. Cryptocurrency miners are a common payload after a break-in. Treat it as a security incident: check crontabs, systemd units and ~/.ssh/authorized_keys before you kill anything, and rebuild from a clean image if you find intrusion.

Memory: the slow kind of full

free -h shows plenty of used memory on any healthy server, because Linux fills spare RAM with cache. The figure that matters is available. Then check whether the system is swapping or killing processes:

vmstat 1 5                                   # si and so above zero, again and again, mean active swapping
journalctl -k | grep -iE 'out of memory|oom-kill'
cat /proc/pressure/memory /proc/pressure/io  # time tasks spent stalled, where the kernel exposes it

Constant swapping makes everything slow at once. Cap the biggest consumers first, such as PHP-FPM's pm.max_children, a database buffer pool or a Java heap, and add memory only when the workload truly needs it. Swap is a cushion against out-of-memory kills, not extra RAM.

Disk: waits and full volumes

iostat -xz 1 5        # r_await and w_await in ms, aqu-sz, %util per device
pidstat -d 1 5        # which processes read and write
sudo iotop -o         # live view, if installed

Rising r_await and w_await with modest throughput mean requests are queueing. A full filesystem is worse: writes fail, logs stop and databases stall, so check df -h and df -i and see what fills a Linux disk. The usual culprits are logs without rotation, backups or database dumps that run during busy hours, and swap on a disk that is already busy.

Network: distance, loss and DNS

From your computer, mtr -rwc 100 203.0.113.10 shows latency and loss for each hop. Only loss that continues to the final hop is real; a router in the middle that drops some probes but passes traffic on is just rate-limiting its replies. To measure throughput, run iperf3 -s on the server and iperf3 -c 203.0.113.10 -R from your machine, then repeat without -R for the other direction.

Slow name resolution hides well, because it adds delay to every outgoing call the application makes:

time getent hosts api.example.com
resolvectl status | grep -A2 'DNS Servers'

If a lookup takes hundreds of milliseconds, fix the resolver configuration or run a local caching resolver. Distance cannot be tuned away: a server far from its users adds the same delay to every request, so place it near them or put a CDN in front of static content.

The application itself

When the system looks healthy, the slowness is inside the software:

  • Web servers: add $request_time and $upstream_response_time to the Nginx log format to see which URLs are slow and whether the wait is in Nginx or the backend.
  • Databases: turn on the slow query log (slow_query_log with long_query_time in MySQL and MariaDB, log_min_duration_statement in PostgreSQL) and fix the worst queries, usually with an index.
  • Worker pools: "server reached pm.max_children setting" in the PHP-FPM log means requests wait for a free worker.
  • Scheduled jobs: systemctl list-timers and crontab -l reveal backups, updates and reports that all start at the same minute.

Windows servers and remote desktop

Task Manager shows CPU, memory and disk per process, and Resource Monitor (resmon) adds disk queue length and per-file activity. For numbers you can log:

Get-Counter '\Processor(_Total)\% Processor Time','\Memory\Available MBytes','\PhysicalDisk(_Total)\Avg. Disk sec/Transfer' -SampleInterval 2 -MaxSamples 5

The usual suspects are Windows Update, Defender scans and search indexing running during working hours; schedule Windows Update for quiet times. If the desktop itself feels sluggish while counters look fine, the remote session is the bottleneck: allow UDP 3389 so RDP can use its faster transport, lower the color depth and turn off the wallpaper and animations on weak connections.

Fix in order of cost

Finding Try first Then
One core pegged Cache or optimize the hot code path A plan with faster cores
All cores busy Find and limit the consumer More vCPUs
High steal for hours Send the evidence to your provider Another plan or region
Swapping Cap the biggest memory users More RAM
Disk waits Move backups and heavy jobs off-peak Faster or larger storage
Users far away Caching and a CDN A region near the users
Slow DNS A local caching resolver A different upstream resolver

On CloudSat, a resize moves a server to a bigger plan after a short reboot, and High Frequency plans run on AMD Ryzen cores at 4.2 GHz or more for single-threaded work. The network page estimates the distance from you to each of the 13 regions.

FAQ

How much steal time is too much?

A few percent now and then is normal on shared hosts. Steal that stays in double digits for hours means your vCPUs wait for real CPU time, and your provider should hear about it.

Will adding swap make the server faster?

No. Swap prevents out-of-memory kills during short peaks, but a server that swaps constantly is slower than one with enough RAM. Reduce memory use or add memory instead.

The server is fast now but was slow at 2 AM. How do I catch it?

Install a monitoring agent that keeps history, such as the sysstat collector behind sar or a full monitoring stack, so the next slow period leaves evidence you can read the next morning.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.