[web-devel] maxListenQueue

Gregory Collins greg at gregorycollins.net
Tue Oct 16 18:59:51 CEST 2012

On Tue, Oct 16, 2012 at 6:20 PM, Jeremy Shaw <jeremy at n-heptane.com> wrote:

> On Thu, Oct 11, 2012 at 12:31 AM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
> > Hi Jeremy,
> > One question and one suggestion.
> >
> > Question: you set NoDelay to the listen socket. What is the intention?
> > Do connected sockets inherit this flag? Regardless of inheritance, I'm
> > not sure this option improves the performance of HTTP servers. It is
> > the option for interactive applications such as ssh.
> I am pretty sure I just copied that flag from snap. Yay for cargo
> culting! It tests show that it doesn't help anything then we can
> remove it. Or at least add a comment that is doesn't appear to help
> anything..

The NoDelay flag disables Nagle's algorithm (
http://en.wikipedia.org/wiki/Nagle's_algorithm). If you write() to a socket
fewer bytes than the TCP maximum segment size (usually 1460 for ethernet),
by default the kernel will delay the physical write for some time in the
hopes that more data will be coming. (The idea is to reduce packet header
overhead for interactive applications like telnet). Obviously this is bad
for throughput, and you should always turn it off in server applications
that do their own buffering.

On my linux machine, this flag *is* inherited by accepted file descriptors from
the listening socket. You can test for yourself:

Gregory Collins <greg at gregorycollins.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20121016/aa3234e0/attachment.htm>

More information about the web-devel mailing list