There was a problem loading the comments.

My VPS Is Slow or Using Too Much CPU

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

If your VPS feels slow or you're getting high CPU usage alerts, here's how to find out what's going on and fix it.

 

Check CPU Usage

Run top to see what's using your CPU:

top

 

Press Shift+P to sort by CPU usage. The top processes are your biggest consumers. Press q to quit.

For a friendlier view, install and use htop:

# Ubuntu/Debian
apt install htop -y

# AlmaLinux/Rocky
dnf install htop -y

htop

 

Note the process name and %CPU of anything using a lot of resources.

 

Check Memory Usage

free -h

 

Look at the available column. If it's very low and swap is heavily used, your VPS is running out of RAM. When the system swaps to disk, everything slows down dramatically.

 

Check Disk Space

df -h

 

If / is above 90% full, your VPS may struggle. Services can fail to write logs or temp files, causing slowness or crashes.

 

Check Disk I/O

If CPU and RAM look fine but the VPS is still slow, disk I/O might be the bottleneck:

# Install and run iotop (shows disk I/O per process)
apt install iotop -y   # or: dnf install iotop -y
iotop

 

Common Culprits

  • Web servers (Apache/Nginx): Too many connections or misconfigured workers. Restart with systemctl restart apache2 or systemctl restart nginx.
  • Databases (MySQL/MariaDB): Heavy queries eating RAM. Consider optimizing queries or increasing your VPS plan.
  • Unattended upgrades: Automatic updates can spike CPU temporarily. Check with ps aux | grep unattended — just wait for it to finish.
  • Crypto miners or suspicious processes: If you see unfamiliar processes using high CPU (names like kworkerds, xmrig, random strings), your VPS may be compromised. Stop the process, change all passwords, and consider reinstalling your OS.
  • Runaway scripts or cron jobs: Check crontab -l for scheduled tasks that might be stacking up.

 

Quick Fixes

# Kill a specific runaway process (find PID from top/htop)
kill -9 PID

# Restart a misbehaving service
systemctl restart SERVICE_NAME

# Clear old logs to free disk space
journalctl --vacuum-size=50M

# Clear temp files
rm -rf /tmp/*

 

If Your VPS Is Consistently Slow

If you're regularly hitting CPU or RAM limits, your workload may have outgrown your current plan. You can upgrade your VPS directly from the VirtFusion panel — upgrades typically take effect within minutes after a reboot.


Share via
Did you find this article useful?  

Comments

Add Comment

Replying to  

© EZSCALE Hosting, LLC