0

This is how I have my jvm.options configured (I also restarted elasticsearch)

cat /etc/elasticsearch/jvm.options
## JVM configuration

-Xms4096m
-Xmx4096m
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+DisableExplicitGC
-XX:+AlwaysPreTouch
-server
-Djava.awt.headless=true
-Dfile.encoding=UTF-8
-Djna.nosys=true
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true
-Dlog4j.skipJansi=true
-XX:+HeapDumpOnOutOfMemoryError

But when I check my heap size I see its set at 2gigs?

java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'
     intx CompilerThreadStackSize                   = 0                                   {pd product}
    uintx ErgoHeapSizeLimit                         = 0                                   {product}
    uintx HeapSizePerGCThread                       = 87241520                            {product}
    uintx InitialHeapSize                          := 125829120                           {product}
    uintx LargePageHeapSizeThreshold                = 134217728                           {product}
    uintx MaxHeapSize                              := 1998585856                          {product}
     intx ThreadStackSize                           = 1024                                {pd product}
     intx VMThreadStackSize                         = 1024                                {pd product}
openjdk version "1.8.0_121"

And why is the initially heap size different they should be the same.

red888
  • 27,709
  • 55
  • 204
  • 392
  • executing `java -XX:+PrintFlagsFinal` does not give you the final flags of es, but that of a freshly started jvm instance that knows nothing about the jvm options file. – zapl Apr 06 '17 at 22:50
  • how can I confirm ES is using the right heap size? – red888 Apr 06 '17 at 22:53
  • 1
    if you can see the logs (stdout) of it, adding `XX:+PrintFlagsFinal` into your jvm.options should print them at es startup. Or possibly: http://stackoverflow.com/questions/5317152/getting-the-parameters-of-a-running-jvm – zapl Apr 06 '17 at 22:54
  • "jps -lvm" did it! thanks. I was able to confirm it is in fact running with my configured heap size. – red888 Apr 06 '17 at 23:18
  • Can you mark jps -lvm as an answer so I can accept it? This 100% answers my question – red888 Apr 07 '17 at 18:41

1 Answers1

1

jinfo <pid> can be used to get all the details about a running JVM.

  • unfortunately , it shows: `Caused by: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 13556: Operation not permitted` – DennisLi Mar 01 '21 at 13:48