Saturday, June 13, 2015

Check Current and Past Server Load

What causes high server loads?
Excessive usage of any of the following items can typically cause this issue:

  • CPU
  • memory (including swap)
  • disk I/O
How can I check these items?
That depends you want to review their current resource usage, or historical resource usage.
System Activity Reporter (SAR) is an important tool that shows system admins an overview of the server machine with status of various metrics at different points of time.

To view the load averages for your server from the 23rd of the month:
Code:
[user@technoquick ~]$ sar -q -f /var/log/sa/sa23
'-q' to obtain the load average information, and '-f' to specify which sar file to obtain the information from.
Result:
Linux 2.6.18-348.16.1.el5 (technoquickfix.com)   23/05/2015
12:00:01 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
12:10:01 AM   5         331         0.83      1.20      1.39
12:20:01 AM   7         316         1.20      0.78      1.01
12:30:01 AM   6         317         0.51      0.67      0.84
12:40:01 AM   5         312         0.75      0.62      0.73

Here’s an explanation of the above variables:
“runq-sz” run queue length, which is the number of tasks waiting for run time.
“plist-sz” is the number of tasks in the task list.
“1davg-1″ refers to the system load average over the
 last minute. The load average is calculated as the average number of 
runnable or running tasks (R state), and the number of tasks in 
uninterrupted sleep (D state) over the specified interval.
“ldavg-5″ is the system load average for the past 5 minutes.
“ldavg-15″  the system load average for the past 15 minutes.

Current CPU usage:

Code:
 [user@technoquickfix ~]$ top c 
Tip: hit "P" to sort by processes that currently consuming the most CPU.

Historical CPU usage:
Check the "%idle" column:
Code:
 [user@technoquickfix ~]$ sar -p 

Current memory usage:

Code:
 [user@technoquickfix ~]$ free -m 

Historical memory usage:
This depends on the version of sar, which used to use '-r' to show %memused and %swpused (swap memory used), but later changed to '-S' to show %swpused.
Check "%memused" and "%swpused":
Code:
 [user@technoquickfix ~]$ sar -r 

Current disk I/O usage:

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

Code: 
 [user@technoquickfix ~]$ iostat -x 1 10 

Historial disk I/O usage:
Code:
 [user@technoquickfix ~]$ sar -d 









No comments:

Post a Comment