FAQ How Do Rack-Aware and Prefer-Uniform-Balance interact?

FAQ: How Do Rack-Aware and Prefer-Uniform-Balance interact?


Both rack awareness and uniform balance affect the distribution of partitions across nodes. What happens when a cluster has both enabled?


Uniform balance does not take rack-id into account for the attribution of master partitions across the nodes in a cluster: it distributes the master partitions as evenly as possible across all nodes, regardless of any other attributes the nodes may have. Then, rack-awareness distributes the replica partitions so that every one is on a different rack from its corresponding master partition (and from the other replicas, if replication-factor is more than 2).

This example cluster has an exaggerated imbalance between racks (twice as many nodes in one rack as the other) to show how this works. You can see in the asadm -e info output that each of the three nodes has the same count of master objects, to within a tenth of a percent, as set by prefer-uniform-balance true. However, although the cluster as a whole has the same number of prole objects (as expectecd from replication-factor 2), half of them are on the single node in rack 1, and the rest are split between the two nodes in rack 2, leading to a 4:1 ratio of prole objects between nodes, and a 2:1 ratio of total objects (and also a 2:1 ratio of master objects, but in the other direction).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Namespace Object Information (2020-02-10 19:43:42 UTC)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Namespace                Node      Total     Repl                         Objects                   Tombstones             Pending   Rack
        .                   .    Records   Factor      (Master,Prole,Non-Replica)   (Master,Prole,Non-Replica)            Migrates     ID
        .                   .          .        .                               .                            .             (tx,rx)      .
test      4.889 M   2        (3.335 M, 1.554 M, 0.000)       (0.000,  0.000,  0.000)      (0.000,  0.000)     2
test      5.111 M   2        (3.333 M, 1.778 M, 0.000)       (0.000,  0.000,  0.000)      (0.000,  0.000)     2
test        4fb29f9ebb0d:3000   10.000 M   2        (3.332 M, 6.668 M, 0.000)       (0.000,  0.000,  0.000)      (0.000,  0.000)     1
test                            20.000 M            (10.000 M, 10.000 M, 0.000)     (0.000,  0.000,  0.000)      (0.000,  0.000)
Number of rows: 4


Although strong consistency mode uses a different command to set the rack-id of nodes, it doesn’t change the behavior described here.




February 2020

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.