问题
When I run my JMeter test with a large loop count (100 iterations on 15 HTTP requests) on my thread group I get an enormous JTL file out of JMeter.
This is a problem for the jmeter-maven-plugin I'm using (https://github.com/jmeter-maven-plugin/jmeter-maven-plugin) which uses a java.util.Scanner to scan the JTL file looking for "false" to see if the tests fail. Because the file is so big (1.8GB) I get the following failure.
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:1.10.1:jmeter (jmeter-tests) on project performance-tests: Execution jmeter-tests of goal com.lazerycode.jmeter:jmeter-maven-plugin:1.10.1:jmeter failed. IllegalArgumentException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:1.10.1:jmeter (jmeter-tests) on project performance-tests: Execution jmeter-tests of goal com.lazerycode.jmeter:jmeter-maven-plugin:1.10.1:jmeter failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution jmeter-tests of goal com.lazerycode.jmeter:jmeter-maven-plugin:1.10.1:jmeter failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: java.lang.IllegalArgumentException
at java.nio.CharBuffer.allocate(CharBuffer.java:334)
at java.util.Scanner.makeSpace(Scanner.java:840)
at java.util.Scanner.readInput(Scanner.java:795)
at java.util.Scanner.findWithinHorizon(Scanner.java:1685)
at com.lazerycode.jmeter.FailureScanner.hasTestFailed(FailureScanner.java:36)
at com.lazerycode.jmeter.JMeterMojo.parseTestResults(JMeterMojo.java:70)
at com.lazerycode.jmeter.JMeterMojo.execute(JMeterMojo.java:54)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
I'm working around this using ignoreResultFailures = true as a parameter to the jmeter-maven-plugin which avoids it using the java.util.Scanner and failing. Ideally the jmeter-maven-plugin would handle the very large JTL file, but the size of the JTL file seems a bit extreme.
Are there any JMeter settings that can reduce the size of the JTL file?
回答1:
Check to see if your test plan has "Functional Test Mode" enabled.
http://jmeter.apache.org/usermanual/listeners.html
The information to be saved is configurable. For maximum information, choose "xml" as the format and specify "Functional Test Mode" on the Test Plan element. If this box is not checked, the default saved data includes a time stamp (the number of milliseconds since midnight, January 1, 1970 UTC), the data type, the thread name, the label, the response time, message, and code, and a success indicator. If checked, all information, including the full response data will be logged.
If checked, this will result in a large JTL file because all the verbose request and response data is saved. Maybe you turned this on to debug your tests and forgot to turn it off?
回答2:
It looks like you're storing too much, i.e. response data which causes large overhead. So it is recommended to:
- use CSV output format
- do not store response data (at least for successful samplers)
So add the next 2 lines in user.properties file (lives under /bin folder of your JMeter installation)
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.response_data=false
You need to restart JMeter to pick the changes up.
Example "good" results saving configuration should look like:
Reference material:
- JMeter Best Practices
- 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure
来源:https://stackoverflow.com/questions/34865446/jmeter-maven-mojo-throws-illegalargumentexception-with-large-jtl-file