Load average

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Philip Hazel
Data:  
Para: exim-users
Asunto: Load average
It was suggested that I add the ability to limit incoming SMTP calls
when the load average is high. I thought this would be easy. "What's the
name of the function that tells you the load average?" I wondered. "man
-k average" ... er ... "man -k load" ... er ... grobble .. grobble ...
Sigh. I learned that there's no standard. They all do it differently. As
Jake Dias says, "Unix is lovely, aren't they?"

Anyway, I now have code that works for all the OS that Exim supports
except Ultrix, AIX, and SCO. Any offers? (Top marks to BSDI, NetBSD, &
FreeBSD, which *do* have a getloadavg() function.) I'll code it so the
facility just isn't available on any OS for which I don't have code.

The point of the post, however, is to ask a question. The code for Sun,
IRIX and HP-UX request an "open" operation on a kernel "file" and a
subsequent "read" to get the data. Root privilege is required for the
open. The natural way to implement this in the Exim daemon is to do the
open at start-up time, and hang on to the resulting descriptor for ever
more. Does anybody know of any reason why this is a bad plan?

If it is, we have a problem because (a) tests I did on Solaris 2.5.1
show that the open is quite expensive in terms of cpu use and (b) the
daemon normally setuids away from root once it has got going.

Comments and suggestions invited.

--
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714