[erlang-questions] Why reductions of supervisor is heigh?

40 views
Skip to first unread message

Solomon

unread,
Sep 17, 2012, 6:01:45 AM9/17/12
to erlang-q...@erlang.org
I test web server build with OTP, and I found reductions of supervisor was much heigher then gen_server, what was supervisor doing?

Roberto Aloi

unread,
Sep 17, 2012, 6:25:08 AM9/17/12
to Solomon, erlang-q...@erlang.org
Hi,

> I test web server build with OTP, and I found reductions of supervisor was
> much heigher then gen_server, what was supervisor doing?

What kind of supervisor are we talking about? Does it have dynamic children?

In OTP you can have different kinds of "supervisor". Assume you use a
"simple_one_for_one" supervisor and you add children dynamically. In
such a case, you would perform a call (or even more than one) to the
supervisor process every time you append a child. That would affect
the reductions counter.

Roberto Aloi
@robertoaloi
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Solomon

unread,
Sep 17, 2012, 6:35:27 AM9/17/12
to Roberto Aloi, erlang-q...@erlang.org
Hi,
I generate the process like this code:

init([])->
  Children={my_server, {my_server, start_link, []}, permanent, 5000, worker, [my_server]},
  Processes=lists:flatten([Children]),
  Strategy={one_for_one, 100000, 1},
  {ok, {Strategy, lists:flatten(Processes)}}.


The supervisor should append the children at the beginning.

2012/9/17 Roberto Aloi <pro...@gmail.com>
Reply all
Reply to author
Forward
0 new messages