[erlang-questions] Supervisor on-demand

Juan Jose Comellas <>
Mon Feb 25 16:29:20 CET 2008


I have the following scenario and I'm not really sure of how to represent it
with OTP. I have an application (appmod) running within Yaws that has to
create a worker process every time it receives an HTTP request.The worker
process is created for a specific ID that comes with the request and for
different requests that contain the same ID, the same worker process must be
used. Once instantiated, the worker process must remain up and until it is
explicitly stopped.

I want to monitor the worker processes with an OTP supervisor, but so far
I'm not completely sure of what the correct approach should be. Should I
call supervisor:start_link() the first time I get a request for a specific
ID and then supervisor:start_child() for the following ones? Or should I
just create one supervisor process per worker process I have? Can anyone
share some tips with me on how to design a solution for this problem within
OTP?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080225/81649efc/attachment.html>


More information about the erlang-questions mailing list