You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jonathan Dart <jo...@gmail.com> on 2013/10/11 17:52:13 UTC

[users@httpd] Help me understand "Waiting for Connection"

Hello Users,

I've been monitoring full-status output and I've noticed some unexpected
results. If I request "http://localhost/server-status" every 1 second for 5
seconds, on the last request apache reports that it has 5 active requests
all with a "Request" of /server-status and a "Mode of Operation" of
"Waiting for Connection". If right away I again request "
http://localhost/server-status" every 1 second for 5 seconds, the output of
server-status basically stays the same showing 5 active requests.

This makes me think that for the first 5 requests apache started up a new
worker to handle each one, and the worker waited for further requests, but
for the next 5 requests apache decided that client had enough workers
dedicated to it and recycled the existing waiting workers.

I experimented with sending a "Connection: close" header but it didn't
change the outcome.

Is what I described above expected?
Is the output of /server-status accurately reporting he status of the
server?
What configuration does the number of 5 come from?

I'm using Apache/2.2.16 (Debian), the prefork variety.

The prefork config looks like:
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0


Thanks,
Jonathan

Re: [users@httpd] Help me understand "Waiting for Connection"

Posted by Pete Houston <ph...@openstrike.co.uk>.
On Fri, Oct 11, 2013 at 10:52:13AM -0500, Jonathan Dart wrote:
> If I request "http://localhost/server-status" every 1 second for 5
> seconds, on the last request apache reports that it has 5 active requests
> all with a "Request" of /server-status and a "Mode of Operation" of
> "Waiting for Connection". 

They are not active requests. They are previous requests which you can
tell because the status of the child is "Waiting for Connection".

> If right away I again request "
> http://localhost/server-status" every 1 second for 5 seconds, the output of
> server-status basically stays the same showing 5 active requests.
> 
> This makes me think that for the first 5 requests apache started up a new
> worker to handle each one, and the worker waited for further requests, but
> for the next 5 requests apache decided that client had enough workers
> dedicated to it and recycled the existing waiting workers.

Almost right. There are already 5 child proceses there waiting for
connections right at the start - they just have no previous request to
report at that stage. Apache does not create any further child processes
during the duration of your test. The apache children are not dedicated
to your client during this test - they will serve any inbound request
from any client so long as they are in the "Waiting for Connection"
state.

> Is what I described above expected?

Yes.

> Is the output of /server-status accurately reporting he status of the
> server?

Yes.

> What configuration does the number of 5 come from?

StartServers (in this particular case). Do have a read of the prefork
MPM documentation to learn the meaning of each of the directives
and how they govern the behaviour of the server over the long term.
http://httpd.apache.org/docs/2.2/mod/prefork.html

Good luck,

Pete
-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107