metafora
metafora copied to clipboard
Tick based balancing instead of time
Currently Metafora rebalances every 15 minutes ±10 seconds.
The main loop serializes all events via ticks, so we could switch to rebalancing every N
ticks.
The theoretical advantage of tick-based balancing is that Metafora would only rebalance when the cluster's state actually changes.
Pros
Could reduce needless task juggling (or at least needless Balance()
calls) in stable clusters.
Cons
However, the following cluster events don't cause main loop events and therefore wouldn't trigger tick-based rebalancing:
- Remote node finishes a task
- New node joins cluster
We could handle those two events by:
- Also doing time based balancing
- Having the Coordinator inform the main loop of these events (could probably create a synthetic noop
ClusterEvent
command).
Is rebalancing an issue currently? A time based method seems more KISS, because it doesn't rely on the event loop and balance calls being as tightly coupled.
@epsniff Not currently. This is just me getting ahead of myself. :) Definitely not going to work on this without some proof it's an issue.