How to Use the Composite Graph Plugin in JMeter
Apache JMeter™’s Composite Graph plugin is a listener that expands basic JMeter functionality, by presenting and correlating data of our choice from the script. The composite Graph listener allows us to choose rows from a listener’s graph and then displays them in a single graph, where it correlates various factors. For example, how the number of concurrent users impacts the response time from the server, or how the level of hits per second impacts the server CPU load. This listener can be useful for troubleshooting problems during test running, if any are presented.
As one old Russian proverb says: “It is better to see something once, than to hear about it one hundred times.” So let’s take a look at this listener in action with a real script.
First of all we need to set up this plugin. Visit the Composite Graph plugin’s official webpage to download the plugin and install it to your JMeter. If you need help with installing plugins you can find that information here: How to Install the JMeter Plugins Manager.
The Composite Graph Listener
The Composite Graph listener contains three tabs: Chart, Graphs and Settings.
The Chart tab displays a graph with all the chosen rows.
The Graphs tab contains three areas. Available Sources shows all available rows that can be added to the graph. Composed Graph shows the already selected rows. The arrow buttons are used for selecting and deselecting rows. The Preview area shows the same graph as on the Chart tab.
The Settings tab enables configuring graph display settings.
Great. We now have an overall view of the listener. Let’s try it in action.
We need to create a simple script to demonstrate the Composite Graph listener. Let’s use the BlazeDemo website to create a performance test. You also can use it for your experiments, since this website is open for everyone.
It’s time to start creating our script!
1. Add an Ultimate Thread Group to the Test plan.
Test plan -> Add -> Thread (Users) -> jp@gc – Ultimate Thread Group
Next, add the following row:
Start Threads Count: 200; Initial Delay, sec: 0; Startup Time, sec: 60; Hold Load For, sec: 30; Shutdown Time: 10.
This Thread Group will start 200 virtual users in one minute and hold this load for 30 seconds. Then all 200 users will be stopped within 10 seconds.
2. Add a Composite Graph to the Thread Group.
jp@gc - Ultimate Thread Group -> Add -> Listener -> jp@gc - Composite Graph
There’s no need to change anything in the element for now. Just browse through the 3 tabs of this element and get familiar with it.
3. Add an HTTP Request to open the landing page of the BlazeDemo website.
jp@gc - Ultimate Thread Group -> Add -> Sampler -> HTTP Request
Now fill in the following values:
- Name: Landing page
- Server name or IP: www.blazedemo.com
4. Add a Constant Timer to emulate more real behaviour.
Landing page -> Add -> Timer -> Constant Timer
Update the following value:
- Thread Delay (in milliseconds): 1000
This element will add a 1 second delay before each call to the server.
5. Add a View Results Tree listener to see the requests to the server.
jp@gc - Ultimate Thread Group -> Add -> Listener -> View Results Tree
This listener isn’t required for the current test, but it is very useful in general for debugging problems during script development.
6. Add a Response Times Over Time listener to see how the response time changes during the test.
jp@gc - Ultimate Thread Group -> Add -> Listener -> jp@gc - Response Times Over Time
7. Add an Active Threads Over Time listener to see how the count of virtual users changes during the test run.
jp@gc - Ultimate Thread Group -> Add -> Listener -> jp@gc - Active Threads Over Time
8. Add a Hits per Second listener to see the level of hits to the server during the test.
jp@gc - Ultimate Thread Group -> Add -> Listener -> jp@gc - Hits per Second
Now your script is ready!
9. Go to the Graph tab of the Composite Graph listener.
Even after adding the proper listeners, the Available Sources area is still empty. This is because there is no data to build graphs yet. We need to run the script to see available sources there.
10. Push the start button!
The Available Sources area will be filled with available rows from the added listeners. Now we can choose rows and add them to the Composite Graph.
11. Add some rows to the Composed Graph section.
Add the following rows from the left section:
- jp@gc - Active Threads Over Time > Overall Active Threads
- jp@gc - Hits per Second > Server Hits per Second
- jp@gc - Response Times Over Time > Overall Response Times
We can see three lines on the Preview graph. The first shows the number of active threads during the test run. The second shows the number of hits per second during the test run. The third shows the overall response time during the test run.
11. Wait until the end of the test.
Let’s analyse what we see in the graph. The Response time graph has some peaks, but it is quite stable in general. This means that the server copes well with this load. The Hits per Seconds graph closely matches the Active Threads graph which is correct: more virtual users will cause more server hits.
In this case we didn’t run into any problems during our load test, but what if we had?
12. Update the target number of Threads to 500.
Update the following row:
Start Threads Count: 500; Initial Delay, sec: 0; Startup Time, sec: 60; Hold Load For, sec: 30; Shutdown Time: 10.
We have increased the max load by 2.5 times. Let’s see how the server handles it.
13. Run the test again.
In the graph above we can see that server behaves normally for about 1 minute and 15 seconds. After that point the response time grows and the hits per second decreases significantly.
Try opening the BlazeDemo landing page right after this test.
The page is unreachable. This shows that server can’t handle this load and becomes unavailable. So the Composite Graph helped us see the exact moment the server stopped responding.
I have found this listener very useful in my load testing and suggest that you give it a try in your advanced test scripts!
Then you can enhance your testing by running your JMX script in BlazeMeter. You will get even more advanced analytics like trends over time, as well as the ability to run your test from multiple geo-locations, reports sharing, and more! Try us out by putting your URL in the box below.