A slow VPS almost always has a specific root cause: CPU saturation, exhausted memory, a full disk, or network congestion. The key is identifying which one before applying any fix. This guide walks you through the diagnostic process step by step with the exact Linux commands you need.
1. Quick Diagnosis: Which Resource Is the Bottleneck?
Before changing any configuration, run these three commands for an immediate overview:
top # shows CPU usage and running processes
free -h # shows RAM and swap usage
df -h # shows disk usage
With that information, you can pinpoint the bottleneck in under a minute. Let's go through each scenario.
2. CPU at 100%: Causes and How to Bring It Down
Excessive CPU consumption is the most common reason a VPS feels slow. Typical symptoms include web pages taking seconds to load, SSH commands responding with a lag, and a load average significantly higher than your server's vCPU count.
Identify the Culprit Process
top -b -n1 | head -20
Sort by the %CPU column. On web servers, PHP-FPM, MySQL/MariaDB, and Apache/Nginx are the usual suspects. A poorly optimized PHP script or a query missing an index can consume all available CPU on its own.
Solutions by Process
- PHP-FPM with too many active workers: reduce
pm.max_childrenin the relevant pool and adjustpm.max_requeststo free stuck processes. - MySQL/MariaDB with slow queries: enable the slow query log (
slow_query_log = 1,long_query_time = 1) and add indexes to columns appearing in your slowest queries. - Unknown process consuming CPU: investigate with
ps aux --sort=-%cpu | head -10. If it looks like malware or a zombie script, kill it withkill -9 PID. - Structurally high load average: consider upgrading to a VPS plan with more vCPUs.
3. RAM Exhausted and Active Swap: Signs and Fixes
When physical RAM fills up, the OS starts using swap — disk space used as emergency memory. The problem is that disk is orders of magnitude slower than RAM, making your server noticeably sluggish.
Detect Active Swap
free -h
vmstat 1 5 # watch the "si" and "so" columns (swap in / swap out)
High values in si and so mean the server is swapping constantly.
Find Which Processes Are Using the Most RAM
ps aux --sort=-%mem | head -10
Fixes
- MySQL/MariaDB: set
innodb_buffer_pool_sizeto no more than 70% of available RAM. - Apache with prefork MPM: reduce
MaxRequestWorkers. Consider switching to event MPM + PHP-FPM for a more memory-efficient model. - Application with a memory leak: restart the affected process as a temporary fix and track down the leak in the code.
- Genuinely insufficient RAM: upgrade your VPS plan. 1 GB RAM is a practical ceiling for a WordPress site with moderate traffic; 2–4 GB is the comfortable range for most use cases.
For more optimization strategies, visit our VPS servers resource hub.
4. Full Disk or Slow I/O: How to Identify It
A disk at 100% capacity prevents the system from writing logs, temp files, or session data — causing errors and severe slowdowns. Slow I/O can degrade performance even when free space is available.
Check Available Space
df -h
du -sh /* 2>/dev/null | sort -rh | head -10
Detect I/O Bottlenecks in Real Time
iostat -x 1 5 # requires sysstat installed
iotop # shows which process is reading/writing the most
Space-Freeing Solutions
- Clean old logs in
/var/log(compress or delete logs older than 30 days). - Clear package caches:
apt cleanon Debian/Ubuntu,dnf clean allon RHEL. - Remove temp files:
rm -rf /tmp/*and/var/tmp/*(carefully). - If the issue is structural, expand the disk volume from your provider's control panel.
Improve MySQL I/O Performance
For databases on standard HDD or SSD, increasing innodb_buffer_pool_size reduces physical disk reads and noticeably improves performance.
5. Slow Network or High Latency
If the server responds well internally but users report slowness, the problem may be network-related: latency to the datacenter, saturated bandwidth, or packet loss.
Network Diagnostic Tools
| Tool | What it measures | Command |
|---|---|---|
| ping | Latency and packet loss | ping -c 20 yourdomain.com |
| mtr | Route and per-hop latency | mtr yourdomain.com |
| iftop | Bandwidth usage per connection | iftop -i eth0 |
| ss / netstat | Active connections and TCP state | ss -tunapl |
If iftop shows an external IP consuming all your bandwidth, you may be under a volumetric DDoS attack or have an abusive client. Block that IP with UFW and contact your provider to enable DDoS mitigation if the attack persists.
Is your VPS still slow after applying these fixes? The team at elenlace.com performs professional performance diagnostics and server optimization so your site responds at the speed it deserves.
Key Takeaways
- Always diagnose before acting: use
top,free -h, anddf -hto locate the saturated resource. - High CPU: identify the culprit process and optimize the app, or scale vCPUs.
- RAM exhausted with active swap: tune MySQL/Apache settings or increase memory.
- Full disk: clean logs and temp files, expand the volume if the problem is structural.
- Slow I/O: use
iotopto find the process saturating the disk. - Network latency: use
mtrto pinpoint the problematic hop and block abusive IPs. - If the problem persists, your VPS plan may have outgrown your current traffic level.
Need a professional server diagnosis? Reach out to elenlace.com and we will solve the performance issue without you touching a single command line.
FAQ
Why is my VPS slow even though traffic is low?
Slowness is not always related to external traffic. Internal processes such as scheduled backups, misconfigured cron jobs, PHP scripts with infinite loops, or a nearly full disk can saturate resources even when very few visitors are online at that moment.
How much RAM does a WordPress VPS need?
A WordPress site with active caching (WP Rocket, W3 Total Cache) and moderate traffic runs fine on 1–2 GB RAM. If you use WooCommerce, have heavy plugins, or experience traffic spikes, 2–4 GB is the recommended range to avoid swap.
Is it better to scale the VPS or optimize the application?
Optimize first. A missing SQL index or a misconfigured PHP-FPM pool often consumes 10x more resources than necessary. Scale when optimization is no longer sufficient for the legitimate user load.
Does disk type (HDD vs SSD vs NVMe) affect VPS speed?
Yes, significantly. An NVMe VPS can have disk latencies 5–10 times lower than an HDD-based one. If your application is I/O intensive — heavy database reads/writes or frequent file access — disk type has a direct impact on the speed your users experience.
Useful resources
Other providers and guides worth comparing: