Timo, If you don't mind "borrowing" code, take a look at the getla() routines in conf.c of the public-domain sendmail. This file uses a bunch of "peer into the kernel for load statistics" calls for various versions of unix, eg "kstat(3KSTAT)" for Solaris and pstat_dynamic() for HPUX.
getla() queries the kernel for the current load, then sleeps or refuses connections for a brief period until the load drops. Just a suggestion.
Jeff Earickson Colby College
On Fri, 28 Oct 2005, Timo Sirainen wrote:
Date: Fri, 28 Oct 2005 22:11:19 +0300 From: Timo Sirainen tss@iki.fi To: Jeff A. Earickson jaearick@colby.edu Cc: dovecot@dovecot.org Subject: Re: [Dovecot] 1.0alpha3: fcntl() complaints?
On Tue, 2005-09-27 at 17:31 -0400, Jeff A. Earickson wrote:
Is there any kind of load-based control, like sendmail uses, that would reject connections if "uptime" load > N?
That could be useful, but I'm not really sure what would be a good way to implement it. Maybe if some file exists (/var/run/dovecot/no-connections or something?) and Dovecot master process notices it, it stops accepting new imap/pop3 connections? The file would then be created by some script you're running that checks the load. And I think that file should be deleted when Dovecot is started, so that people don't wonder why Dovecot isn't working.