Repository navigation
Design Documentation
Note: these use cases are outdated. RadarGun has currently many more stages implemented in order to allow resilience and elasticity testing (dynamic changes of the cluster), monitoring and profiling and behaviour checking.
- Master (M) starts, slaves (S) start and register to M. M waits until expected number of slaves are registered.
- M broadcasts a
StartClustermessage to all S. The message contains the name of the grid product to be used (CacheWrapperimplementation) and all needed params. - Each S receives the
StartClustermessage, and sets up theCacheWrapper. It sends back to the M a confirmation message that theCacheWrapperwas successfully started. - M blocks until it receives the confirmation message from all S.
- M broadcast an
StressTestWarmupmessage. - Each S receives the
StressTestWarmupmessage, performs an warms up theCacheWrapperinstance and sends a message back to the M to confirm warm up is complete. - M blocks until it receives the confirmation message from all S.
- M sends a
StressTestmessage to all S. - Each S receives the
StressTest, runs the test and sends back to the M the result of the tests (e.g. duration, average put time, average get time). - M blocks until it receives test result from all S.
- M sends a
DestroyWrappermessage to all S. - Each S stops the
CacheWrapperand exits. - M generates reports
- Master exits.
- One of the S cannot start the
CacheWrapper. Sends back a message to M informing that. - M receives confirmation from all slaves and decides (based on a config) that it wants to continue the benchmark. continue with step 7
In order to make sure that the CacheWrapper was correctly set and that the underlying grid is formed, one might want to add an additional step to check that, before doing the warmup.
User can do this by implementing a framework extension and updating the configuration. The functionality would look something like this:
4.1. M broadcasts a ClusterValidation message to all S
4.2. all S perform a custom validation as needed and report to M
4.3. M blocks until all validations are received and proceeds (or not, based on the received messages) to continue with step 5.
A user realizes that there is a more efficient way of running a benchmark on 2,4,6,8,10,12 slaves: instead of starting cluster on 2 slaves, run tests, stop the cluster and start again with 4 slaves etc, a better approach may be to:
- run test on 2 slaves
- clean all the state of the nodes
- start the
CacheWrapperon 2 more slaves and wait for new cluster to form (4 members this time) - run test on 4 slaves
- clean state on all nodes and start again by adding 2 more nodes, etc.
You can do this by implementing framework extensions for:
- cleaning up the state between runs
- start more servers
- wait for cluster re-size
the description below is deprecated
10.1 M broadcasts a ClearCluster message to all S
10.2 S cleans all owned state
10.3 M broadcasts a StartCluster message to all S. Message contains currentClusterSize and number of slaves on which to start CacheWrapper
10.4 all S receive the message. S that have the index < currentClusterSize take no action. Slaves that have index >= currentClusterSize start a new CacheWrapper and confirm startup to M
10.5 M broadcasts an ValidateClusterSize message to all S
10.6 Each S receives the ValidateClusterSize message and confirms new size to the M
10.7 M blocks until all validations are received and proceeds (or not, based on the received messages) with 5.
- in order support high scalability (run tests on 1000 nodes or more) a master (M) will coordinate the slaves (S) in order to run the benchmark
- NIO should be used on the master node,
java.net.(Server)Socketdoes not scale well to this level
Generally speaking, a benchmark process is sequence of stages:
- start cluster stage: starts the
CacheWrapperon all slaves - warmup stage: on each slave execute a set of operations to allow JVM JIT compilers to kick in
- run test: executes the actual test, on each slave. E.g. a web session simulation test that performs a number of reads and writes on a set of keys, on each node, at the same time, on each slave. At the end of the test reports are sent to the master.
- generate reports stage, that gathers all reports from previous stage and aggregaes them (e.g. a CSV file) - Stop cluster stage, in which all slaves stop their associated
CacheWrapper
All stages (except generate report, which only happens on the M) follow this pattern:
M -> broadcast to all S
S -> execute logic and send ack to M
M wait for all ack. Based on all ack, decide whether we should move to next stage.
Report generation is a stage that only happens on M.
for (Stage stage: List<Stage>) {
if (!isDistributedStage(stage)){
stage.executeOnMaster();
continue;
}
stage.initOnMaster();
broadcast(stage);
Set<Resp> responses = readRespFromAllSlaves();
boolean shouldContinue = stage.processResponses(responses);
if (!shouldCountinue) break;
} while (masterRunning) {
Stage stage = readStage();
Resp resp = stage.executeOnSlave();
serializeRespToServer(resp);
}Each distributed stage (StartClusterStage, WarmupStage, StressTestStage) has to implement the DistributedStage interface. For convenience you can use the AbstractDistStage as base class.
Also, the stage class should be marked with the @Stage annotation. This annotation has required parameter doc: You should provide brief documentation here instead of using JavaDoc or plain comments. This documentation will be provided to the user as the documentation element in XML schema.
Stages usually have several properties that modify the behaviour/parameters of the stage. Each such property is a field (usually private or protected one) marked with the @Property annotation. Similarly to the @Stage, the doc parameter is mandatory as well and its content will be provided in the XML schema.
The properties with common types (primitives, strings, enums, collections of those etc.) will be filled in automatically, if you need custom conversion (such as for time) you have to implement the converter and provide its class to the converter paremeter of the annotation.
The field name will be used as the XML attribute by default - you can override this by specifying the name parameter. You can also specify deprecatedName as the previously used name for this attribute, if you're refactoring your stages and don't want to break backwards compatibility.
After the stage finishes an instance of DistStageAck is sent from each slave to the master.
DistStageAck might be extended for certain stages that need to send more information back to the server. E.g. for StressTestStage we want to send back the statistic for operations executed on CacheWrapper.
There is a different interface for stages that only execute on the master. MasterStage doesn't need to be Serializable. The annotation mechanisms are otherwise similar to distributed stages.
See benchmark.xml for an example of a RadarGun configuration.
If you want to specify different benchmark configuration, use the -config my-benchmark.xml as an argument to the LaunchMaster.main(...) or master.sh -c my-benchmark.xml if you are running RadarGun using the script.
The configuration file resides on the M. A configuration parser will create a list of stages and pass it to the algorithm running on M, as described above.