Load monitoring in Linux servers – top, w and uptime commands’ usage for checking the load on server

Is it necessary to monitor the load on the server?

Yes, it is necessary to check the load-average on your server for it better and stable performance. In a Linux server/system we can check the load by different ways. High load on the server cause performance degrade. That means if you have a shared server with overload, the website on that server will load slowly normally.

We have discussed different online downtime monitoring tools for you website recently. You will get more details from here >> Online monitoring tools for your server/websites <<

Load expresses the number of processes that are in the queue to access the processor. It is calculated over a period of time and smaller the number is better.

In Unix/Linux, load can be calculated by any of the following commands.

# top
# w
# uptime

Load average is usually expressed in 3 numbers.


# w
 05:40:18 up 3 days, 18:23,  2 users,  load average: 1.11, 1.83, 1.98
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    65.555.555.550     05:06    0.00s  0.10s  0.00s w
root     pts/0    65.555.555.550     03:06    0.00s  0.30s  0.00s bash

Uptime gives a one line display which represents current time, how long the system has been running, how many users are currently logged on and the system load averages for the past 1 minute, 5 minutes and 15 minutes respectively. For the last 5 minutes, average load was 0.10 and for the last 15 minutes, average server load was 0.11.

# uptime
 11:34:15 up 3 days, 12 min,  2 users,  load average: 0.06, 0.10, 0.11

How much server load is acceptable?

Server load or Load is actually CPU load. This value shows how your processor is coping up with the tasks it needs to do. Larger the value of server load indicates a poor measure for server’s performance.

Single core processor

Ideal load for a single processor server is 1 which means that the processor is handling all the tasks in a well ordered manner and there is no process waiting in the queue. The higher the server load goes, processes get queued. This actually doesn’t means that when the server load goes over 1, the server starts failing. Server load under 10 may not result in server failure.

Multiple processors and server load

For servers with multiple processors load is calculated by dividing the actual load by number of CPUs.

Server load = Actual load/Number of CPUs

Ideal load for a single core processor is 1, 2.00 on a dual core and 4 on a quad-core etc

Load get evenly distributed among the different processors in case of a multiprocessor server. In case if one processor is busy, the task will be handled by other processor.

How the server gets overloaded?

Higher loads are caused by different reasons. Now-a-days, almost 90% of the users have database driven websites. When such websites have lot of visitors, then the number of database connections increases which results in high load. If your users have any Ecommerce website with a lot of visitors, then your server laod goes high. Also, some website scripts may also consume more CPU resurces which may result in server load.

In some other cases, spamming results in server load. You can check whether spamming is going on in the server by using the commands given below:

# exim -bpc -- to view the number of emails in the queue
# exim -bp -- emails that are currently in queue

If you found frozen emails in queue, then there is a chance of spamming going on in the server.

Also, cPanel backup or cPremote backup may cause the server to over load. You can set the cron for backup to run at very convenient time that is at server off-peak hours to reduce the load.

In certain cases, RAID re-build may also cause the server to overload.

You can monitor your server using the “top” command.

# top -c


You can kill the process which is consuming high CPU resource.

# kill -9 PID

If PHP processes are consuming more CPU resources, you can use

# killall -9 php

Then, you need to restart Apache

You can kill httpd, if Apache is consuming high resources

# killall -9 httpd
# /etc/init.d/httpd restart

You can also check the number of connections from an IP address currently connected to the server. Connections upto 100 are treated as normal.

# netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

In this command if you find an abnormal connection to the server, that is connections above 100. In that case you can block the IP address which have 100+ connection to the server.

You can block the IP address in server firewall that is, in CSF, APF or Iptables.

In the servers where PHP consumes more reource, you can install caching methods such as Memcached, Apc, Xcache, Varnish. For higher speed for your websites, you can go for installing Nginx or Litespeed in your servers.

One another, more close to grahical method is available there called HTOP. The use of htop is quit similar to top, but here we can control the result by using mouse also. Here is the link which will help you to install and configure HTOP >> Htop installation and usage <<

You can simply execute the command “htop” to view more dynamically the processes and resource usage on server.

# htop

See the sample output


That’s it !! 🙂

Related Link
Load and memory usage monitoring with help of “sar” command.

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

14 Responses

  1. Pranavkrishna says:

    Good article. Very useful.

  2. ernest says:

    excellent article!. Thanks!

  3. Per Qvindesland says:

    Nice article thanks.

  4. Boki says:

    Great article… would love to see one in which you would explain how to identify which domain and exactly which file is causing overloads on server. I’m a newbie on WHM / CentOS and currently I can find when problems occur with sar -q -f /var/log/sa/saXX command, but don’t know how to identify what is causing the overload at that time (which user/domain, file etc.)…

  5. pankaj says:

    Nice article but I have one doubt
    Server load = Actual load/Number of CPUs
    It means for a multiprocessor architecture the server load must be 1 for ideal condition according to formulae but it is 1,2 or 4 for single, dual and quad core processor.
    May be I am wrong, What is ””Actual load in formulae”

  6. brijesh Kumar says:

    Appreciated .. Nice document

  7. Short Bio says:

    how can i check how much bandwidth i’ve been using per month ?

  8. Mostafa says:

    Thanks, it’s a good doc.

Leave a Reply

Your email address will not be published. Required fields are marked *