Erlang Mailing Lists

Author Message

<  Erlang  ~  Supervisor restart strategy not granular enough?

roth
Posted: Sun Apr 18, 2010 3:59 am Reply with quote
User Joined: 07 Apr 2010 Posts: 13
Hello.

Is there any way to, for example, supervise a group of five processes and have it so that three are marked "critical" and will cause a restart of the whole group if any of them go down? It seems like I might be able to hack something together with the "rest_for_one" restart strategy or use multiple supervision tree branches but I'm not sure it'd be "correct" and would certainly be more complex...
View user's profile Send private message
Michal Ptaszek
Posted: Sun Apr 18, 2010 8:35 am Reply with quote
User Joined: 01 May 2008 Posts: 35 Location: Krakow
If some of your processes are more fragile than others maybe it a good idea is to put them under another supervisor?

In your case it would look like:
Code:

main_supervisor -> [fragile_sup, normal_sup] //one_for_one
fragile_sup -> [proc_a, proc_b, proc_c] //all_for_one
normal_sup -> [proc_d, proc_e] //one_for_one


Having a deeper supervision tree allows you to be more precise when expressing the restart strategy in your application. However, on the other hand, you should be more careful when configuring the maximum restarts number within a given period of time.
View user's profile Send private message
roth
Posted: Sun Apr 18, 2010 6:31 pm Reply with quote
User Joined: 07 Apr 2010 Posts: 13
Michal Ptaszek wrote:
If some of your processes are more fragile than others maybe it a good idea is to put them under another supervisor?

In your case it would look like:
Code:

main_supervisor -> [fragile_sup, normal_sup] //one_for_one
fragile_sup -> [proc_a, proc_b, proc_c] //all_for_one
normal_sup -> [proc_d, proc_e] //one_for_one



Thanks, but that's not quite what I intended in the original post. What I wanted was for any of proc_a, proc_b, proc_c to cause all proc_* to restart on failure. That in itself seems to prevent the use of a second supervisor.
View user's profile Send private message
Michal Ptaszek
Posted: Sun Apr 18, 2010 9:01 pm Reply with quote
User Joined: 01 May 2008 Posts: 35 Location: Krakow
Ok, it seems I did not understand your intentions clearly.

Nevertheless, in that case, you can use the mentioned structure but play a little bit with the restart frequencies and strategies.

For example fragile_sup might have 0 restarts permitted (in any time) while main_supervisor has rest_for_one strategy set (with customized restart frequency). Having that configuration will imply:
* any crash in fragile processes set will cause restart of all processes
* single crash of 'standard' processes will not affect the fragile ones
View user's profile Send private message
roth
Posted: Sun Apr 18, 2010 9:30 pm Reply with quote
User Joined: 07 Apr 2010 Posts: 13
Ah, yeah, thanks. That'd likely do it.

The important bit from the RM being:

Quote:

If more than MaxR number of restarts occur in the last MaxT seconds, then the supervisor terminates all the child processes and then itself.
View user's profile Send private message
wuji
Posted: Sat Aug 11, 2012 2:11 am Reply with quote
User Joined: 10 Aug 2012 Posts: 654
than half a century, and a football team's worth of of Cheap Ralph Lauren Shirts of children and grandchildren."He died as he lived. He
hard until the end, stayed positive, thought only of others others replica Christian Louboutin others and constantly reminded everyone of how blessed his life
been. His ambitions were far reaching, but he never never discount designer *beep* never believed he had to leave this Happy Valley to
them. He was a man devoted to his family, family, [h4]designer replica *beep*[/h4] family, his university, his players and his community," Paterno's family
in a statement.While at Penn State's helm, Paterno, who was was [h2]replica designer bags for sale[/h2] was born in Brooklyn, N.Y., led the Nittany Lions to
undefeated seasons and two NCAA championships, had only five losing losing cheap Ralph Lauren Polo losing seasons, was inducted into the College Football Hall of
View user's profile Send private message
dongdongwu
Posted: Thu Sep 20, 2012 5:35 am Reply with quote
User Joined: 19 Sep 2012 Posts: 236
His good friend Diane said: "Christian Louboutin Men Shoes was a magician, he make shoes is immediately put his female people with legs and advantage. He understands women wanted to do and can make them into beautiful Cinderella." Madonna often in its concert wearing Christian louboutin high heels , and some famous superstar like Angelina jolie, mariah Carey, beyonce Knowles, the famous Japanese singer YaYouMei Hamasaki helps Christian Louboutin Men Shoes set up its powerful position. The youngest customers will count Tom cruise's daughter sully cruz. Louboutin made for only a pair of handmade Christian Louboutin high heel Shoes! Want to be more fashion? Put on Christian Louboutin Outlet !
Candy colors of the chalaza high-heeled shoes with lolita type allure, set full finely gem blue "neon shoes" is to need to use "sexy" to describe. Each pair are worth careful appreciation of lithe and graceful fairy ludaoli, what kind of most let you move?Christian Louboutin Men Shoes that one brush red is always cannot resist the temptation, Christian Louboutin men outlet continue to use the days of high 8cm above slender heel proclaim the sexy and luxuriant. The bowknot on black pointed high-heeled shoes with sharp rivet concomitant, wild python met enchanting color printing grain, It is that pairs of high-heeled shoes lets Carrie more feminine flavour. Like Christian Louboutin for men her word.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum