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. You type them in an SSH session: see how to connect from Windows or a Mac.
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 Gi (or G) for gigabytes and Mi (or M) for megabytes. - 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. Check the other lines too: a folder such as/home,/varor/tmpcan be a separate disk with its own line. - Run
df -iand read IUse% on the same lines. This counts files instead of space. A disk can be “full” because it has too many small files, even with gigabytes free.
If any of these figures 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 server may need more RAM. On a VPS, adding RAM is a plan change; on a Virtual Dedicated Server it means moving to a larger configuration. Either way, 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.
- All four readings look normal but the site is still slow: the cause may be in the site itself, such as a plugin or a slow database query, or in a limit set for that one hosting account. Open a support ticket with your readings and the time the site was slow; we’ll tell you what we can do.
- 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.