How to Troubleshoot High Loads on Linux Servers
In this article, We are going to see one of the important server administration job that is system monitoring in regards to CPU load avg.
What is System/CPU Load ?
These numeric values tell you how busy your system’s CPU, memory, and other resources are. It is just a measure of how many process that are working and waiting to work (CPU, memory, and other resources).
These load information are stored in the /proc/loadavg file.
Controlling server loads is important task for server’s administrator. Technical support analysts often receive tickets about high server loads.
Cause of High Server Load :
Excessive usage of any of the following items can typically cause this issue:
- CPU
- memory (including swap)
- disk I/O
How we can troubleshoot the issue ?
There are numerous command line utilities available to analyze present and historical resource usage such as top, sar, iostat etc. Let’s have some briefer lessons about it.
SAR :
SAR stands for System Activity Report. Historical resource usage can be viewed using the “sar” utility. Incase SAR is not installed on your system, you can install it from sysstat utility.
sar logs files are kept under /var/log/sa/saDD, using -f option in sar command we can read the log files.
To view resource usage histories from sar, you must provide the path to the file that corresponds with the date of the stats.
For example, if you wanted to view the load averages for your server from the 2nd of the month, you would run this command:
[root@host ~]$ sar -q -f /var/log/sa/sa2
The command above uses ‘-q’ to obtain the load average information, and ‘-f’ to specify which sar file to obtain the information from. Note that sar may not have historical data going back more than a week or so.
root@host ~]$ sar -q
The sample SAR output will be like this.
Disk I/O usage :
We can get the disk I/O usage using IOSTAT command.
[root@host ~]$ iostat
For more details about SAR command, Kindly refer the SAR man page and official documents.
TOP :
Next we will discuss about, top command. It is a basic Unix command which is very useful to know what is happening in “real time” on your systems.
[root@host ~]$ top -c
From the top command you can find the process which taking more resources on your system. If you don’t want to run the process you can use “kill” command to kill the process.
Memory :
Out of memory on your system also make your server very slow. You can check with below commands.
[root@host ~]$ free -m
Above command figure out your RAM usage.
[root@host ~]$ df -h
Then it gives you disk space usage of your server.
For different issues cause high load on different server. There is no material in the world gives you exact solution for your server issue. Hope this tutorial will give basic coverage of troubleshooting high loads on server.