0

I am building a distributed app in which a set of processes (running on separate machines) are working together. Each process works on its own set of "resources" (and there is no sharing of resources among the processes). When the app starts, I need to distribute the pool of resources among the processes so that they can work independently. In order to do the resource distribution, I am considering using Apache Curator's Leader Election recipe.

Once a process is chosen as leader, it will do the resource distribution and then the remaining processes can work on their assigned resources. While the leader is doing the work, other processes have to be "blocked". What is the curator behavior for the non leader processes? Do they immediately get a failure from the leader election api or they get blocked?

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
pnndesh
  • 11
  • 2
  • I don't follow your question. The leader election "recipes" in Curator ensure that only one process is active (however, please read https://cwiki.apache.org/confluence/display/CURATOR/TN10). I'm not sure why you're referring to "failure". Are you asking what happens if there's a network partition? BTW - if you want a task distribution framework - I wrote this for Nirmata and it's still actively used: https://github.com/nirmata/workflow – Randgalt Aug 14 '20 at 02:31
  • Yes, from reading the recipe code I found that part. Let me give an example, assume processes P1, P2, P3 are trying for leader election and let's say one of them P1 becomes the leader. When P1 becomes the leader, takeleadership callback is invoked in which leader can do some work. While P1 is actively doing some work, what happens to P2, P3? – pnndesh Aug 14 '20 at 03:17
  • Nothing happens to them - I still don't follow. P1 will be leader until it releases leadership and then one of the other contenders (P2 or P3) will become leader, etc. – Randgalt Aug 14 '20 at 13:59

0 Answers0