How to Check Your VPS CPU, Memory and Disk Usage
Over SSH, run top for CPU and the busiest processes, free -h for memory and df -h for disk space. Compare the load average with your number of CPU cores, and look at the “available” memory column rather than “free”.
Applies to: Linux Blue Arctic VPS Hosting and Virtual Dedicated Servers (VDS)
When a site on your VPS is slow, start by checking three things: the processor (CPU), memory (RAM) and disk space. The commands below only read information; they don’t change anything.
CPU: top
Warning
top reacts to single key presses. Press only the keys listed here: Shift+P, Shift+M and q. Some other keys change or stop programs; for example, k can end a process. If top asks you a question you didn’t expect, press Esc.
- Run
nproc. It prints how many CPU cores your VPS has. - Run
top. It fills the window and updates every few seconds; that’s normal. You can press q at any time to leave it. - Read the load average at the end of the first line, for example
load average: 0.52, 0.48, 0.40. These are averages for the last 1, 5 and 15 minutes. Ifnprocsaid 2, a load that stays above 2 means work is queuing. - Press Shift+P to sort by CPU, or Shift+M to sort by memory. The busiest processes are at the top.
- Check two values in the
%Cpu(s)line: wa is time spent waiting for the disk, and st is time your server waited for the physical machine it runs on. If st stays well above 0 for several minutes, note the time and the value and tell us in a support ticket. - Press q to leave top.
One process can show more than 100% CPU; that means it’s using more than one core.
Memory: free
- Run
free -h. The-hshows sizes in easy units, such as G for gigabytes. - Look at the available column, not free. Linux uses spare memory as a cache and gives it back when programs need it, so a small “free” figure is normal.
- Look at the Swap line (swap is disk space used as extra memory). Steady, growing swap use alongside low available memory means the server is short of RAM.
Disk: df
- Run
df -h. Find the line whose last column is/; Use% shows how full the main disk is. - Run
df -iand read IUse% on the/line. This counts files instead of space. A disk can be “full” because it has too many small files, even with gigabytes free.
If either figure is above about 90%, act soon: see how to find large files and fix a full disk.
How to tell it worked
You have four readings: the load average against your number of cores, available memory, and the disk’s Use% (space) and IUse% (files). Note them with the time, so you can compare them when the problem happens again.
Troubleshooting
- One process uses most of the CPU: note its name in the
COMMANDcolumn. Web server and PHP processes often have names likehttpd,litespeed,lsphp,nginxorphp-fpm; databases oftenmysqldormariadbd. A busy or misbehaving site is the usual cause. If one seems stuck, see how to restart a Linux service. - Memory is always low and swap keeps growing: the VPS may need more RAM. Adding RAM is a plan change; open a support ticket to ask about it.
- A process you don’t recognize is busy: don’t stop it yourself. Open a support ticket with its name.
- Your site is down rather than slow: see Website Is Down or Not Loading.
Still need help?
Open a support ticket from the Client Portal at my.bluearctic.com. Our support page explains how the 24/7 helpdesk works. Include your VPS IP address, when it was slow, and the output of uptime (it prints the load average), free -h and df -h. Never include a password or a private key.