Efficiently accepting TCP connections

Sean Hinde <>
Thu May 12 22:07:25 CEST 2005


On 12 May 2005, at 15:22, Corrado Santoro wrote:

> joel reymont wrote:
>> Is there an efficient idiom for handling gen_tcp connections on the 
>> server side?
> One possibility is to use thread pools. The "leader-follower" 
> object-oriented design pattern by Doug Schmidt et al. has been 
> proposed for this purpose.

 From a quick look at one paper on this subject it appears to be an 
attempt to solve the problem where there are more connections than the 
language will allow you to have threads.

Erlang suffers from the opposite effect - it can have many more threads 
than the OS will support IO handles !

I suggest you scrap such thinking (be it object oriented or "thread 
pools") and go with the Erlang way (one process for every concurrent 
activity).

<aside>
"Thread pools" can be useful in Erlang, but mostly for writing clients 
which need to maintain a pool of sockets to other systems which are 
either non multiplexed or have other problems in this area
</aside>

Sean




More information about the erlang-questions mailing list