|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.client.rebalance.RebalanceScheduler
public class RebalanceScheduler
Scheduler for rebalancing tasks. There is at most one rebalancing task per stealer-donor pair. This scheduler ensures the following invariant is obeyed: A node works on no more than one rebalancing task at a time. Note that a node working on a rebalancing task may be either a stealer or a donor. This invariant should somewhat isolate the foreground workload against the work a server must do for rebalancing. Because of this isolation, it is safe to attempt "infinite" parallelism since no more than floor(number of nodes / 2) rebalancing tasks can possibly be scheduled to execute while obeying the invariant. The order of tasks are randomized within this class. The intent is to "spread" rebalancing work smoothly out over the cluster and avoid "long tails" of straggler rebalancing tasks. Only experience will tell us if we need to do anything smarter.
Constructor Summary | |
---|---|
RebalanceScheduler(java.util.concurrent.ExecutorService service,
int maxParallelRebalancing)
|
Method Summary | |
---|---|
void |
addNodesToWorkerList(java.util.List<java.lang.Integer> nodeIds)
Add nodes to the workers list |
void |
doneTask(int stealerId,
int donorId)
Method must be invoked upon completion of a rebalancing task. |
protected void |
initializeLatch(int size)
Initialize the count down latch. |
protected void |
populateTasksByStealer(java.util.List<StealerBasedRebalanceTask> sbTaskList)
Go over the task list and create a map of stealerId -> Tasks |
void |
removeNodesFromWorkerList(java.util.List<java.lang.Integer> nodeIds)
Removes nodes from the workers list |
void |
run(java.util.List<StealerBasedRebalanceTask> sbTaskList)
Set up scheduling structures and then start scheduling tasks to execute. |
protected StealerBasedRebalanceTask |
scheduleNextTask(boolean executeService)
Schedule at most one task. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RebalanceScheduler(java.util.concurrent.ExecutorService service, int maxParallelRebalancing)
Method Detail |
---|
protected void initializeLatch(int size)
size
- of the task listprotected void populateTasksByStealer(java.util.List<StealerBasedRebalanceTask> sbTaskList)
sbTaskList
- List of all stealer-based rebalancing tasks to be
scheduled.public void run(java.util.List<StealerBasedRebalanceTask> sbTaskList)
sbTaskList
- List of all stealer-based rebalancing tasks to be
scheduled.protected StealerBasedRebalanceTask scheduleNextTask(boolean executeService)
executeService
- flag to control execution of the service, some tests pass
in value 'false'
public void addNodesToWorkerList(java.util.List<java.lang.Integer> nodeIds)
nodeIds
- list of node ids.public void removeNodesFromWorkerList(java.util.List<java.lang.Integer> nodeIds)
nodeIds
- list of node ids.public void doneTask(int stealerId, int donorId)
stealerId
- donorId
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |