首页 > 解决方案 > 在 Jmeter-maven-plugin 中完成测试计划执行后看到的 JMeter Java HEAP 问题

问题描述

JMeter 测试似乎完成得很好。

但是由于堆问题,缺少“14:48:37 [info] Completed Test: FssBenchmark.jmx”之后的下一个输出。

下一行通常应该是,

[INFO] Test Results:
[INFO]  
[INFO] Tests Run: 1, Failures: 0

已将堆增加到 2048。 堆问题。

[INFO] summary +      3 in 00:00:05 =    0.6/s Avg:  1651 Min:     1 Max:  2810 Err:     0 (0.00%) Active: 0 Started: 53 Finished: 53
[INFO] summary =    100 in 00:03:15 =    0.5/s Avg:  3664 Min:     1 Max: 47594 Err:     0 (0.00%)
[INFO] Tidying up ...    @ Wed Sep 15 18:33:06 UTC 2021 (1631730786136)
[INFO] ... end of run
[INFO] Completed Test: FssBenchmark.jmx
[INFO]  
[INFO] Executing test: FssStreamTest.jmx
[INFO] Writing log file to: /integration-tests/target/jmeter/logs/FssStreamTest.jmx.log
[INFO] WARNING: An illegal reflective access operation has occurred
[INFO] WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/integration-tests/target/jmeter/lib/xstream-1.4.9.jar) to field java.util.TreeMap.comparator
[INFO] WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
[INFO] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[INFO] WARNING: All illegal access operations will be denied in a future release
[INFO] Creating summariser <summary>
[INFO] Created the tree successfully using /integration-tests/target/jmeter/testFiles/FssStreamTest.jmx
[INFO] Starting the test @ Wed Sep 15 18:33:07 UTC 2021 (1631730787166)
[INFO] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
[INFO] summary +     13 in 00:00:24 =    0.6/s Avg:  1721 Min:   534 Max:  3115 Err:     0 (0.00%) Active: 1 Started: 2 Finished: 1
[INFO] summary +     10 in 00:00:13 =    0.8/s Avg:  1273 Min:   535 Max:  2804 Err:     0 (0.00%) Active: 0 Started: 4 Finished: 4
[INFO] summary =     23 in 00:00:36 =    0.6/s Avg:  1526 Min:   534 Max:  3115 Err:     0 (0.00%)
[INFO] Tidying up ...    @ Wed Sep 15 18:33:43 UTC 2021 (1631730823796)
[INFO] ... end of run
[INFO] Completed Test: FssStreamTest.jmx
[INFO] 
[INFO] --- jmeter-maven-plugin:2.1.0:results (default-cli) @ integration-tests ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  04:37 min
[INFO] Finished at: 2021-09-15T18:33:45Z
[INFO] ------------------------------------------------------------------------
[ERROR] Java heap space -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError
[INFO] Shutdown detected, destroying JMeter process...
[INFO] Shutdown detected, destroying JMeter process...

标签: javaout-of-memoryheap-memoryjmeter-3.2jmeter-maven-plugin

解决方案


听起来您没有为 JMeter 进程配置足够的 xmlx 内存。您可以在插件的配置设置中设置分配给进程的内存量,如下所示:

<configuration>
  <jMeterProcessJVMSettings>
    <xms>1024</xms>
    <xmx>1024</xmx>
    <arguments>
      <argument>-Xprof</argument>
      <argument>-Xfuture</argument>
    </arguments>
  </jMeterProcessJVMSettings>
</configuration>

描述此内容的 wiki 的链接是:https ://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Configuring-the-jvm-that-the-jmeter-process-runs-in


推荐阅读