Recently at CommerceHub, we have been putting more focus on getting reliable performance metrics for our applications. We’ve found that the best way to do this without using production data, is to run performance tests.
My team specifically wanted to test a REST API with a few high traffic end points. The tool we decided to use was Gatling. Gatling is a load testing tool written in Scala which uses Akka to create a large number of users to fire requests at a target URL. We chose Gatling because it’s easy to set up and it produces very detailed reports.
Now that we had chosen our tool, we needed to figure out how to run our tests. We wanted to execute the tests, and be able to fail a build based on bad results. Our team uses Gradle as a build system so naturally our first instinct was to Google “gatling gradle plugin”. Unfortunately, we didn’t find anything that quite met our needs.
Seeing a need for executing Gatling tests through Gradle, we created our Gatling Gradle Plugin. This plugin allows us to publish our test results to Graphite, run multiple tests in a row, and fail if our application slowed down too much or is returning unexpected responses. We’ve employed the plugin in one of our Continuous Delivery pipelines to ensure that we aren’t releasing changes that greatly slow down our application. This plugin is now available in the CommerceHub OSS git repo.