[distcc] Detecting an I/O-bound server?

Dan Kegel dank at kegel.com
Tue Nov 22 05:57:55 GMT 2005


I've been monitoring the latency of a bunch of
distcc servers.  One in particular always had
a four second latency to compile "hello, world".
Turns out it was a workstation where somebody
was running a memory-hungry application.  The
load average was around 1.2 -- not that high --
but the machine was quite sluggish.
I'd like distccd to recognize conditions like that
(as opposed to a load average of 2 caused by running
distcc and gcc), and refuse to accept compile jobs.

But it's not immediately obvious how to recognize
busy machines.  One rule of thumb might be
"if there is a non-gcc app with more than 400MB of RSS,
the machine is busy".  Another might be
"If firefox or thunderbird are running, the machine is busy"
(Actually, that's almost the same as the previous rule, isn't it?)
Another might be "if there are more than 40 pages of I/O
per second, the machine is busy."

On Linux, at least, one can measure that last with something like

#!/bin/sh
now=0
while true; do
    date
    then=$now
    now=`awk '/page/ {print $1 + $2}' /proc/stat`
    io=`expr $now - $then`
    test $io -gt 200 && echo "Machine is busy ($io pages in last 5 sec)"
    test $io -gt 200 || echo "Machine is not busy (only $io pages in last 5 sec)"
    sleep 5
done

That seems a little brittle (where does the magic constant of 40 pages per sec
come from), but can anyone suggest a better way than reading /proc/stat periodically?
- Dan

-- 
What does Linux need to succeed on the desktop?  See http://kegel.com/linux/comfort


More information about the distcc mailing list