OceanBase Database balances replicas within a load balancing group in terms of the number of replicas and disk load. On this basis, OceanBase Database further balances leaders within a load balancing group.
OceanBase Database evenly schedules the leaders of all partitions in a load balancing group to all OBServers in the primary zone of the load balancing group. The difference between the numbers of leaders on the OBServers in the primary zone is no greater than 1. Then, OceanBase Database evenly distributes the write load of the leaders in the load balancing group to all OBServers in the primary zone. For more information about the primary zone, see Primary zone.
Note
For more information about load balancing groups, see Automatic load balancing in Partition replica balancing.
Balancing results
This section describes the automatic balancing results of leaders.
Background information
A cluster in the system contains three zones: Zone1, Zone2, and Zone3. Two OBServers are deployed in each zone. A load balancing group contains 12 partitions whose replicas are evenly distributed across zones.
The following three scenarios show the balancing results of leaders when different primary zone configurations are used.
Scenario 1
In case of PrimaryZone='Zone1', leaders are evenly distributed to all OBServers in Zone1. The following figure shows the balancing results.

As shown in the figure, leaders of all the 12 partitions are distributed to Zone1, with six leaders on each OBServer.
Scenario 2
In case of PrimaryZone='Zone1, Zone2', leaders are evenly distributed to all OBServers in Zone1 and Zone2. The following figure shows the balancing results.

As shown in the figure, leaders of all the 12 partitions are evenly distributed to Zone1 and Zone2, with three leaders on each OBServer.
Scenario 3
In case of PrimaryZone='Zone1, Zone2, Zone3', leaders are evenly distributed to all OBServers in Zone1, Zone2, and Zone3. The following figure shows the balancing results.

As shown in the figure, leaders of all the 12 partitions are evenly distributed to Zone1, Zone2, and Zone3, with two leaders on each OBServer.