Checking Server Load in Linux
As we learned in our article, What is Server Load? there are multiple reasons why you may be experiencing high server load and things you can do to help alleviate the issues. In this article, we will look at the four most common ways of looking at and analyzing server load. Let’s take a look at them:
Option 1:
Run the command:
cat /proc/loadavg
The output should look like this:
root@localhost:~]# cat /proc/loadavg 0.18 0.28 0.30 2/527 4237 root@localhost:~]#
Option 2:
Run the command:
w
The output will look like this:
[root@localhost:~]# w 09:07:09 up 8:18, 2 users, load average: 1.00, 1.00, 1.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root tty1 – 00:52 10:52 0.13s 0.13s -bash root pts/0 192.168.122.1 01:01 0.00s 0.34s 0.00s w [root@localhost:~]#
More on the w command: |
| The w command is also good for seeing the users logged into your server. It will list their IP addresses and how long they’ve been logged in. |
Option 3:
Run the command:
uptime
The output should look like this:
[root@localhost ~]# uptime 09:08:57 up 8:20, 2 users, load average: 1.00, 1.00, 1.00 [root@localhost ~]#
Option 4:
Run the command:
top
This will provide you a listing of the processes running and the time it’s taking to do so. It should look like this:
[root@localhost ~]# top top – 09:10:32 up 8:21, 2 users, load average: 1.00, 1.00, 1.00 Tasks: 93 total, 2 running, 91 sleeping, 0 stopped, 0 zombie Cpu(s): 0.3%us, 0.3%sy, 0.0%ni, 99.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 1030908k total, 934772k used, 96136k free, 76852k buffers Swap: 2064376k total, 0k used, 2064376k free, 711632k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2232 root 20 0 2672 1080 856 R 0.7 0.1 0:00.10 top 1377 nrpe 20 0 5972 1076 688 S 0.3 0.1 0:03.56 nrpe 1649 root 20 0 12476 3460 2708 S 0.3 0.3 0:03.28 sshd 1 root 20 0 2872 1372 1168 S 0.0 0.1 0:00.73 init 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
As with many Linux commands, you can run the command man top to access the manual pages for the top command.
Run the command:
man topNext up, check out our article What is Memory Usage?