[erlang-questions] Supervisor gets killed if a worker is killed

Ulf Wiger <>
Sun Sep 19 14:14:54 CEST 2010


On 09/19/2010 01:19 AM, Tushar Deshpande wrote:
> Hi Ryan,
> 
> You guessed it right.  Here's the restart strategy that I used.
> RestartStrategy = {one_for_one, 0, 1}.
> 
> I changed it to one_for_one, 10, 1} i.e. 10 restarts in 1 sec,
> and everything worked fine.

It may well be that you have thought through the scenario where
you'd reach the number 10, but it strikes me as a high number.
In many cases, I'd say that 3 restarts in one second is more
than enough.

The thing to consider is how long it may take for a looping
restart to... well, loop. If you pick too high a number for
MaxR, you risk missing some looping restarts because they don't
occur quickly enough for the limit to be reached.

That, and detection time. If one second is a very long time in
your application, and you can't imagine a situation where even
5 restarts within that time would be considered 'normal', there
is no reason to set MaxR so high.

In some cases, even something like {one_for_one, 3, 60} would
be fine, but again, you need to think through the scenarios for
your own application.

BR,
Ulf W


More information about the erlang-questions mailing list