Operations 14 min read

How to Diagnose and Fix High CPU, Memory, and Disk I/O Issues on Linux VPS

This guide explains the most common Linux VPS performance problems—CPU overload, memory exhaustion, and disk I/O bottlenecks—and provides step‑by‑step commands and optimization techniques to monitor, troubleshoot, and resolve them efficiently.

Cognitive Technology Team
Cognitive Technology Team
Cognitive Technology Team
How to Diagnose and Fix High CPU, Memory, and Disk I/O Issues on Linux VPS

Linux is known for stability, security, and efficiency, making it the ideal choice for virtual private servers (VPS) even under high load.

Linux includes powerful native tools such as top, htop, vmstat, and sar that can monitor system resources in real time and help locate performance bottlenecks before a VPS becomes unresponsive.

Basic commands for troubleshooting common Linux issues

top

– real‑time display of CPU, memory usage and processes free -m – show memory allocation and consumption in megabytes df -h – report disk space usage in a human‑readable format du -sh /path/to/directory – view disk usage of a specific directory sar – collect and report historical system activity

The “three killers” (CPU, Memory, Disk I/O)

CPU usage – reflects available compute capacity

Memory (RAM) usage – higher usage reduces the number of concurrent processes

Disk I/O – determines read/write speed

If these three are not continuously monitored and tuned, performance will degrade.

Using top to check CPU usage

High CPU load makes the server sluggish, increases response time, and can cause applications to become unresponsive.

Typical symptoms of high CPU usage

Web pages load slowly or time out

SSH becomes laggy or unresponsive

Processes queue, causing execution delays

Even simple commands run extremely slowly

How to view CPU usage

Run top and focus on the %CPU column (percentage of CPU per process) and the Load Average values (1, 5, 15‑minute averages). If the load average stays above the number of CPU cores, the system is overloaded.

Identify the offending process

In the %CPU column, locate the process consuming the most CPU.

ps -eo pid,ppid,cmd,%cpu --sort=-%cpu | head

How to reduce high CPU usage

a) Find and terminate abnormal processes kill -9 <PID> or restart the corresponding service: systemctl restart <service> b) Limit CPU usage of known heavy processes cpulimit -P /usr/bin/apache2 -l 50 c) Optimize the application

Use caching (e.g., Redis) to reduce unnecessary computation

Rewrite scripts to lower CPU consumption

Disable unnecessary background processes

d) Upgrade CPU resources

If the VPS frequently experiences high CPU load, consider upgrading to more cores.

Memory usage: the server’s “short‑term memory”

RAM allows a VPS to run multiple processes concurrently. When memory is exhausted, the system swaps to disk, which is much slower than physical memory.

Typical symptoms of high memory usage

High swap usage (e.g., free -m shows very little free memory)

OOM (out‑of‑memory) errors and processes being killed

Applications like MySQL or PHP become noticeably slower

Frequent swapping causes a spike in disk I/O

How to view memory usage

Use free -m:

total        used        free      shared  buff/cache   available
Mem:          4096        3800         296        100         512        500
Swap:         2048        1980          68

When available is less than 500 MB, memory is tight; high swap indicates reliance on slow disk memory.

Real‑time view with top or htop shows the most memory‑hungry processes at the top.

How to reduce high memory usage

a) Find and terminate memory hogs

ps aux --sort=-%mem | head -10
kill -9 <PID>

b) Clear caches safely sync; echo 3 > /proc/sys/vm/drop_caches c) Increase swap space

dd if=/dev/zero of=/swapfile bs=1M count=2048
mkswap /swapfile
swapon /swapfile

d) Optimize the application

Tune PHP and MySQL memory‑related settings (e.g., my.cnf)

Periodically restart services to fix memory leaks systemctl restart apache2 e) Upgrade RAM

If memory shortage persists, upgrade the VPS memory plan.

Disk space issues

Disk I/O determines the read/write speed of VPS storage. Slow databases, file transfers, and application loads are often linked to disk performance problems.

Typical symptoms of high disk I/O

File reads/writes are extremely slow

Database response times increase top or vmstat shows high wa (I/O wait)

Frequent “disk full” errors

How to view disk I/O usage

a) Monitor disk usage df -h Usage above 90 % requires cleanup

Find the largest directories with du -sh /* b) Check I/O performance iostat -x 5 10 Pay attention to await and %util; %util > 80% indicates heavy disk pressure.

How to reduce high disk usage

Delete unnecessary files find / -type f -size +500M Clean logs rm -rf /var/log/* Optimize disk I/O

Enable MySQL query cache to reduce reads/writes

Use tmpfs for temporary directories

Serve static files via CDN to lower disk read pressure

Upgrade to SSD If still using HDD, switching to SSD dramatically improves VPS speed.

Step‑by‑step troubleshooting guide

When a VPS reports errors, systematic investigation is preferred over blind restarts or upgrades.

Step 1: Validate resources

SSH into the server: ssh user@your-server-ip Run top and watch %CPU and %MEM; high values indicate processes to optimize or restart.

Use vmstat 5 10; high wa points to disk bottlenecks.

Check disk usage: du -sh /* and clean old logs or unused files if the disk is full.

Optimize applications first; if resources remain tight, consider upgrading the VPS plan.

Step 2: Diagnose network issues

Check network interface: ip addr show Inspect firewall status: sudo ufw status and allow needed ports if blocked.

Deep‑inspect iptables: sudo iptables -L -n -v Ping to test connectivity: ping -c 5 google.com Restart networking service: sudo systemctl restart networking Port scan: nmap -p <port_number> your-server-ip Confirm service is running: sudo systemctl status apache2 These steps resolve most connectivity problems.

Step 3: Long‑term stability and security hardening

Update system and software: sudo apt update && sudo apt upgrade -y Use SSH key authentication:

ssh-keygen -t rsa
ssh-copy-id user@your-server-ip

Configure UFW firewall:

sudo ufw allow ssh
sudo ufw allow http
sudo ufw enable

Install fail2ban to prevent brute‑force attacks:

sudo apt install fail2ban -y
sudo systemctl start fail2ban

Regular backups:

rsync -avz /your/data/path user@backup-server:/backup/location

How these troubleshooting techniques solve problems

Reducing CPU usage lowers response latency.

Freeing memory keeps applications running smoothly.

Optimizing disk I/O maintains system stability.

Continuous monitoring catches issues early.

Regular maintenance and systematic troubleshooting are key to keeping a Linux VPS efficient and responsive.

Conclusion

VPS problems are inevitable, but mastering these methods lets you quickly resolve CPU overload, memory exhaustion, disk saturation, and network failures, ensuring your VPS remains stable and fast.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PerformanceTroubleshootingVPS
Cognitive Technology Team
Written by

Cognitive Technology Team

Cognitive Technology Team regularly delivers the latest IT news, original content, programming tutorials and experience sharing, with daily perks awaiting you.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.