JMeter Maven mojo 使用大型 JTL 文件抛出 IllegalArgumentException [英] JMeter Maven mojo throws IllegalArgumentException with large JTL file

查看:21
本文介绍了JMeter Maven mojo 使用大型 JTL 文件抛出 IllegalArgumentException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在线程组上以大循环计数(15 个 HTTP 请求上的 100 次迭代)运行 JMeter 测试时,我从 JMeter 中得到了一个巨大的 JTL 文件.

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.

这是我使用的 jmeter-maven-plugin 的一个问题 (https://github.com/jmeter-maven-plugin/jmeter-maven-plugin),它使用 java.util.Scanner 扫描 JTL 文件,寻找false"以查看测试是否失败.由于文件太大(1.8GB),我遇到了以下失败.

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

我正在使用 ignoreResultFailures = true 作为 jmeter-maven-plugin 的参数来解决这个问题,这避免了它使用 java.util.Scanner 和失败.理想情况下,jmeter-maven-plugin 可以处理非常大的 JTL 文件,但 JTL 文件的大小似乎有点极端.

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.

是否有任何 JMeter 设置可以减小 JTL 文件的大小?

Are there any JMeter settings that can reduce the size of the JTL file?

推荐答案

检查您的测试计划是否启用了功能测试模式".

Check to see if your test plan has "Functional Test Mode" enabled.

http://jmeter.apache.org/usermanual/listeners.html

要保存的信息是可配置的.为了获得最大的信息,选择xml"作为格式并指定功能测试模式"测试计划元素.如果未选中此框,则默认保存的数据包括时间戳(自午夜以来的毫秒数,UTC 1970 年 1 月 1 日)、数据类型、线程名称、标签、响应时间、消息和代码,以及成功指示器.如果检查,将记录所有信息,包括完整的响应数据.

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.

如果选中,这将导致 JTL 文件很大,因为所有详细的请求和响应数据都已保存.也许您打开它是为了调试测试而忘记关闭它?

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?

这篇关于JMeter Maven mojo 使用大型 JTL 文件抛出 IllegalArgumentException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆