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

Paulo Sérgio Almeida <>
Fri Jul 17 11:03:40 CEST 2009


Scott Lystig Fritchie wrote:
> Cliff Moon <> wrote:
> 
> cm> Your assertion about gen_tcp:send blocking is incorrect in this
> cm> particular case.  In this test the async thread queue is enabled,
> cm> which allows the io subsystem to queue blocking IO operations and
> cm> execute them concurrently with the rest of the VM.
> 
> Cliff, I haven't looked deeply into the guts of the R13B VM, but IIRC
> the R11 VM + inets driver didn't use the async thread pool.  File I/O
> yes, TCP/UDP I/O I don't think so.  Independent (and preferably
> authoritative :-) confirmation/refutation is welcome.

I have a feeling async threads are for File I/O, but even if they are 
used for TCP, the problem still holds. They would tolerate a transient 
slowness. But if some client(s) are persistently slow and cannot keep 
up, after the TCP window has been exausted and all async threads have 
also been exausted, then it will block.

You need to do some flow control. Possibly discarding messages and in 
the worst case even disconnecting the client. And as it should be done 
independently for each client, a per client middleman process is the 
best place to do it.

Regards,
Paulo


More information about the erlang-questions mailing list