When we do an intensive load testing with JMeter / Response data processing, we might be very careful with the type of post processor / scripting language we choose.
In this post I would like to show how these post processor / script language affects the overall performance of the test.
We would be comparing below post processors & script languages.
- BeanShell PostProcessor
- BSF PostProcessor – Beanshell
- BSF PostProcessor – Javascript
- BSF PostProcessor – Groovy
- JSR223 PostProcessor – Beanshell
- JSR223 PostProcessor – Javascript
- JSR223 PostProcessor – Groovy
Test Plan:
As we have done in this post, We would be using a simple test plan without any external dependencies / timers etc as shown below to analyze the performance of these post processors accurately.
I used the JMeter 3.0 for this test.
All the Latency and ResponseTime simulation have been set 0.
We use a Dummy Sampler to simulate hard coded response.[For response data, I took the document innertext of this page. It has more than 56000 words in it]. We would do a post processor and in the post processor, we would be splitting huge response data string into an array using this delimiter ” “. We will iterate all the elements in the array and call the toUpperCase() method. [I know it sounds stupid. Aim here is to do some very time consuming operation].
Thread Group loop count is set to 1000. We will be repeating this process 1000 times and measure the time it takes.
Beanshell PostProcessor:
I added a Beanshell post processor to the test as shown below. I ran the test. The test took exactly 50 seconds to complete.
BSF PostProcessor – Language: Beanshell
I removed the Beanshell post processor and added BSF Post processor and chose the language as Beanshell. I ran the test. The test took exactly 54 seconds to complete.
BSF PostProcessor – Language: Javascript
With Javascript, The test took around 46 seconds to complete.
BSF PostProcessor – Language: Groovy
With Groovy, The test took around 24 seconds to complete.
JSR223 PostProcessor
I did the same test with JSR223 PostProcessor for different languages like Beanshell, Javascript and Groovy.
Conclusion:
After repeating the same test couple of times, I get the results as shown here.
From the above results, Groovy seems to be performing much better compared to Beanshell and Javascript. I always used Beanshell for the pre/post processing before. I modified my tests to use Groovy engine after this. If your test plan consumes more time in pre/post processing activity, the performance result you get is not reliable. If we had used this approach to test an application performance, with different processors/script languages, we would have got completely different performance metrics for the application. For better performance of the JMeter test/more accurate performance metrics, It is recommended to use Groovy.
Happy Testing 🙂