Running RabbitMQ's PerfTest tool in CloudFoundry
I recently had to troubleshoot performance of an app running in Cloud Foundry (Pivotal CF specifically) trying to use RabbitMQ. The RabbitMQ team provides a great benchmarking tool that we can use to validate performance of a RabbitMQ cluster, and we can use that tool inside a container running in Cloud Foundry.
The following instructions assume you are using the CF CLI version 6.23.0+ (check with cf -v), and running against a Cloud Foundry that supports CC API v2.65.0+ (check with the
The following instructions assume you are using the CF CLI version 6.23.0+ (check with cf -v), and running against a Cloud Foundry that supports CC API v2.65.0+ (check with the
cf target
command after logging in to validate.)- First, download the latest RabbitMQ PerfTest zip archive from the link in the above paragraph. I used GitHub releases page for the project, and just grabbed the latest release.
- Next, paste the following contents into a file in the same directory as the ZIP file you downloaded called "manifest-rabbitperf.yml" (making sure to update the "path" part to reflect the actual name of the ZIP file you downloaded:
--- applications: - name: rabbitperf instances: 0 no-route: true path: rabbitmq-perf-test-1.4.0-bin.zip
- Now, open a terminal, and navigate to the directory you downloaded the ZIP file to, and push the tool to Cloud Foundry:
cf push -f manifest-rabbitperf.yml
- If you want to test against a brokered instance of RabbitMQ, and you have that service installed in your instance of Cloud Foundry, you can create an instance of that service and a service key for it to use to test against. In my case, I had an install of Pivotal CF with the RabbitMQ tile installed, so I created a service instance with
cf create-service p-rabbitmq standard myrabbit
, and then created a service key for it withcf create-service-key myrabbit perfkey
. Then, from the output ofcf service-key myrabbit perfkey
I was able to grab the first element in the "uris" array to run my loadtest against. - Next, in the terminal, run an instance of the performance test with the following command (replacing amqp-uri with the uri from the service key you created above, or your preferred URI):
cf run-task rabbitperf "JAVA_HOME=.java-buildpack/open_jdk_jre rabbitmq-perf-test-*/bin/runjava com.rabbitmq.perf.PerfTest -x 1 -y 1 -a -h
" --name perftest1 - After launching the test, I could then monitor the RabbitMQ console for performance stats. If you want to track the output of the PerfTest tool, you can execute
cf logs rabbitperf
in another window to track the output of that task run.
cf tasks rabbitperf
command, and then looking in the output for the ID of the running task you want to terminate. Then you can call (replacing
with the ID of the task to kill) cf terminate-task rabbitperf
to stop the task.
Comments