LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-10-2007, 10:56 AM   #1
rimtrim
LQ Newbie
 
Registered: Sep 2007
Posts: 7

Rep: Reputation: 0
Load average, run queue, sleeping process confusion


I'm trying to tune a Red Hat sendmail/dovecot server that is under a lot of load and probably insufficient, hardware-wise, for what it's being asked to do. top shows that the load average is very high -- it sits around 30-50 during normal usage times and has peaked as high as 143(!) for short periods. CPU iowait is also very high (30-70% continuously), probably because we are storing a lot of user data on only 3 disks and they can't keep up.

What I'm trying to establish is precisely what causes the load average to occasionally peak at 100+ for short periods (a minute or two at a time). This is causing problems for us because our sendmail RefuseLA is currently set at 55, so the machine starts rejecting users' SMTP connections when the load average spikes. I'm reluctant to set RefuseLA any higher until I understand what is causing these spikes.

So, I've been doing some monitoring to see what might be correlated with the spikes in load average (maybe high numbers of IMAP connections, high numbers of SMTP connections, backups kicking off, or ???). This is where I ran into some confusion. My research on load averages suggests that the load average reflects the number of processes in the run queue plus the number of processes in uninterruptable sleep (such as waiting on I/O). My understanding is that the "r" and "b" columns in vmstat output represent the current values of those 2 parameters. However, the values from vmstat don't seem consistent with the load average. Currently my load average is sitting in the 40-50 range, but the value of r + b is bouncing around 10 (usually roughly r = 1 and b = 9). I would expect load average to be in the same ballpark as r + b when I monitor the two of them over the course of a few minutes. What is my mistake here?

-Andrew L
 
Old 09-11-2007, 04:57 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Long term averages very rarely correspond to instantaneous samples - unless they are always zero. Top gives you the number of running tasks - in fact it (indirectly) even gives you the uninteruptable sleep count - have a look in the state column for "D". Reverse sort that column to put them (and running) at the head of the list.
Run it in batch and write to a file.

Better yet, have a look at the numbers sysstat gives you - should be there on a R/H system.
 
Old 09-11-2007, 09:00 AM   #3
rimtrim
LQ Newbie
 
Registered: Sep 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for the hint on top and the "S" column. Interestingly that seems to indicate that the problem is with the "b" column in vmstat; the 1-minute load average agrees pretty well with the number of "D"s in top's "S" column. For example, at a given time, top says:

load average: 52.72, 53.34, 54.02

then I run it in batch mode and count the D's:

# top -b -n 1 | awk '{print $8}' | grep D | wc -l
64

That seems reasonable to me. However, vmstat shows r=1 b=3 at the same time. So I guess b is not really what the manpage claims it to be.

-Andrew L
 
Old 09-11-2007, 04:14 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I've always interpreted the "b" column in vmstat as "blocked" - i.e. waiting on input, rather than in uninteruptable sleep.
I must have read that somewhere, although I don't think I've ever dived into the code to have a look. I'd be inclined to consider the manpage "iffy". Raise a query with the manpage maintainer so this doesn't get perpetuated.
 
Old 09-11-2007, 09:43 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Try this - it'll tell you the culprits- maybe run it in batch and save to a file every so often
Code:
top -b -n 1 | awk '{if (NR <=7) print; else if ($8 == "D") {print; count++} } END {print "Total status D: "count}'
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
My load average is 7.00, but my cpu is idle. What's in the queue? BrianK Linux - General 3 03-27-2007 07:10 PM
Process Sleeping? crazenoela Linux - Newbie 1 12-23-2006 08:33 PM
put a process in run queue swaroopjoshi Linux - Kernel 6 11-21-2006 11:32 AM
sleeping process ku2006 Linux - General 1 05-07-2006 02:54 PM
Average load Cyth Linux - General 1 01-22-2002 03:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration