jvm.options 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. ## JVM configuration
  2. ################################################################
  3. ## IMPORTANT: JVM heap size
  4. ################################################################
  5. ##
  6. ## You should always set the min and max JVM heap
  7. ## size to the same value. For example, to set
  8. ## the heap to 4 GB, set:
  9. ##
  10. ## -Xms4g
  11. ## -Xmx4g
  12. ##
  13. ## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
  14. ## for more information
  15. ##
  16. ################################################################
  17. # Xms represents the initial size of total heap space
  18. # Xmx represents the maximum size of total heap space
  19. -Xms1g
  20. -Xmx1g
  21. ################################################################
  22. ## Expert settings
  23. ################################################################
  24. ##
  25. ## All settings below this section are considered
  26. ## expert settings. Don't tamper with them unless
  27. ## you understand what you are doing
  28. ##
  29. ################################################################
  30. ## GC configuration
  31. 8-13:-XX:+UseConcMarkSweepGC
  32. 8-13:-XX:CMSInitiatingOccupancyFraction=75
  33. 8-13:-XX:+UseCMSInitiatingOccupancyOnly
  34. ## G1GC Configuration
  35. # NOTE: G1 GC is only supported on JDK version 10 or later
  36. # to use G1GC, uncomment the next two lines and update the version on the
  37. # following three lines to your version of the JDK
  38. # 10-13:-XX:-UseConcMarkSweepGC
  39. # 10-13:-XX:-UseCMSInitiatingOccupancyOnly
  40. 14-:-XX:+UseG1GC
  41. 14-:-XX:G1ReservePercent=25
  42. 14-:-XX:InitiatingHeapOccupancyPercent=30
  43. ## DNS cache policy
  44. # cache ttl in seconds for positive DNS lookups noting that this overrides the
  45. # JDK security property networkaddress.cache.ttl; set to -1 to cache forever
  46. -Des.networkaddress.cache.ttl=60
  47. # cache ttl in seconds for negative DNS lookups noting that this overrides the
  48. # JDK security property networkaddress.cache.negative ttl; set to -1 to cache
  49. # forever
  50. -Des.networkaddress.cache.negative.ttl=10
  51. ## optimizations
  52. # pre-touch memory pages used by the JVM during initialization
  53. -XX:+AlwaysPreTouch
  54. ## basic
  55. # explicitly set the stack size
  56. -Xss1m
  57. # set to headless, just in case
  58. -Djava.awt.headless=true
  59. # ensure UTF-8 encoding by default (e.g. filenames)
  60. -Dfile.encoding=UTF-8
  61. # use our provided JNA always versus the system one
  62. -Djna.nosys=true
  63. # turn off a JDK optimization that throws away stack traces for common
  64. # exceptions because stack traces are important for debugging
  65. -XX:-OmitStackTraceInFastThrow
  66. # enable helpful NullPointerExceptions (https://openjdk.java.net/jeps/358), if
  67. # they are supported
  68. 14-:-XX:+ShowCodeDetailsInExceptionMessages
  69. # flags to configure Netty
  70. -Dio.netty.noUnsafe=true
  71. -Dio.netty.noKeySetOptimization=true
  72. -Dio.netty.recycler.maxCapacityPerThread=0
  73. # log4j 2
  74. -Dlog4j.shutdownHookEnabled=false
  75. -Dlog4j2.disable.jmx=true
  76. -Djava.io.tmpdir=${ES_TMPDIR}
  77. ## heap dumps
  78. # generate a heap dump when an allocation from the Java heap fails
  79. # heap dumps are created in the working directory of the JVM
  80. -XX:+HeapDumpOnOutOfMemoryError
  81. # specify an alternative path for heap dumps; ensure the directory exists and
  82. # has sufficient space
  83. -XX:HeapDumpPath=data
  84. # specify an alternative path for JVM fatal error logs
  85. -XX:ErrorFile=logs/hs_err_pid%p.log
  86. ## JDK 8 GC logging
  87. 8:-XX:+PrintGCDetails
  88. 8:-XX:+PrintGCDateStamps
  89. 8:-XX:+PrintTenuringDistribution
  90. 8:-XX:+PrintGCApplicationStoppedTime
  91. 8:-Xloggc:logs/gc.log
  92. 8:-XX:+UseGCLogFileRotation
  93. 8:-XX:NumberOfGCLogFiles=32
  94. 8:-XX:GCLogFileSize=64m
  95. # JDK 9+ GC logging
  96. 9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
  97. # due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise
  98. # time/date parsing will break in an incompatible way for some date patterns and locals
  99. 9-:-Djava.locale.providers=COMPAT
  100. # temporary workaround for C2 bug with JDK 10 on hardware with AVX-512
  101. 10-:-XX:UseAVX=2