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.
Example:
# 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.
Example:
# 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
load1
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 asMemcached, Apc, Xcache, Varnish. For higher speed for your websites, you can go forinstalling Nginx or Litespeed in your servers.
That’s it !! :-)