Is there any way to restrict the size of the java heap dump in Elasticsearch

Disabling Java Heap Dump is not a good practice for Debugging the Error for later stage. But large Java Heap Dump leads to the Elasticsearch Service Failure . Can we somehow restrict the size of Heap Dumps , or the only solution is to enabling these dumps into the additional attached disk.

An (uncompressed) heap dump is going to be about the size of the heap as specified by -Xmx, so the most accurate way to control its size is to set that parameter. You can also try compressing it with the -XX:HeapDumpGzipLevel JVM option, which typically saves quite some space but is less predictable.

1 Like

I tried doing this but got an error while restarting the service

Blockquote
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: output:
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: error:
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: Improperly specified VM option 'HeapDumpGzipLevel'
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: Error: Could not create the Java Virtual Machine.
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: Error: A fatal exception has occurred. Program will exit.
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.JvmOption.flagsFinal(JvmOption.java:120)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.JvmOption.findFinalOptions(JvmOption.java:87)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.MachineDependentHeap.determineHeapSettings(MachineDependentHeap.java:59)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:138)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.JvmOptionsParser.determineJvmOptions(JvmOptionsParser.java:91)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.ServerProcess.createProcess(ServerProcess.java:208)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.ServerProcess.start(ServerProcess.java:104)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.ServerProcess.start(ServerProcess.java:88)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.ServerCli.startServer(ServerCli.java:247)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.server.cli.ServerCli.execute(ServerCli.java:100)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:54)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.cli.Command.main(Command.java:50)
Feb 29 14:57:15 ESHot001DR systemd-entrypoint[8656]: #011at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:64)
Feb 29 14:57:15 ESHot001DR systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Feb 29 14:57:15 ESHot001DR systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Feb 29 14:57:15 ESHot001DR systemd[1]: Failed to start Elasticsearch.

XX:HeapDumpGzipLevel=9 , Made it work fine

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.