[Haskell-cafe] Long pauses / idle time in a Haskell TCP server

Jamie Turner jamie at bu.mp
Mon Oct 8 19:41:11 CEST 2012

> I'm seeing long pauses in a server based on the 'scalable-server'
> package from Hackage, version 0.2.2 [1]. It normally performs very
> well, about 100-150 micro-secs client latency over the loopback
> interface, but a fair number of requests are much slower, 38-40
> milli-secs, making the mean latency and throughput quite bad.

Hi Alex--author of scalable-server here.

38ms sounds like Nagle's algorithm.
(http://en.wikipedia.org/wiki/Nagle's_algorithm)  In short, the socket
is waiting on sending a small amount of data to see if the application
wants to send more data.  If so, the kernel can repack the data
together so that it all can be switched in one TCP packet.

You need to set NoDelay (TCP_NODELAY) if you want to disable this
behavior; scalable-server doesn't currently have a flag to configure
this, but I'm open to pull requests!

(Also, are you using hackage scalable-server, or the "new" scalable
server based on conduit on github?  I'd recommend switching to the
github version if not.  A few key bugs exist in the older

 - Jamie

More information about the Haskell-Cafe mailing list