Efficiently accepting TCP connections
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
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.
Eng. Corrado Santoro, Ph.D.
University of Catania - Engineering Faculty
Department of Computer Science and
Viale A. Doria, 6 - 95125 CATANIA (ITALY)
Tel: +39 095 7382144 Int. (5) 8035
+39 095 7382380
+39 095 7382365
+39 095 7382364
Fax: +39 095 7382397
Personal Home Page:
NUXI Home Page:
More information about the erlang-questions