Load Testing with Apache JMeter, InfluxDB, and Grafana

Apache JMeter is a great tool for load testing APIs. You can define your API requests, run your tests, and measure throughput and other metrics. Admittedly, I don’t find it to be most intuitive tool to get started with but once you get the hang of it makes sense and you start to understand why it’s designed the way it is.

You can extend JMeter’s already powerful functionality with plugins. Download the Plugins Manager jar, place it in JMeter’s lib/ext directory, and restart JMeter. Under the Options menu you will now see a Plugins Manager item. Click it to see and download available plugins. I find the “3 Basic Graphs” and the “Throughput Shaping Timer” plugins to be especially useful. There are great resources that show how to use those plugins so I won’t duplicate it here. But, with those plugins you can design a load test by specifying your target throughput over time.

JMeter’s built-in graphs provide a decent look at the metrics captured but the first thing you will likely learn is that running JMeter tests using the GUI is not a good idea. Running your tests from the command line provides much better performance. Unfortunately, this makes it harder to observe the tests in progress. But we can work around this by including another plugin that sends the metrics to an InfluxDB. We can then use a Grafana dashboard to visualize the metrics in easy to understand charts and graphs.

First, download the JMeter plugin to send metrics to InfluxDB. Once downloaded, move it to JMeter’s lib/ext directory and restart JMeter. Add a new Backend Listener and select org.md.jmeter.influxdb2.visualizer.JMeterInfluxDBBackendListenerClient from the dropdown. Now, modify the InfluxDB parameters to match your InfluxDB configuration.

You are now ready to connect Grafana to InfluxDB. Using the shared dashboard, select your InfluxDB database. Now you will be able to see your JMeter metrics on the Grafana dashboard.

This is a great example of several open source projects coming together to provide a really useful but still simple solution.

Notify of
Inline Feedbacks
View all comments