Gen_server and multiple processes

hfventer <>
Fri Dec 20 09:43:13 CET 2002


>>Once a message is received it spawns a separate message_hanlder
thread.
>Yes. You have a message server that receives all messages and spawns a 
>new server (Let us call it a message handler)
Just to check, you mean to actually spawn a new OTP gen_server?  Is this
not slow since it has quite a bit of overhead.
The idea we had was to have one gen_server that spawns its own worker
threads in the handle_call.

>No. Implement your translator as a function which is called by the 
>message handler. There is no need for extra message passing or 
>processes.
The idea we had was that by putting the translators (there is more than
one flavor of translator) into OTP servers we would more easily be able
to distribute them over the number of processors we have.  Possably
doing some load balancing on the way.  This seemed to be the easiest way
to get that going quickly.
(thinks about this for a bit)  This same thing could be achieved by
spawing the message handler on the different nodes in the first place?

-Heinrich




More information about the erlang-questions mailing list