Performance comparison of groovy and BeanShell scripts in JMeter

Source: Internet
Author: User
Tags truncated

After comparing the performance of the common post processor, we also compared the following groovy and BeanShell

2 are JVM-based scripting languages, and 2 can use Java syntax and class libraries directly

These foreign websites are recommended for groovy:

Http://jmeter.apache.org/usermanual/best-practices.html

http://www.ubik-ingenierie.com/blog/magento-performance-toolkit-and-jmeter-best-practices/

Https://blazemeter.com/blog/beanshell-vs-jsr223-vs-java-jmeter-scripting-its-performance

Because JMeter supports a bunch of scripting languages, only it has pre-compiled

On JMeter's Chinese website, there is little mention of groovy, and it is not known how much faster it has been compared to pre-compilation.

Just sit around and try.

Environment: JMeter 2.13, JDK 1.8u73, JVM parameters have never been moved, win ten Pro

In the project I was directly on groovy, can be tested with ready-made scripts:)

Generate a random phone number of the script, the comments will not be truncated

The common method of extracting to another script, irrelevant and not truncated.

Static compilation for efficiency (see here for performance comparison)

Whenever this script is changed, to recompile with GROOVYC (the generated class file is the same as Java, you can see the Java code with Jad decompile)

This class file is referenced by other scripts

The scripts directory has been added to the JMeter properties file, so you can refer to this file anywhere.

To test, create a BeanShell script file, which is the text document to change the suffix to. BSH

Do not know how BeanShell style, direct set of Java syntax

Now the 2 side is doing the same thing, and the BeanShell script has a few more calls

We enter the JMeter and build the following test plan:

Temporarily unnecessary components first CTRL + T disable

Test the simplest Hello World first, and the sampler is configured as follows:

* To download and install groovy First, locate the Embeddable folder in the installation directory and copy the Groovy-all-2.x.x.jar to the Lib folder under the JMeter installation directory.

Then restart JMeter to see the groovy options in the jsr223 menu.

* Cache key to write anything, to ensure that the only line. Write the script directly below to write the cache key to pre-compile

Restart JMeter, run the test 1 times, see the JMeter Command Line window with the correct output

Yet 2 sides are ridiculously slow, especially groovy.

Let's clear the record, and after the warm-up, look good.

It's about the same as n times, groovy never less than 10 milliseconds.

A Hello world is more than 10 times times slower 3~ than BeanShell, can it be used?

Let's see if we can get a decent script and run a lot of times.

The first 2 samplers are set up as follows:

is to fill in the path of the script file and pass a variable name to the script, nothing special

It is important to note that groovy has to be precompiled as long as the external script file is used, without having to fill in the cache key

Cycle through 1 debugs with 1 threads

Modify Thread group set to: 10 threads, 1 seconds rally (0.1 seconds to 1), 60 seconds, no startup delay

CTRL + T disables unrelated components (grayed out ones), and note that all listeners are turned off, as the next step is to run with the command line, keeping them slow down the throughput rate

Turn off the interface, run the test with the command line and the results are as follows:

BeanShell

Re-enter the interface changed to use jsr223 sampler, such as the CPU memory consumption of the table after the fall back to run, the results are as follows:

Groovy

Take a look at the lines of summary +, groovy is very slow at first, request time-consuming maximum scare, then reduce 10 times times, the end result is

3 times times the speed!

There's nothing to say, groovy is right (and Gradle and Jenkins also use it)

Ps:

The above test saves the report file in CSV format, using the following settings

Most of the data is not available here, and it is left to the most streamlined

If you use the usual settings, the report file is estimated to be 5 times times larger than

There are 4 columns left, and there seems to be no less.

Note that the most time-consuming is usually the first few times, then quickly, the statistics are ignored at the beginning of a certain period of time the data is good

Also PS:

The script for generating the phone number above is for the interface test, and the performance test is not generated on the spot.

Start with hundreds of thousands of plug-in databases or CSV files.

Performance comparison of groovy and BeanShell scripts in JMeter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.