[erlang-questions] Implement parallel sessions
Frans Schneider
schneider@REDACTED
Wed Jan 28 18:31:46 CET 2015
I did some testing with your suggestions and would love to get some
feedback on what I did.
The code is here at https://github.com/schnef/tst.
Thanks,
Frans
On 01/27/2015 03:10 PM, Sean Cribbs wrote:
> 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.
I would like to keep the process separate since each fulfills a very
specific function and their implementation is very clean now. Merging
modules would make them much harder to maintain / write / understand.
Also, using FSM's, especially for the crypt module turns out to be very
handy. The modules now are quite small but merging them would make it
one huge beast.
>
> On Tue, Jan 27, 2015 at 6:14 AM, Imants Cekusins <imantc@REDACTED
> <mailto: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 <mailto:erlang-questions@REDACTED>
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
>
> --
> Sean Cribbs <sean@REDACTED <mailto: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/20150128/5d1a96f0/attachment.htm>
More information about the erlang-questions
mailing list