
On Tue, Oct 16, 2012 at 6:20 PM, Jeremy Shaw
On Thu, Oct 11, 2012 at 12:31 AM, Kazu Yamamoto
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:
https://gist.github.com/3900556
G
--
Gregory Collins