Thanks for the tip Jamie! Setting NODELAY on the *client* resolved the problem; setting it on the server (both sockets) didn&#39;t make a difference. I&#39;ll see if I can figure out more about how this was going wrong - I did check the network traffic and the delay was at the server. But now I have a good setup to work with further.<br>
<br>I did have your code from github, but from a while back, not long after you posted 0.2.2 to Hackage. I tinkered it a fair amount - stuff like where queues and worker threads are used, there are lots of options with that, especially given that thread creation is cheap so one doesn&#39;t necessarily need to use thread pools like in some other languages. Now I can play with those variations without distraction from long pauses. And I&#39;ll grab your latest from github and try that out.<br>
<br>Thanks!<br><br>Alex<br><br><br><div class="gmail_quote">On Mon, Oct 8, 2012 at 6:41 PM, Jamie Turner <span dir="ltr">&lt;<a href="mailto:jamie@bu.mp" target="_blank">jamie@bu.mp</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">&gt; I&#39;m seeing long pauses in a server based on the &#39;scalable-server&#39;<br>
&gt; package from Hackage, version 0.2.2 [1]. It normally performs very<br>
&gt; well, about 100-150 micro-secs client latency over the loopback<br>
&gt; interface, but a fair number of requests are much slower, 38-40<br>
&gt; milli-secs, making the mean latency and throughput quite bad.<br>
<br>
</div>Hi Alex--author of scalable-server here.<br>
<br>
38ms sounds like Nagle&#39;s algorithm.<br>
(<a href="http://en.wikipedia.org/wiki/Nagle&#39;s_algorithm" target="_blank">http://en.wikipedia.org/wiki/Nagle&#39;s_algorithm</a>) In short, the socket<br>
is waiting on sending a small amount of data to see if the application<br>
wants to send more data. If so, the kernel can repack the data<br>
together so that it all can be switched in one TCP packet.<br>
<br>
You need to set NoDelay (TCP_NODELAY) if you want to disable this<br>
behavior; scalable-server doesn&#39;t currently have a flag to configure<br>
this, but I&#39;m open to pull requests!<br>
<br>
(Also, are you using hackage scalable-server, or the &quot;new&quot; scalable<br>
server based on conduit on github? I&#39;d recommend switching to the<br>
github version if not. A few key bugs exist in the older<br>
implementation.)<br>
<span class="HOEnZb"><font color="#888888"><br>
- Jamie<br>
</font></span></blockquote></div><br>