*Cube-Host– full cloud services!!

Linux VPS load monitoring

Linux VPS load monitoring

When a VPS becomes slow, the real cause is almost always one of four bottlenecks: CPU, RAM, disk I/O, or network. This guide shows a repeatable workflow to find the bottleneck quickly using htop, iostat, and atop (plus a few fast “sanity check” commands).

For production workloads, stable monitoring starts with predictable resources. Choose a reliable Linux VPS with enough CPU/RAM and fast storage so your services and diagnostics remain responsive under load.

What You Will Need

  • SSH access to your VPS (root or a sudo user)
  • Debian/Ubuntu or RHEL-based Linux (AlmaLinux/Rocky/CentOS) — commands included for both
  • 5–10 minutes during the incident (or during peak load) to capture real metrics

Connect to Linux VPS via SSH

Open a terminal (macOS/Linux) or an SSH client (Windows Terminal / PuTTY) and connect to the server. Replace username and SERVER_IP with your values.

ssh username@SERVER_IP

If you use a custom SSH port (example: 2222):

ssh -p 2222 username@SERVER_IP

All commands below are executed inside this SSH session.

Quick System Overview (30 Seconds)

Before opening full-screen tools, run a few fast commands. They help you understand whether the issue is CPU, memory pressure, disk saturation, or something obvious like a full filesystem.

uptime
free -h
df -h
ps aux --sort=-%cpu | head -n 10
ps aux --sort=-%mem | head -n 10

How to interpret quickly:

  • uptime: check load average (1/5/15 minutes). If load is consistently far above the number of vCPUs, the system is overloaded.
  • free -h: if RAM is tight and swap is actively used, latency and “freezes” are common.
  • df -h: if a filesystem is 100% full, many services break in strange ways (databases, logs, uploads).

Install and Use htop (CPU & Memory)

1) Install htop

Debian/Ubuntu:

sudo apt update && sudo apt install -y htop

CentOS / RHEL / AlmaLinux / Rocky (some systems may require EPEL first):

sudo dnf install -y htop || sudo yum install -y htop

2) Launch htop

htop
htop interface on Linux VPS

3) How to read the htop interface

  1. CPU bars (top): each bar is a vCPU core. If one or more cores are constantly at 100%, CPU is a likely bottleneck.
  2. Mem / Swap: high RAM usage is normal for Linux (cache), but active swap usage during load usually means latency.
  3. Load average: average runnable tasks over time. A rough rule: if load is consistently much higher than the number of vCPUs, you have CPU contention or I/O wait.
  4. Process table: sort by %CPU or %MEM to identify top consumers.

4) What to do inside htop

  • Press F6 and sort by %CPU to find CPU-heavy processes.
  • Sort by %MEM to find memory consumers.
  • If CPU is low but load is high, you may be stuck in I/O wait — check disk with iostat.
  • Exit: F10 or q.

Checking Disk and I/O with iostat

If CPU and memory look normal but the server is still slow, disk I/O is a very common hidden bottleneck (database writes, logs, backups, overloaded storage).

1) Install iostat (sysstat)

Debian/Ubuntu:

sudo apt update && sudo apt install -y sysstat

CentOS / RHEL / AlmaLinux / Rocky:

sudo dnf install -y sysstat || sudo yum install -y sysstat

2) Run iostat

iostat -x 5 3

Parameters:

  • -x — extended statistics
  • 5 — interval (seconds)
  • 3 — number of reports
iostat output example on Linux VPS

3) Which fields matter most

  • await: average wait time for I/O requests. Large values (tens/hundreds of ms) during load often mean storage saturation.
  • %util: disk busy time percentage. If it stays near 80–100%, the disk is a bottleneck.
  • r/s, w/s, rkB/s, wkB/s: how many operations and throughput you’re pushing.

Pro tip: If you suspect “one process is killing disk,” add iotop to your toolbox:

sudo apt install -y iotop || sudo dnf install -y iotop
sudo iotop -oPa

Analyze Everything Together with atop

atop is great when you need the full picture in one interface: CPU, RAM, disk, and network, plus per-process resource usage.

1) Install atop

Debian/Ubuntu:

sudo apt update && sudo apt install -y atop

CentOS / RHEL / AlmaLinux / Rocky (often via EPEL):

sudo dnf install -y atop || sudo yum install -y atop

2) Launch atop

sudo atop
atop interface example on Linux VPS

3) What to look at in atop

  • CPU and PRC: sustained high load, runnable processes, context switching.
  • mem and swp: memory pressure, swapping, cache behavior.
  • dsk: total disk activity; if it’s high, confirm with iostat.
  • net: network throughput and per-process activity if needed.

Exit atop with q.

Network Checks (When CPU/RAM/Disk Look OK)

Sometimes “slow” isn’t load — it’s network saturation, too many connections, or a service stuck behind timeouts. These commands help validate network conditions.

ss -s
ss -tulpn | head
ip -s link
ping -c 5 1.1.1.1

If you need real-time throughput view:

sudo apt install -y nload || sudo dnf install -y nload
nload

Tip: A very common “hidden” issue is a sudden spike in connections (bots, scraping, brute-force). If you see abnormal connection counts, consider rate limiting and security hardening.

Let’s Put It into One Diagnostic Script

To make Linux VPS load monitoring reproducible, save a simple script that collects key metrics (CPU/memory, top processes, disk I/O snapshot, filesystem usage, and connection summary).

sudo nano /usr/local/sbin/vps-healthcheck.sh

Paste the script below:

#!/usr/bin/env bash
set -euo pipefail

echo "=== TIME ==="
date
echo

echo "=== UPTIME / LOAD ==="
uptime
echo

echo "=== CPU / TOP PROCESSES ==="
ps aux --sort=-%cpu | head -n 10
echo

echo "=== MEMORY ==="
free -h
echo

echo "=== TOP MEMORY PROCESSES ==="
ps aux --sort=-%mem | head -n 10
echo

echo "=== DISK USAGE ==="
df -h
echo

echo "=== DISK I/O (iostat snapshot) ==="
if command -v iostat >/dev/null 2>&1; then
  iostat -x 1 2
else
  echo "iostat not installed (install sysstat)."
fi
echo

echo "=== CONNECTION SUMMARY ==="
ss -s || true
echo

echo "=== LISTENING PORTS (top) ==="
ss -tulpn 2>/dev/null | head -n 20 || true
echo

Make it executable and run it:

sudo chmod +x /usr/local/sbin/vps-healthcheck.sh
sudo /usr/local/sbin/vps-healthcheck.sh

When It Makes Sense to Upgrade Your VPS Plan

If monitoring shows that CPU, RAM, or disk I/O is near the limit most of the time, it’s often more reliable to scale resources rather than constantly fighting symptoms. A more powerful Linux VPS with faster storage and more headroom can eliminate bottlenecks, reduce latency, and make your services stable during peak traffic.

Conclusion

Linux VPS load monitoring becomes easy when you follow a consistent flow: htop for CPU/RAM, iostat for disk I/O, and atop for the full overview. Capture metrics during real load, identify the bottleneck, and then decide whether you should optimize the application/database or upgrade your VPS resources.

Prev
Menu