Docs
  • 0.57.0latest
  • 0.56.0
  • 0.55.0
  • 0.54.0
  • 0.53.0
  • 0.52.1
  • 0.52.0
  • 0.51.0
  • 0.48.0
  • 0.47.0
  • 0.46.0
  • 0.45.0
  • 0.44.0
  • 0.43.0
  • 0.42.0
  • 0.41.0
  • 0.40.0
  • 0.39.6
  • 0.39.5
  • 0.39.3
  • 0.39.2
  • 0.39.1
  • 0.39.0
  • 0.38.4
  • 0.38.2
  • 0.38.1
  • 0.37.1
  • 0.37.0
  • 0.36.2
  • 0.36.1
  • 0.36.0
  • 0.35.3
  • 0.35.2
  • 0.35.1
  • 0.35.0
  • 0.34.4
  • 0.34.3-beta
  • 0.34.2-beta
  • 0.34.1-beta
  • 0.34.0-beta
  • 0.33.4-beta
  • 0.33.3-beta
  • 0.33.2-beta
  • 0.33.1-beta
  • 0.33.0-beta
  • 0.32.0-beta

The load balancer: the cluster moves work by itself

DEFINE BALANCER declares a load pass on the balancing round's own cadence: above a margin inside a window the pass sheds a placement to an idle voter, and draining a node re-places what it led — no balance statement, no coordinator, the catalog is the authority.

A cluster can watch its own load and re-home work without an operator acting and without anything standing beside the database. The balancer is a catalog row, declared like everything else the cluster knows; the pass runs on the balancing round's own cadence, with the same authority and the same logging.

Splitting and leadership moves arrived long ago — a table's shards change while it serves, and ALTER REPLICA … LEADS moves a placement by hand. What the balancer adds is the trigger: until now the only load-blind part was that a move waited for a person. From 0.50.0 the trigger is measured load.

Declaring the pass

DEFINE BALANCER LOAD ABOVE 1.5 WITHIN 10s SPACING 1s;
INFO FOR NODE;
DROP BALANCER;

LOAD ABOVE 1.5 names the margin: this node's own load, measured against its voters', running above 1.5× inside the WITHIN window asks for an act. The pass sheds one placement — a range this node leads — onto an idle voter, never twice within SPACING, and never the whole range at once: a move that would overshoot is declined, on the rule that work moved whole onto an idle node flaps back one spacing apart. A margin at or below 1, a spacing shorter than the lease, or a window shorter than the cadence is refused at the declare, a checked set the way DEFINE FAILOVER keeps one.

The figures behind the act are the ones a committer can verify: the node's own resource readings and its voters', heard over the peer link and labelled by age, and the leadership rows the log recorded. Nothing the balancer consumes is a claim only the balancer can see.

Draining a node re-places what it led

ALTER REPLICA warsaw ROLES NONE;

Draining is a role state on the member row, and a drained node's placements do not wait for a failover. The pass's drain branch moves what the node led onto the survivors — a store leader's shard lands on an idle voter with no BALANCE LEADERSHIPS anywhere in the run, measured before the spelling shipped: two runs out of two, the move logged and the taker serving writes. Everything else on the row stands: the address, the identity, the subscription. The node is a member that leads nothing; putting it back is the same statement with its roles named again.

Watching it

INFO FOR NODE answers the declared policy under cluster.balancer — the margin in hundredths (a reader divides by a hundred rather than the report guessing a float), the window and the spacing, and the row's epoch and version. /metrics carries tessari_balancer_load_moves_total beside the existing balancer_moves_total, so a dashboard can tell a load-driven move from a count-balancing one. The web console's cluster section renders the row where the topology reads.

The balancer composes with the bounds the cluster already keeps: the anti-flapping discipline of MIN/MAX SHARDS and the spacing clock are the balancer's own, and a refused act is logged at warn with its reason, the way every act on the round is.