[erlang-questions] Implement parallel sessions

Sean Cribbs sean@REDACTED
Tue Jan 27 15:10:32 CET 2015


For those processes that are per-user, or otherwise spin up and do some
work and then go away, we use the simple_one_for_one strategy in the
supervisor. In your case, the simple_one_for_one supervisor would start the
master process of the session (whether it be a supervisor or something
else).

If the master process of the user session is a supervisor, you can create
whatever state is needed to be shared (an ETS table perhaps, or maybe its
own pid) and then pass it to the children when starting. This supervisor
would be a one_for_one, one_for_all, or rest_for_one strategy, depending on
the dependencies between its children.

I wonder whether a single process per session will do (or two, one for user
connection and one for the proxy connection), with different functionality
being kept simply in multiple modules rather than FSMs. For example, if
your connection process handling the TCP socket simply shuttles data to and
from, you might consider collapsing it into the process that's next up the
stack.

On Tue, Jan 27, 2015 at 6:14 AM, Imants Cekusins <imantc@REDACTED> wrote:

> supervisors are meant to supervise only afaik, not to store any state
> or do anything else.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



-- 
Sean Cribbs <sean@REDACTED>
Sr. Software Engineer
Basho Technologies, Inc.
http://basho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150127/1982f1a4/attachment.htm>


More information about the erlang-questions mailing list