title: How to design task distribution with ZooKeeper
body: <p>I am planning to write an application which will have distributed Worker processes. One of them will be Leader which will assign tasks to other processes. Designing the Leader elelection process is quite simple: each process tries to create a ephemeral node in the same path. Whoever is successful, becomes the leader.</p>
  
  <p>Now, my question is how to design the process of distributing the tasks evenly? Any recipe for this?</p>
  
  <p>I'll elaborate a little on the environment setup:</p>
  
  <p>Suppose there are 10 worker maschines, each one runs a process, one of them become leader. Tasks are submitted in the queue, the Leader takes them and assigns to a worker. The worker processes gets notified whenever a tasks is submitted.</p>