[erlang-questions] 20k messages in 4s but want to go faster!

Johnny Billquist <>
Sat Jul 11 01:24:46 CEST 2009


Matthew Sackman wrote:
> On Fri, Jul 10, 2009 at 07:24:07PM +0100, Joel Reymont wrote:
>> I can't seem to send 20k messages in much less than 4 seconds and
>> would appreciate any suggestions on how to improve my broadcasting
>> speed.
> 
> Have you tried turning of nagle? We've found it's almost always a bad
> idea to leave it on. Add {nodelay, true} to your options.

Nagle is actually a good thing, which improves performance, not decrease it.

There is one specific situation when you don't want nagle, and that is 
if you send very little data, and what it to be sent immediately. In 
that specific case, Nagle is an obstruction and should be shut off.

So, unless we talk 20k messages to different ports, and all of them 
being small, turning off Nagle will only actually decrease performance, 
not increase it.
(The reason for the gain in performance is that Nagle will actually make 
you send tcp packets with as much data as MSS specifies, instead of 
sending loads of smaller packets which will cause more overhead, since 
each packet also implies both a tcp and an ip header, which isn't payload.)

	Johnny

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email:              ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


More information about the erlang-questions mailing list