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

Johnny Billquist bqt@REDACTED
Sat Jul 11 01:31:38 CEST 2009


Johnny Billquist wrote:
> 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.)

DOH! And blind as a bat... Broadcast? If so, then we're not talking tcp 
here, and there isn't even any Nagle around...
So you can forget all about this thread.

I would assume you are using UDP. Since you seem to be sending each 
message to a different socket, I'd have to ask what you really are 
trying to do? :-)
Maybe you are approaching the whole thing the wrong way?

	Johnny

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


More information about the erlang-questions mailing list