diff --git a/tools/jmeter/build.gradle b/tools/jmeter/build.gradle index 9b483ac9f2..75c556471b 100644 --- a/tools/jmeter/build.gradle +++ b/tools/jmeter/build.gradle @@ -56,7 +56,7 @@ task(runSsh, dependsOn: 'classes', type: JavaExec) { // Run JMeter (by default the UI). // Extra args can be passed by setting jmeterArgs (e.g. -n to run in non-UI mode). -// e.g. .gradlew tools:jmeter:run -PjmeterArgs="['-n']" +// e.g. ./gradlew tools:jmeter:run -PjmeterArgs="['-n']" // ssh tunnels will be built from local host to remote hosts by specifying jmeterHosts // e.g. ./gradlew tools:jmeter:run -PjmeterHosts="['perf-notary.corda.r3cev.com', 'perf-node-1.corda.r3cev.com']" // Each host is paired with local host ports listed in remote_hosts of jmeter.properties diff --git a/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/README.md b/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/README.md new file mode 100644 index 0000000000..7166f8678f --- /dev/null +++ b/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/README.md @@ -0,0 +1,48 @@ +This module contains gradle tasks to make running the JMeter (http://jmeter.apache.org) +load generation tool against Corda nodes much easier and more useful. It does this by +providing a simple way to launch JMeter with the actual JMeter install coming +from downloaded dependencies, and by providing some Samplers that interact with +the Corda node via RPC. + +To run up the JMeter UI, using the jmeter.properties in the resources folder, +type the following: + +./gradlew tools:jmeter:run + +You can then open the example script in "Example Flow Properties.jmx" via the File -> Open menu option. You need to +configure the host, ports, user name and password in the Java Sampler that correspond to your chosen target Corda node. +Simply running from the UI will result in the RPC client running inside the UI JVM. + +If you wish to pass additional arguments to JMeter, you can do this: + +./gradlew tools:jmeter:run -PjmeterArgs="['-n', '-Ljmeter.engine=DEBUG']" + +The intention is to run against a remote Corda node or nodes, hosted on servers rather than desktops. To +this end, we leverage the JMeter ability to run remote agents that actually execute the tests, with these +reporting results back to the UI (or headless process if you so desire - e.g. for automated benchmarks). This is +supplemented with some additional convenience of automatically creating ssh tunnels to the remote nodes +(we don't want the JMeter ports open to the internet) in coordination with the jmeter.properties. +The remote agents then run close to the nodes, so the latency of RPC calls is minimised. + +A Capsule (http://www.capsule.io) based launchable JAR is created that can be run with the simple command line + +java -jar jmeter-corda-.jar + +Embedded in the JAR is all of the corda code for flows and RPC, as well as the jmeter.propeties. This +JAR will also include a properties file based on the hostname in the JMeter configuration, +so we allocate different SSH tunneled port numbers this way. + +To launch JMeter with the tunnels automatically created: + +./gradlew tools:jmeter:run -PjmeterHosts="['hostname1', 'hostname2']" + +The list of hostnames should be of at least length one, with a maximum equal to the length of the remote_hosts +option in jmeter.properties. We effectively "zip" together the hostnames and that list to build the SSH tunnels. +The remote_hosts property helps define the ports (the hosts should always be local) used +for each host listed in jmeterHosts. Some additional ports are also opened based on some other +parts of the configuration to access the RMI registry and to allow return traffic +from remote agents. + +The SSH tunnels can be started independently with: + +./gradlew tools:jmeter:runSsh -PjmeterHosts="['hostname1', 'hostname2']" \ No newline at end of file diff --git a/tools/jmeter/src/main/resources/Example Flow Request.jmx b/tools/jmeter/src/main/resources/Example Flow Request.jmx index 257573d05e..6a2d25cfcf 100644 --- a/tools/jmeter/src/main/resources/Example Flow Request.jmx +++ b/tools/jmeter/src/main/resources/Example Flow Request.jmx @@ -46,7 +46,7 @@ password - corda_is_awesome + Password Here =