Repository navigation
Measuring distribution
RadarGun can measure the number of keys that map to each node in a cluster. In an homogenous system an (ideally) equal distribution of keys across all nodes in a cluster is generally preferred - in order to avoid the overloaded nodes becoming bottlenecks. RadarGun offers support for measuring the distribution of keys in two ways:
-
Display (on the RadarGun master node) the number of keys assigned to each cluster node. This tells you how well the data grid distributes data across the cluster.
-
Offers a contrived perfect distribution model which equally distributes keys to all the nodes in the cluster. This way one can measure the performance impact uneven distribution has on system's throughput. In other words this tells how much performance can be gained by improving the data grid's distribution algorithm.
After the benchmark completes, distribution data can be obtained by running dist.sh on the RadarGun controller node.
[mmarkus@cluster10 RadarGun-1.1.0-SNAPSHOT]$ ./bin/dist.sh
Configuration : dist-sync.xml
Cluster size: 3 -> ( 2175 494 331)
Cluster size: 5 -> ( 500 660 1855 585 1400)
Cluster size: 7 -> ( 1775 487 37 239 1396 457 2609)
Cluster size: 9 -> ( 1548 3 545 2854 201 2025 7 1609 208)
Configuration : idealdistribution/dist-sync-ideal-distribution.xml
Cluster size: 3 -> ( 1000 1000 1000)
Cluster size: 5 -> ( 1000 1000 1000 1000 1000)
Cluster size: 7 -> ( 1000 1000 1000 1000 1000 1000 1000)
Cluster size: 9 -> ( 1000 1000 1000 1000 1000 1000 1000 1000 1000)
The script parses the RadarGun controller's log file and builds a distribution breakdown based on configuration and cluster size. In order to obtain the number of keys in a node RadarGun calls CacheWrapper.getLocalSize(). It is important to have this implemented correctly in order to have accurate results.
The following key format is used: (nodeIndex, threadIndex, keyIndex). Each key's state is fully defined by this tuple.
-
nodeIndex: the index of the node in the Radargun cluster, ranges from 0 to clusterSize (as defined inbenchmark.xml) -
threadIndex: the index of the thread running the Stress Test in the given node. Ranges from 0 to the Stress Test'snumThreadsattribute -
keyIndex: the index of the key within an thread, ranging from 0 tonumEntries(as defined within the Stress Test - number of key-value pairs per thread)
Based on this key structure, ideal consistent hash function operates as follows:
- the key set is defined as all the keys existing in the system. At any time there are
numKeys = numNodes * numThreads * numEntrieskeys in the system - for each key it builds an unique index within the key set, using the formula:
keyIndex = nodeIndex * numThreads * numEntries + threadIndex * numEntries + keyIndex - the index of the node where this key is mapped by the ideal consistent hash function is determined as follows:
keyIndex % clusterSize
- the function is consistent/deterministic
- the number of keys on each node is the same (or almost the same if
numKeys % clusterSize != 0) - each request (put/get) has an
1/clusterSizestatistical chance to be local (not go remotely).
At the moment the ideal distribution control test, as described in the previous section, is only implemented for the infinispan plugins.
Following configuration elements need to be added for enabling ideal distribution:
- The Stress Test's
keyGeneratorClassattribute should be set toorg.radargun.stressors.ObjectKeyGenerator. E.g.,
<StressTest numRequests="2500" opsCountStatusLog="500" numThreads="2" numEntries="100" keyGeneratorClass="org.radargun.stressors.ObjectKeyGenerator" />- The Infinispan configuration for which ideal distribution is to be used should be configured as follows:
<products>
....
</infinispan4>
....
<config name="idealdistribution/dist-sync-ideal-distribution.xml" threadsPerNode="2" keysPerThread="10"/>
</infinispan4>
</products>-
Relevant attributes are:
-
threadsPerNode: must have the same value as theStressTest/numThreads -
keysPerThread: must have the same value asStressTest/numEntries
The Infinispan xml configuration needs to be updated as well:
<hash numOwners="2" rehashEnabled="false" rehashRpcTimeout="60000" class="org.radargun.cachewrappers.EvenSpreadingConsistentHash"/>NOTE: The class element was renamed to consistentHashClass in post-4.0 releases of Infinispan.
The Infinispan plugin contains both a benchmark.xml and an Infinispan configuration file preconfigured with ideal consistent hashing - see files under the idealdistribution directory.
In order to run this locally (from the Radargun installation directory):
$ ./bin/master.sh -c plugins/infinispan4/conf/idealdistribution/benchmark-ideal-distribution.xml
$ ./bin/slave.sh -p 0
$ ./bin/slave.sh -p 1
$ ./bin/slave.sh -p 2
$ ./bin/slave.sh -p 3