Efficiency: registered process or loop-function argument?

Fredrik Thulin ft@REDACTED
Tue Mar 28 08:16:05 CEST 2006


On Monday 27 March 2006 20:31, Jérémie Lumbroso wrote:
> Hello,
>
> I have server that spawns a new 'handler' process/function for every
> incoming socket.
>
> Those 'handler' process must communicate with the server process. I
> am wondering which of the two following solutions is best.
...
> Or rather, I realize this question is on a per-case basis mostly ...
> so really, what I would like to ask, is whether there are any
> side-effects to doing it the second way (by passing an argument). Is
> the overhead for an extra argument on a loop function like that big?

I bet your biggest problem will be that your 1000 connection handlers 
all send data to one single process ('server' in your example). The 
problem wouldn't be the cost of doing a named-process lookup versus 
passing a Pid argument around.

You would very efficiently remove all the parallell aspects of your 
program, and (based on own experience) end up with a very slow 
serialized program where the cost of registered-name vs. Pid would 
probably not even be measurable.

Seek high performace elsewhere, preferably with experimentation and 
measurements of different designs.

/Fredrik



More information about the erlang-questions mailing list