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

Cliff Moon <>
Fri Jul 17 04:00:39 CEST 2009


Your assertion about gen_tcp:send blocking is incorrect in this 
particular case.  In this test the async thread queue is enabled, which 
allows the io subsystem to queue blocking IO operations and execute them 
concurrently with the rest of the VM.

Paulo Sérgio Almeida wrote:
> 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.
>
> Regards,
> Paulo
>
>



More information about the erlang-questions mailing list