Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


We only want one member to be automatically rebalancing a given region. So each member that starts auto rebalancing will try to get a distributed lock. If the member obtains the lock it will do the auto rebalancing until rebalance completes. Otherwise it continue to wait for the next cycle and repeat.

At the scheduled interval the auto-balancer will check the balance of the system. It will do that by calling PartitionRegionHelper.getPartitionRegionInfo and fetching the size of all of the regions in bytes from all members. It will sum the colocated regions together (like rebalancing does). 

Note that this means there is a limitation that members configured with the auto rebalancer have all of the regions defined, because otherwise some regions may not be rebalanced. 


PlantUML
aligncenter
(*) --> "Init Cache"
--> "Init Auto-Balancer"
--> "Wait for next slot" as schedule
--> "Start execution"
if "DLock acquired?" then
  -left->[No] schedule
else
  --> [Yes] if "Start "cluster execution"
  --> if "balanced?" then
    --> [No] schedule
  else
    --> [Yes] "Invoke Rebalance"
    --> "Wait for completion"
    --> schedule
  endif
endif

Testing

We will need to add auto rebalancing to some existing tests and give it a schedule that will cause it to run during the test. We will also need to write unit tests for the rebalancing triggering and scheduling logic.

...