You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by ulf kister <Ul...@t-online.de> on 2004/09/14 20:19:34 UTC

[users@httpd] apache worker - ServerLimit 1 exceeded

Hi,

I have a few question about the worker mpm of apache2 (for details about
the environment and configuration please see below).

Since I want to run a third party shared module which is not capable of
ipc I tried to limit the number of processes to one (see httpd.conf
below) which obviously does not work.

Background:

Two ore more processes loading and running the module would cause rather
unpredictable effects, one of which already observed is that the
different processes - or, to be more precise, the modules fired up by
them - concurrently access the same logfile (beginning at offset 0 while
initializing) which would make it impossible even to nail down what
exactly happened in case of trouble.

As you will understand this is not too desirable in a production
environment...

Observations:

O1. "apachectl configtest" does not complain and the server starts ok.

O2. When looking at "top" or "ps -ef" I find that - despite my
configuration - two processes are started (actually three, but let's
ignore the root process).

O3. Examining the two processes closer I saw that one of them serves all
incoming http requests (this is a test setup, so all incoming requests
came from me - very limited set of ip addresses and so on) and the other
seems idle; anyway it does not do any library calls during a whole day,
as I saw from "truss" (Linuxers aware: "strace" for you).

O4. When I kill the idle process, a new one will be spawned immediately
and kept idle again ...

O5. When I kill the working process, a new one is spawned, which will
serve the further requests. The idle process remains unchanged
(especially idle).

Questions:

Q1. What the heck ... ?

Q2. Am I right assuming that apache starts a "fallback process" which is
kept idle only to be able to handle failover cases?

Q3. If yes - why is a new process spawned to serve further requests as
observed in O5.?

Q4. How can I guarantee that only one process will be working in
production - or, even better, limit the number of running processes
effectively to one?

Any help would be highly appreciated,

Thanks in advance, Ulf

=========================================================================

Surroundings look like this:

Build Script:

ulf @ sundance httpd-2.0.50 $ cat buildcmd
#!/bin/sh

./configure \
--prefix=/app/local/apache/2.0.50/worker \
--with-mpm=worker \
--enable-mods-shared=all \
--with-egd \
--with-devrandom \
&& make \
&& make install


Environment:

ulf @ sundance ulf $ /usr/local/apache/2.0.50/worker/bin/httpd -v
Server version: Apache/2.0.50
Server built: Sep 10 2004 08:59:19

ulf @ sundance ulf $ uname -a
SunOS sundance.xxx.xxx 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-4

ulf @ sundance ulf $ gcc -v 
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0/specs
Configured with: ../configure --disable-nls --disable-libgcj
--enable-languages=c++,f77,objc
Thread model: posix
gcc version 3.0


httpd.conf:

[ ... ]
<IfModule worker.c>
  # hopefully no math glitch here ...
  StartServers 1
  MaxClients 150
  MinSpareThreads 25
  MaxSpareThreads 75
  ThreadsPerChild 25
  MaxRequestsPerChild 0
  ServerLimit 1
</IfModule>
[ ... ]

"apachectl configtest" does not complain:

ulf @ sundance bin $ cd /usr/local/apache/2.0.50/worker/bin
ulf @ sundance bin $ sudo ./apachectl configtest
Syntax OK

-- 
"Never underestimate the bandwidth of a station wagon full of tapes
hurtling down the highway" 
-Andrew Tanenbaumstation wagon

Re: [users@httpd] apache worker - ServerLimit 1 exceeded

Posted by ulf kister <Ul...@t-online.de>.
Dear Joshua,

On Tue, 2004-09-14 at 22:02, Joshua Slive wrote:

> [ ... ]
>
> The third process is the mod_cgid daemon.  It handles cgi forking to
> avoid forking 25-thread processes to serve cgi scripts.  If you don't
> use cgi, then get rid of mod_cgid.

That did the trick. Thank you very much!

> Although the ServerLimit is going to take precedence here, a more
> sensible configuration would set
> MaxClients 25
> MinSpareThreads 0
> MaxSpareThreads 25
> where "25" can be replaced with whatever you set ThreadsPerChild to.

I configured it like this and will run performance tests with this
config to compare them to the results I have got before.

Thank you very much for your help,

regards, Ulf

-- 
"Never underestimate the bandwidth of a station wagon full of tapes
hurtling down the highway" 
-Andrew Tanenbaumstation wagon

Re: [users@httpd] apache worker - ServerLimit 1 exceeded

Posted by Joshua Slive <js...@gmail.com>.
On Tue, 14 Sep 2004 20:19:34 +0200, ulf kister <ul...@t-online.de> wrote:

> O2. When looking at "top" or "ps -ef" I find that - despite my
> configuration - two processes are started (actually three, but let's
> ignore the root process).

The third process is the mod_cgid daemon.  It handles cgi forking to
avoid forking 25-thread processes to serve cgi scripts.  If you don't
use cgi, then get rid of mod_cgid.

> <IfModule worker.c>
>   # hopefully no math glitch here ...
>   StartServers 1
>   MaxClients 150
>   MinSpareThreads 25
>   MaxSpareThreads 75
>   ThreadsPerChild 25
>   MaxRequestsPerChild 0
>   ServerLimit 1
> </IfModule>

Although the ServerLimit is going to take precedence here, a more
sensible configuration would set
MaxClients 25
MinSpareThreads 0
MaxSpareThreads 25
where "25" can be replaced with whatever you set ThreadsPerChild to.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org