Repository navigation
Distributed Benchmarks
One of the most important purposes of RadarGun is to support benchmarking of distributed caches/data grids. Generally speaking, a benchmark on a distributed cache is performed as follows:
- a number of nodes are started, each living in its own process. A node is an instance of a distributed cache
- RadarGun waits until all these nodes see each other and form a cluster
- once the cluster is formed, RadarGun will warm up the cluster: run a set of operations (read+write) against each node in the cluster. This is in order to allow any JVM compiler optimizations to kick in (reproduce production-like environment)
- after the warm up is finished the actual benchmark is executed. Same benchmark code will be executed against each node within the cluster. Each benchmark stresses each node and records performance data, e.g. average write/read duration
- optionally, the same benchmark might be run again on greater number of nodes. This is useful for observing how performance is affected by the cluster size (i.e. how does the distributed cache scales out)
- optionally, same benchmark might be run on a different cache product, for comparative benchmarks
- at the end, a report is generated comparing the performance of different products, on different cluster sizes. Bellow is an example of such a generated report, comparing write performance between Infinispan and JBossCache
In order to be able to benchmark distributed caches, RadarGun is using a client/server architecture, in which the RadarGun control node (Master) coordinates multiple slaves. Each slave runs as an independent process, that handles one of the nodes of the benchmarked cluster. The Master has the following responsibilities:
- parse the configuration (see Configuration section bellow), and based on that give work to slaves
- the unit of work the master gives to slaves is named stage. E.g. here are the stages that might constitute an benchmark run:
- StartCluster - master broadcasts this stage to all slaves. Each slave will start an distributed cache node, and, after it it started acknowledge to the master. Once master has acknowledgment from all slaves it will move to the next stage.
- ClusterValidation. Now that all the nodes are started, the master will ask all the slaves to verify that they are part of the cluster. Each slave verifies and acknowledge to the master. . Once master has acknowledgment from all slaves it will move to the next stage.
- Warmup. When the slaves receive this stage, they will execute an set of read and write operations on each node of the cluster. The purpose of this is to to simulate a production environment by allowing the hot spot to kick in.
- BenchmarkStage. this is the actual test that will be monitored for performance.
- after broadcasting a stage to all slave, the master will block until all stages acknowledge the termination of it. Only after that the master will move to the next stage. If an error appears at any point (e.g. one of the nodes don't pass ClusterValidation stage) then the benchmark will be skipped.
For a complete reference of the architecture behind RadarGun please refer to the Design documentation
Here is where you can find the complete example. This section will take each individual element and detail it. An important aspect is the fact that the configuration will only be defined on the master, and it basically defines the way in which the master coordinates the slaves. Root element
<bench-config xmlns="urn:radargun:benchmark:1.1">Upcoming: During compilation RadarGun generates schema (XSD) with documented properties for all stages in the distributed benchmark. With this you can be sure that the properties in schema are always in sync with source code.
Master configuration
<master bindAddress="${127.0.0.1:bind.address}" port="2103"/>Master will open its sever socket at that address (host/port) and wait for connections from slaves. "${127.0.0.1:bind.address}" syntax can be read: if there is a system property named "bind.address" the use that one; otherwise default to "127.0.0.1". This way of specifying values can be used for all XML attributes. Benchmark configuration
<benchmark initSize="2" maxSize="4" increment="1">
<DestroyWrapper runOnAllSlaves="true" />
<StartCluster />
<ClusterValidation partialReplication="false" />
<StressTestWarmup duration="5m" />
<StressTest duration="15m" numThreads="5" />
<CsvReportGeneration />
</benchmark>In this section we define two two things:
- on how many nodes the benchmark will run. In this example, the benchmark will run on 2 nodes (initSize), 3 and then 4 nodes (maxSize). After each run, the cluster size is incremented with "increment", until the "maxSize" is reached. If the increment starts with * (star), the size will be multiplied instead of added.
- The benchmark workflow is defined by the stages:
- DestroyWrapper: this will make sure that the cluster is shut down between runs, e.g. after the benchmark is run on 3 nodes, before starting the 4 nodes cluster make sure that the 3 nodes one is off.
- StartCluster: this will start the cluster on an appropriate number of nodes (initSize <= nr. nodes <= maxSize).
- ClusterValidation: verifies that the cluster is formed. Each nodes does a put in the cluster on a unique key, and makes sure that it sees the values added by all other nodes. If "partialReplication" is set to true, will not wait for all elements to replicate, but acknowledge cluster formation when at least a key is seen.
- StressTestWarmup: warmup is almost identical to the StressTest but statistics are not stored.
- StressTest: the actual benchmark. Follow the link for a closer description.
- CsvReportGeneration this will generate file product_config_clusterSize.csv with the result of the StressTest. After all benchmarks end, this file will be used for generating charts for each operation (put/get). See Report generation section for the comparisons configuration.
- If you want to repeat a sequence of the stages, you can use the
Repeatelement. See Repeat description for details. - There are many other stages that you can use in your benchmark, and each has several configuration attributes. Here is a list of stages provided in the latest snapshot - however, this may be outdated. After you build RadarGun, a XML schema (XSD) is generated in framework/src/main/resources/radargun-version.xml with up-to-date list of stages and their attributes, including the documentation.
<products>
<infinispan4>
<config name="repl-async.xml"/>
<config name="repl-sync.xml"/>
<config name="dist-sync.xml"/>
<config name="dist-async.xml"/>
<config name="dist-sync-l1.xml"/>
<config name="dist-async-l1.xml"/>
</infinispan4>
<jbosscache3>
<config name="mvcc/mvcc-repl-sync.xml"/>
<config name="mvcc/mvcc-repl-async.xml"/>
</jbosscache3>
</products>In this section we configure what products we want to benchmark, and which configuration for this products we want to benchmark. In this example we benchmark two products: infinispan4 and jbosscache3. For each product we benchmark different configurations, each defined by an "config" element. The benchmark as defined in the previous section will be run against every (product, config) combo: infinispan4 configured with "repl-async.xml" file will be run on a cluster of 2, then 3, then 4 nodes. Once this is finished, RadarGun will run the next infinispan4 configuration (repl-sync.xml) on 2,3 the 4 nodes. After all infinispan4 configurations are done, jbosscache3's "mvcc/mvcc-repl-sync.xml" will be used on 2-4 nodes cluster, etc. There's no restriction on the number of configured products or configurations. In fact some cache wrappers may require additional wrapper-specific parameters, besides the configuration file. You can specify these as
<product name="infinispan52">
<config name="explicit" file="repl-udp-tx-pessimistic.xml">
<wrapper class="my.special.MyWrapper">
<property name="myProperty" value="foo" />
</wrapper>
</config>
</product>Alternatively, you may use the <config name="..." wrapper="my.special.MyWrapper" myProperty="foo"> to inline this expression, but it the XML won't pass schema validation in this case.
For some scenarios you may also want to pass different configuration to different slaves.
<product name="infinispan52">
<config name="three_sites">
<site name="LON" config="ispn-lon.xml" slaves="0,1,2" cache="lonCache"/>
<site name="NYC" config="ispn-nyc.xml" slaves="3,4,5" cache="nycCache"/>
<site name="SFO" config="ispn-sfo.xml" slaves="6,7" cache="sfoCache"/>
</config>
</product>However, the cache wrapper must understand this way of configuration.
#Report generation
<reports>
<report name="sync-repl">
<item product="infinispan4" config="repl-sync.xml"/>
<item product="jbosscache3" config="mvcc/mvcc-repl-sync.xml"/>
</report>
<report name="async-repl">
<item product="infinispan4" config="repl-async.xml"/>
<item product="jbosscache3" config="mvcc/mvcc-repl-async.xml"/>
</report>
<report name="dist">
<item product="infinispan4" config="dist-*"/>
</report>
<report name="all_included" includeAll="true"/>
</reports>In this last section report generation is configured. For each "report" element and graphical report will be generated that will only contain the specified items. The sample report presented in the Context section (at the top of the page) correspond to the first report configuration, named "sync-repl". This way of organizing reports, allows one to compare similar configuration of products, e.g.
it doesn't really makes sense to compare performance of sync replication for infinispan4 with the one of a async replication of jbosscache3. If you want all the items to be placed on the same report, use "includeAll" attribute - see "all-included" report.
The sequence in which RadarGun should be started is the following:
- start the master. Once started, the master will block until all the slaves connected to it. The number of slaves expected to connect is equal to
maxSizeattribute, from thebenchmarkelement - start
maxSize(see below) slaves - after all the slaves are started and connected to the master, the benchmark will start as described in the Architecture section
- after the master is started and all the slaves are connected, it is not possible to add/remove/replace slaves
- if one of the slave process fails unexpectedly, then master will shutdown itself and all slaves
- if the master is killed, all slaves shut down. This might take a while, depending on the length of the task the slave was executing at the time
RadarGun comes with a number of scripts that help starting the master and the nodes. They are present in the distribution:
- see Building Binaries for obtaining a distribution and about its content
- and Using The Scripts for information on what each scripts does and how it should be launched