From owner-freebsd-hackers Thu Apr 3 05:57:26 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id FAA23544 for hackers-outgoing; Thu, 3 Apr 1997 05:57:26 -0800 (PST) Received: from gvr.win.tue.nl (root@gvr.win.tue.nl [131.155.210.19]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id FAA23539 for ; Thu, 3 Apr 1997 05:57:21 -0800 (PST) Received: (from guido@localhost) by gvr.win.tue.nl (8.8.5/8.8.2) id PAA10893 for FreeBSD-hackers@freebsd.org; Thu, 3 Apr 1997 15:57:08 +0200 (MET DST) From: Guido van Rooij Message-Id: <199704031357.PAA10893@gvr.win.tue.nl> Subject: apache like preforking apps and high loads To: FreeBSD-hackers@freebsd.org (FreeBSD-hackers) Date: Thu, 3 Apr 1997 15:57:08 +0200 (MET DST) X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk When looking at Apacha like applications, one often sees extermely high load averages. Apache preforks a number of processes that all block on accept(). When a request comes in, all process are woken up and the scheduler chooses one of the now runnable processes taht will succeed in the accept(). The other go back to sleep. There is a max amount of free processes (i.e.e processes doing an accept) and a min amunt. When less the minimum amount of processes are available, new ones are forked. When more then the maximum are available, some are killed. Now, as told, I regularly see loads like 20 on an otherwise idle machine, causing e.g. sendmail to not deliver mail anymore. One could argue that then the values of min and max above are wrong, but that is not completely true. These values should be optimised for those times where the amount of connections is the highest. But it will bite you when the server is relatively idle. My proposition would be to dynamically set the values of min and max according to the current load profile on the server. If the amount of connections in the last minut (or so) is 20, min should be set to 20 and max to 2*min. Of course we will still have the already present `real maximum' where max<`real maximum'. I'm wondering if this is the right approach...Waht do you guys think? -Guido