Efficiently accepting TCP connections

Corrado Santoro csanto@REDACTED
Thu May 12 22:20:07 CEST 2005


Sean Hinde wrote:
>  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.
On one hand. But on the other hand, the main contribution of the 
leader-follower is to overcome the overhead introduced by creating 
threads "on-the-fly" for each incoming connection.

> Erlang suffers from the opposite effect - it can have many more threads 
> than the OS will support IO handles !
OK. So you could create, say 1000 or 10000, sleeping Erlang processes, 
placing them in a pool, and then pick one process at time for each new 
connection, passing the connected socket. This avoids latency in 
connection handling because you don't need to create the process 
on-the-fly. Then, when processing of the connection is completed, the 
process can be returned to the pool and made available for a new connection.


> 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).
If you have an adequate number of processes in the pool, the behaviour 
of the overall system is the same as having one process for every 
concurrent activity. I think.

Object orientation is not necessary, it is only a matter of C++/Java 
implementation of the leader-follower pattern. But its principle holds 
also in a non OO environment.

Ciao,
--Corrado

-- 
======================================================
Eng. Corrado Santoro, Ph.D.

University of Catania - Engineering Faculty
Department of Computer Science and
Telecommunications Engineering
Viale A. Doria, 6 - 95125 CATANIA (ITALY)

Tel: +39 095 7382144 Int. (5) 8035
      +39 095 7382380
      +39 095 7382365
      +39 095 7382364

VoIP: sip:8035@REDACTED

Fax: +39 095 7382397

EMail: csanto@REDACTED
Personal Home Page:
             http://www.diit.unict.it/users/csanto

NUXI Home Page:
             http://nuxi.iit.unict.it
======================================================




More information about the erlang-questions mailing list