Rebalancing Partitioned Data on GemFire XD Members

You can use rebalancing to dynamically increase or decrease your GemFire XD cluster capacity, or to improve the balance of data across the distributed system.

Rebalancing is a GemFire XD member operation that affects partitioned tables created in the cluster. Rebalancing performs two tasks:
  • If the a partitioned table's redundancy setting is not satisfied, rebalancing does what it can to recover redundancy. See Making a Partitioned Table Highly Available.
  • Rebalancing moves the partitioned table's data buckets between host members as needed to establish the best balance of data across the distributed system.

For efficiency, when starting multiple members, trigger the rebalance a single time, after you have added all members.

Note: If you have transactions running in your system, be careful in planning your rebalancing operations. Rebalancing may move data between members, which could cause a running transaction to fail with a TransactionDataRebalancedException.
Start a rebalance operation using one of the following options:
  • At the command line when you boot a GemFire XD server:
    gfxd server start -rebalance
  • Eexecuting a system procedure in a running GemFire XD member:
    call sys.rebalance_all_buckets();

    This procedure initiates rebalancing of buckets across the entire GemFire XD cluster for all partitioned tables.

How Partitioned Table Rebalancing Works

The rebalancing operation runs asynchronously.

As a general rule, rebalancing takes place on one partitioned table at a time. For tables that have colocated data, rebalancing works on the tables as a group, maintaining the data colocation between the tables.

You can continue to access partitioned tables while rebalancing is in progress. Queries, DML operations, and procedure executions continue while data is moving. If a procedure executes on a local data set, you may see a performance degradation if that data moves to another member during procedure execution. Future invocations are routed to the correct member.

For tables that are configured with expiration based on idle time, the rebalancing operation resets the last accessed time of the table entries on buckets that are moved.

When to Rebalance a Partitioned Table

You typically want to trigger rebalancing when overall capacity is increased or reduced through member startup, shut down or failure.

You may also need to rebalance when you use partitioned table redundancy for high availability, and you have configured your table to not automatically recover redundancy after a GemFire XD member fails (the default RECOVERYDELAY setting). In this case, GemFire XD only restores redundancy when you invoke a rebalance operation. See Making a Partitioned Table Highly Available.