目前,我正尝试使用gatling-plugin与10个用户并行运行我们的功能测试(大约300个请求)
mvn clean test-compile gatling:test -Dkarate.env=test在项目文件夹中使用以下.mvn/jvm.config本地maven选项:
-d64 -Xmx4g -Xms1g -XshowSettings:vm -Djava.awt.headless=true在并行处理某些大响应时,gatling进程在某一时刻被中止:
[ERROR] Failed to execute goal io.gatling:gatling-maven-plugin:3.0.2:test (default-cli) on project np.rest-testing: Gatling failed.: Process exited with an error: -1 (Exit value: -1) -> [Help 1]具有以下堆栈跟踪:
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid25960.hprof ...
Heap dump file created [1611661680 bytes in 18.184 secs]
Uncaught error from thread [GatlingSystem-scheduler-1]: Java heap space, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[GatlingSystem]
java.lang.OutOfMemoryError: Java heap space
at akka.actor.LightArrayRevolverScheduler$$anon$3.nextTick(LightArrayRevolverScheduler.scala:269)
at akka.actor.LightArrayRevolverScheduler$$anon$3.run(LightArrayRevolverScheduler.scala:235)
at java.lang.Thread.run(Thread.java:748)我试图以不同的方式将堆空间增加到10 GB (-Xmx10g):
通过环境属性.mvn/jvm.config
maven-surefire-plugin配置建议的here尽管为maven进程分配了10 at,但您可以在maven进程开始时看到:
VM settings:
Min. Heap Size: 1.00G
Max. Heap Size: 10.00G
Ergonomics Machine Class: client
Using VM: Java HotSpot(TM) 64-Bit Server VM但是在每次执行OutOfMemoryError时仍然会抛出gatling-plugin。
在分析每个堆转储时,eclipse memory analyzer总是表示相同的结果:
84 instances of "com.intuit.karate.core.StepResult", loaded by "sun.misc.Launcher$AppClassLoader @ 0xc0000000" occupy 954 286 864 (90,44 %) bytes.
Biggest instances:
•com.intuit.karate.core.StepResult @ 0xfb93ced8 - 87 239 976 (8,27 %) bytes... 可以做些什么来减少堆空间的使用和防止OutOfMemoryError?有人能分享一些想法和经验吗?
发布于 2019-12-18 18:42:40
经过一些调查,我终于注意到,堆转储显示的总是1GB。这意味着gatling-plugin不使用增加的堆空间。
通过在插件中添加以下jvm参数,即使在4GB的情况下也可以解决这个问题:
<jvmArgs>
<jvmArg>-Xmx4g</jvmArg>
</jvmArgs>因此,使用以下gatling-plugin配置,错误不再出现:
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling.plugin.version}</version>
<configuration>
<simulationsFolder>src/test/java</simulationsFolder>
<includes>
<include>performance.test.workflow.WorkflowSimulation</include>
</includes>
<compilerJvmArgs>
<compilerJvmArg>-Xmx512m</compilerJvmArg>
</compilerJvmArgs>
<jvmArgs>
<jvmArg>-Xmx4g</jvmArg>
</jvmArgs>
</configuration>
</plugin>发布于 2021-03-25 12:29:18
你可以试试这个
<configuration>
<meminitial>1024m</meminitial>
<maxmem>4096m</maxmem>
</configuration>https://stackoverflow.com/questions/59392180
复制相似问题