I read the guidelines and how to ask a question topics.
I provided a SSCCE (or at least, all information to help the community understand my topic)
I copied output I observe, and explain what I think should be.
Hello,
During my simulation I reached error:
java gatling project failed with error:
java.lang.OutOfMemoryError: Java heap space
Heap dump analysis is showing that most of the memory was busy by Netty:
1,687 instances of io.netty.channel.epoll.EpollSocketChannel, loaded by jdk.internal.loader.ClassLoaders$AppClassLoader @ 0xc034b0e8 occupy 514,563,696 (71.71%) bytes.
I wonder what happened and how to properly increase heap size for Gatling’s simulations. Test was triggered by maven command with arguments: -DargLine="-Xms512m -Xmx20g -XX:+HeapDumpOnOutOfMemoryError"
Test was triggered on Jenkins worker which has more than 20GB of RAM available only for that particular build. I also tried to increase the heap size via configuration of gatling-maven-plugin but also some issues appeared and it was not possible to start the simulation.
I’m attaching heap dump to the thread.
I wonder how should I properly increase heap size for my test, cuz the load which I want to achieve is not very big to distribute it on more Gatling’s instances.
I already reached for such scenario bigger load using older Gatling’s version (3.10/3.11)
My target load is to reach 5TPS (~270-300 CU)
I don’t see anything wrong with your heap dump. It’s merely ~650MB.
If you want to increase the heap size when running from the gatling-maven-plugin, you have to use the jvmArgs config option. AFAIK, argLine is an option specific to maven-surefire-plugin.
Note: setting the max heap size to the resident memory size is a very bad idea. What about native memory and other processes?
Thanks for update. Basically setting heap size as almost whole memory was to only check if it can help to fix current issue. I also tried to use <jvmArgs> on plugin configuration. But after that simulation can’t start due to error:
Dec 19, 2024 8:57:58 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.gatling.plugin.util.ForkMain.runMain(ForkMain.java:67)
at io.gatling.plugin.util.ForkMain.main(ForkMain.java:35)
Caused by: java.lang.IllegalAccessException: module java.base does not open java.lang to unnamed module @43c3d622
at java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:259)
at io.gatling.core.stats.writer.StringInternals.<clinit>(StringInternals.java:43)
at io.gatling.core.stats.writer.LogFileDataWriter.<init>(LogFileDataWriter.scala:221)
at io.gatling.core.stats.DataWritersStatsEngine$.$anonfun$apply$1(DataWritersStatsEngine.scala:51)
at scala.collection.immutable.List.map(List.scala:251)
at scala.collection.immutable.List.map(List.scala:79)
at io.gatling.core.stats.DataWritersStatsEngine$.apply(DataWritersStatsEngine.scala:46)
at io.gatling.app.Runner.newStatsEngine(Runner.scala:70)
at io.gatling.app.Runner.load(Runner.scala:88)
at io.gatling.app.Runner.run(Runner.scala:58)
at io.gatling.app.Gatling$.start(Gatling.scala:83)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:46)
at io.gatling.app.Gatling$.main(Gatling.scala:40)
at io.gatling.app.Gatling.main(Gatling.scala)
I tried to figure it out but unfortunately nothing helped