Load average, run queue, sleeping process confusion
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.