On Tue, Oct 16, 2012 at 6:20 PM, Jeremy Shaw <span dir="ltr">&lt;<a href="mailto:jeremy@n-heptane.com" target="_blank">jeremy@n-heptane.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Oct 11, 2012 at 12:31 AM, Kazu Yamamoto &lt;<a href="mailto:kazu@iij.ad.jp">kazu@iij.ad.jp</a>&gt; wrote:<br>
&gt; Hi Jeremy,<br>
<div class="im"><br>
&gt; One question and one suggestion.<br>
&gt;<br>
&gt; Question: you set NoDelay to the listen socket. What is the intention?<br>
&gt; Do connected sockets inherit this flag? Regardless of inheritance, I&#39;m<br>
&gt; not sure this option improves the performance of HTTP servers. It is<br>
&gt; the option for interactive applications such as ssh.<br>
<br>
</div>I am pretty sure I just copied that flag from snap. Yay for cargo<br>
culting! It tests show that it doesn&#39;t help anything then we can<br>
remove it. Or at least add a comment that is doesn&#39;t appear to help<br>
anything..<br></blockquote><div><br></div><div>The NoDelay flag disables Nagle&#39;s algorithm (<a href="http://en.wikipedia.org/wiki/Nagle&#39;s_algorithm">http://en.wikipedia.org/wiki/Nagle&#39;s_algorithm</a>). If you write() to a socket fewer bytes than the TCP maximum segment size (usually <span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;line-height:12.800000190734863px">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.</span></div>
<div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;line-height:12.800000190734863px"><br></span></div><div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;line-height:12.800000190734863px">On my linux machine, this flag *is* inherited by accepted file descriptors </span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;line-height:12.800000190734863px">from the listening socket</span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;line-height:12.800000190734863px">. You can test for yourself: </span><a href="https://gist.github.com/3900556">https://gist.github.com/3900556</a></div>
<div><br></div><div>G</div></div>-- <br>Gregory Collins &lt;<a href="mailto:greg@gregorycollins.net" target="_blank">greg@gregorycollins.net</a>&gt;<br>