httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Dessent <>
Subject Re: [users@httpd] Connection Refused - without missing info.
Date Thu, 06 Nov 2003 07:53:12 GMT
Bruce Feist wrote:
> These are examples of the inconsistency I mentioned -- sometimes
> it works, and sometimes there's a "The connection was refused" or
> similar message.

You might try increasing the SOMAXCONN value, which determines the
length of the listen queue.  If this queue fills up then connections
will be refused.  This shouldn't be an issue at all unless the site is
either very busy, MaxClients is set very low, or there are some requests
that are taking a very long time to service and hence tying up workers. 
I'd say 1024 is a good value and more than enough for most cases.  This
is set in the kernel (usually by a sysctl, e.g. net.ipv4.ip_queue_maxlen
for linux) and in httpd.conf by the ListenBacklog directive.

It might also be a good idea to enable mod_status, and look at the state
of the worker processes when this happens.  If there are no free workers
then that implies that the queue is filling up and connections are
refused.  Some OSes (e.g. FreeBSD) have a netstat option that lets you
view the current length of the listen queue which might also be
helpful.  (Note I'm assuimg 1.x and/or prefork mode here...)

If you find that this is what's happening, then you probably need to
figure out a way to make more workers available.  If raising MaxClients
is not possible (due to running out of memory) then you could also
decrease the KeepAlive time and/or disable keepalives entirely.  This
would depend on the output of mod_status -- if a large number of workers
are in the 'K' state then you'd want to look into doing that or even
installing lingerd to offload the "lingering" phase... But all of these
things should really only be necessary for very busy servers which
doesn't sound like your case.  The most instructive thing you could do
would be to run something like Ethereal and get a raw packet capture of
what happens for one of these connections that are refused.  That will
tell you for sure what you need to look into.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message