How to Monitor and Fix the Server Load

What is Server Load?

Website owners and users will be familiar with the computing term “Load”. In Unix computing, the system load is a measure of the amount of computational work that a computer system performs. The load average represents the average system load over a period of time. It conventionally appears in the form of three numbers which represent the system load during the last one-, five-, and fifteen-minute periods.

 

What are the causes of Server Load?

The server load can be caused by the excessive usage of the system resources. Excessive usage of the CPU or Memory or Disk Space can lead to the server load.

 

How to check the Server Load?

There are many ways to check the server load. The commonly used command to view the server load is ‘top‘ but ‘top‘ command displays the processes running dynamically. It needs resources a bit more when comparing to other methods. So normally, when a server is under high load, the usage of ‘top‘ command is not encouraged. We can view the server loads by using the following commands ‘w‘ and ‘uptime‘.

server load

        Viewing Server Load using ‘w’ and ‘uptime’ commands

server load

        Monitoring Server Load with the ‘top’ command

These are the ways to check the Server Load. As we can see, while using the top command, it will give a dynamic output which means the output screen will be updated within certain time intervals and so that we will be able to see the load and processes with the resource usage instantly.

In the output of the ‘top‘ command, on the line that says “Cpu(s)”, check the “%id” section which shows the percentage of which your CPUs are idle. The higher the number the better the situation. A 99% idle CPU is not doing much of anything, and a 1% idle CPU is heavily tasked. We can sort the output by processes that are currently consuming the most CPU by hitting ‘p’.

We can use the ‘top c‘ command also to view the current CPU usage.

Check the Memory Usage

The next step is checking the RAM. Run the following command to view the current memory usage.

server load

        Using ‘free -m’ command to monitor the Physical Memory usage

Check the Current disk I/O usage

We can check the current disk usage by running the following command.

# iostat -x 1 10

Please keep in mind that this will not work on OpenVZ/Virtuozzo containers.

This will print the disk usage statistics 10 times, every 1 seconds. Check the %util column.

Check the Process List

You can view the process list with the help of the following command.

# ps auxf

server load

This will help to identify which process is consuming more resources.

These are the methods used to identify the Server Load by monitoring the system resources. Once the Server Load is identified, we can troubleshoot it easily by taking appropriate actions.

Posted in Hosting Article.