Monitor WordPress server resources with htop vmstat and iostat

When a WordPress site slows down or goes unresponsive on a VPS, the first step is always to look at what the server is actually doing. Three command-line tools cover the three most common bottlenecks: htop for CPU and memory usage by process, vmstat for a second-by-second view of CPU states, memory, swap, and disk I/O in a single line, and iostat (part of the sysstat package) for detailed disk read/write throughput and I/O wait times per device. Understanding the output of these tools lets you distinguish between a CPU-bound problem (PHP-FPM processes consuming all CPU), a memory problem (the server is using swap heavily because RAM is exhausted), and an I/O problem (MySQL is writing to disk faster than the storage can keep up). htop is an interactive, colour-coded upgrade over the classic top command — it shows per-core CPU bars, a memory bar, a swap bar, and a sortable process list where you can identify which PHP-FPM worker or MySQL query is consuming the most resources. vmstat 1 outputs one line per second and the wa (I/O wait) column is particularly useful — sustained values above 10% indicate a storage bottleneck. iostat -x 1 breaks down I/O by device and shows the %util column (how busy the device is) and await (average milliseconds per I/O request). On WordPress servers the most common cause of high I/O wait is an un-optimised MySQL query doing a full table scan — fix it with the EXPLAIN guide. Combine this monitoring knowledge with the backup guide to ensure you have a snapshot before making infrastructure changes.

Problem: Your WordPress VPS is slow or unresponsive and you need to identify whether the bottleneck is CPU, RAM, swap, or disk I/O without installing monitoring software.

Solution: Use the following commands to get an immediate picture of server resource usage:

# Install tools if not present
sudo apt install htop sysstat -y

# htop — interactive process viewer
# Sort by CPU: press F6, select CPU%
# Sort by RAM: press F6, select MEM%
# Kill a process: select it, press F9, choose signal 15 (SIGTERM)
htop

# vmstat — 1-second interval, 10 readings
# Columns to watch:
#   r  = runnable processes (if > number of CPUs, CPU is saturated)
#   b  = processes blocked on I/O
#   si/so = swap in/out (non-zero = RAM exhausted)
#   wa = % of CPU time spent waiting for I/O (> 10% = disk bottleneck)
vmstat 1 10

# iostat — extended disk stats, 1-second interval
# Columns to watch:
#   %util  = % of time device was busy (> 80% = saturated disk)
#   await  = average I/O wait time in ms (> 20ms = slow storage)
#   r/s, w/s = reads and writes per second
iostat -x 1 5

# Show top MySQL queries in real time (requires MySQL root)
mysqladmin -uroot processlist

# Show PHP-FPM worker status (Nginx + php-fpm)
curl http://127.0.0.1/fpm-status

# Check memory usage summary
free -h

# Check disk space (WordPress sites fill up with uploads + logs)
df -h

NOTE: On a shared server you may not have access to htop or iostat — in that case use top (press M to sort by memory, P for CPU) and cat /proc/meminfo for memory details. If vmstat shows consistent si/so swap activity, your server is out of RAM — the short-term fix is to restart PHP-FPM (sudo systemctl restart php8.1-fpm), the long-term fix is to upgrade your VPS plan or enable WordPress object caching with the object cache guide. After identifying a slow MySQL query via high I/O wait, use the indexes guide to add the right index and resolve the bottleneck.