Where is the right place in Erlang to spawn N processes in production? -



Where is the right place in Erlang to spawn N processes in production? -

i'm trying find documentation (book, blog, mailing list etc) on how deploy production scheme erlang.

for instance, have application design should launch 3 processes of particular module takes on gen_server behavior. when starting production erlang system, right way of going this?

manually start them in erl shell? my_server:start(). %% 3 times? (i hope no.) let supervisor handle it? (seems likely?) let server start 3 times? (i think no.) let tool rebar handle it? (haven't learned tool yet, not sure.)

i'm trying find resource(s) explain right way of going in erlang world.

supervisors way go. should read on docs supervisor init boot 3 identical children , maintain them running:

init([]) -> mychildren = [{list_to_atom(childname), {theworkermodule, start_link, [childname]}, permanent, 1000, worker, [theworkermodule]} || childname <- [c1,c2,c3]], {ok, {{one_for_one, 5, 10}, mychildren}}

you can have application boot supervisor , maintain 3 kid gen_servers (defined in theworkermodule.erl) running - , when/if 1 dies restart automatically.

erlang

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -