[erlang-questions] Is a supervisor necessary here/when should I use one?

Vance Shipley <>
Wed Jul 26 05:35:02 CEST 2017


On Sat, Jul 22, 2017 at 1:05 AM, code wiget <> wrote:
> So, when I enable the plugin and the supervisor starts, my startup() function is run properly, but exits and error text is displayed after completing properly because the worker is not, well, doing anything until it is started to be called.

I always start with a proper supervision hierarchy for all processes
following the old Erlang adage "optimize last, if ever". It's true
that with high frequency starting of children supervision introduces
an overhead which could be a significant portion of overall
load/latency however the stability provided should not be
underestimated. In these cases you will want to configure the sasl
application to suppress printing progress reports which would
otherwise make the console/logs unusable so add this to your
sys.config file:

     {sasl, [{errlog_type, error}]}

> Conceptually, I am new to this. Is there any place for a supervisor here?

IMHO there is always a use for supervision. One thing I pay attention
to is what happens when you perform an orderly shutdown. Start your
application and sasl then type "q()." in the console and you should
get a silent exit within four seconds (typically). If you get reams of
reports or hang a long time things aren't stable.

-- 
     -Vance


More information about the erlang-questions mailing list