Received: by taz.hyperreal.com (8.7.5/V2.0) id VAA22965; Mon, 16 Sep 1996 21:41:53 -0700 (PDT) Received: from localhost by taz.hyperreal.com (8.7.5/V2.0) with SMTP id VAA22957; Mon, 16 Sep 1996 21:41:50 -0700 (PDT) Date: Mon, 16 Sep 1996 21:41:50 -0700 (PDT) From: Brian Behlendorf To: new-httpd@hyperreal.com Subject: Taming the server if it cannot fork (fwd) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-new-httpd@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com ---------- Forwarded message ---------- Date: Mon, 16 Sep 1996 09:40:32 +0200 From: Andreas Koenig Reply-To: andreas.koenig@franz.ww.tu-berlin.de To: new-httpd@hyperreal.com Subject: Taming the server if it cannot fork I recently watched the 1.1.1 server in a situation where it could not fork all of its children (for reasons you do not want to know). I discovered that make_child fails too quickly in such a case so the loop around the make_child() call consumes the whole CPU. I'd suggest that make_child sleeps for a second if it fails to fork. That way you reduce system load in a situation that is most probably already unpleasant. Here's my proposal: --- http_main.c-1.63 Mon Sep 16 09:27:34 1996 +++ http_main.c Mon Sep 16 09:27:43 1996 @@ -1549,6 +1549,7 @@ if ((pid = fork()) == -1) { log_unixerr("fork", NULL, "Unable to fork new process", server_conf); + sleep 1; return; } Regards, andreas