You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@gonzo.ben.algroup.co.uk> on 1995/10/09 17:38:03 UTC

listen() bug

I could have sworn that there was a patch which changed "listen(sd,512)" to
"listen(sd,5)" in http_main.c. But I just came across it in 0.8.14. Anyway,
whether there was a patch or not, it got me thinking.

The second parameter to listen() is the "backlog". i.e. how many pending
connections are allowed on this port before "connection refused" is returned
to the client. Now, the question is, is this the backlog for _all_ processes,
or is it a per process backlog? Or does it vary according to the system?

If it is per process, then a standalone server would work best with it set to
1 or 0 (depending on meaning). Is it worth making it settable? If we do, can
anyone measure the improvement?

BTW, the original reason for the patch, I thought, was that most systems
silently limit backlog to 5. Some system was not being so silent.

Cheers,

Ben.

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant        Fax:   +44 (181) 994 6472
and Technical Director      Email: ben@algroup.co.uk
A.L. Digital Ltd,
London, England.

Re: listen() bug

Posted by Tony Sanders <sa...@bsdi.com>.
Ben Laurie writes:
> I could have sworn that there was a patch which changed "listen(sd,512)" to
> "listen(sd,5)" in http_main.c. But I just came across it in 0.8.14. Anyway,
> whether there was a patch or not, it got me thinking.
> 
> The second parameter to listen() is the "backlog". i.e. how many pending
> connections are allowed on this port before "connection refused" is returned
> to the client. Now, the question is, is this the backlog for _all_ processes,
> or is it a per process backlog? Or does it vary according to the system?
> 
> If it is per process, then a standalone server would work best with it set to
> 1 or 0 (depending on meaning). Is it worth making it settable? If we do, can
> anyone measure the improvement?
The problem is that connections can get stuck for a period of time
in a state that ties up entries in this queue so you want to set
this as high as possible.

> BTW, the original reason for the patch, I thought, was that most systems
> silently limit backlog to 5. Some system was not being so silent.
You can change the default for the system that is being noisy but
something much larger should be the default for other systems that
are not being brain-dead.

> Cheers,
> 
> Ben.
> 
> -- 
> Ben Laurie                  Phone: +44 (181) 994 6435
> Freelance Consultant        Fax:   +44 (181) 994 6472
> and Technical Director      Email: ben@algroup.co.uk
> A.L. Digital Ltd,
> London, England.