[erlang-questions] Re: Unicast 20k messages, $500-$1000 bounty

Paulo Sérgio Almeida psa@REDACTED
Fri Jul 17 01:24:26 CEST 2009

Joel Reymont wrote:

> There are no middlemen now, Cliff's version sends directly to the socket.

I did not sugest sending directly to the socket in the loop because it 
is a bad idea: if there is a single slow client and gen_tcp:send blocks 
the remaining clients will suffer ...

It is important to have one middleman to make the service tolerant of 
slow (or even malicious) clients. This is specially true for large 
messages. The middleman should also use send_timeout, and should keep 
the inbox small, retrieving all messages to data structure before doing 
a gen_tcp:send and possibly discarding messages if the client cannot 
keep up with the message rate.


More information about the erlang-questions mailing list