Sunday 1 March 2015

Troubleshooting high loads on Linux servers

The load average represents the average number of processes that have to wait for CPU time during the last 1, 5 or 15 minutes.

What causes high server loads?

Excessive usage of any of the following items can typically cause this issue:

memory (including swap)
disk I/O

How can I check these items?

That depends whether you want to review their current resource usage, or historical resource usage.

Historical resource usage can be viewed using the "sar" utility.

The stats are collected when sysstat runs from cron (/etc/cron.d/sysstat). If crond is not running, sysstat will not be able to collect historical statistics.

or example, if you wanted to view the load averages for your server from the 28rd of the month:
sar -q -f /var/log/sa/sa28

the current day status: sar -q
Current CPU usage: top c
Historical CPU usage : sar -p
Current memory usage: free -m
Historical memory usage: sar -r  (%memused and %swpused), sar -s (%swpused)
Current disk I/O usage: iostat -x 1 10
Historial disk I/O usage : sar -d
process list: ps auxwwwf
system’s virtual memory statistics: vmstat 5 10 (10 times at 5 second intervals)

There are various actions you can take to find the cause of your high server loads. Here is a partial list that will always be incomplete:

Check the MySQL process list using "mysqladmin processlist" (or just "mysqladmin pr" for short)
Check the MySQL process list using mytop
tail your logs! Listening to what your server says is very important. Is your server being brute forced?
Run dmesg and check for possible hardware issues
Use netstat to view the connections to your server

Here are some logs to check:

syslogs: /var/log/messages, /var/log/secure
SMTP logs: /var/log/exim_mainlog, /var/log/exim_rejectlog, /var/log/exim_paniclog
POP3/IMAP logs: /var/log/maillog
Apache logs: /usr/local/apache/logs/access_log, /usr/local/apache/logs/error_log, /usr/local/apache/logs/suexec_log, /usr/local/apache/logs/suphp_log
Website logs: /usr/local/apache/domlogs/ (use this to find sites with traffic in the last 60 seconds: find -maxdepth 1 -type f -mmin -1 | egrep -v 'offset|_log$')
cron logs: /var/log/cron

Ref :,0

No comments:

Post a Comment