|
| 1 | +## JVM configuration |
| 2 | + |
| 3 | +################################################################ |
| 4 | +## IMPORTANT: JVM heap size |
| 5 | +################################################################ |
| 6 | +## |
| 7 | +## You should always set the min and max JVM heap |
| 8 | +## size to the same value. For example, to set |
| 9 | +## the heap to 4 GB, set: |
| 10 | +## |
| 11 | +## -Xms4g |
| 12 | +## -Xmx4g |
| 13 | +## |
| 14 | +## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html |
| 15 | +## for more information |
| 16 | +## |
| 17 | +################################################################ |
| 18 | + |
| 19 | +# Xms represents the initial size of total heap space |
| 20 | +# Xmx represents the maximum size of total heap space |
| 21 | +{% if elasticsearch_heap is defined %} |
| 22 | +-Xms{{ elasticsearch_heap }} |
| 23 | +-Xmx{{ elasticsearch_heap }} |
| 24 | +{% else %} |
| 25 | +-Xms2g |
| 26 | +-Xmx2g |
| 27 | +{% endif %} |
| 28 | + |
| 29 | +{% if elasticstack_release is version('8', '>=') %} |
| 30 | +################################################################ |
| 31 | +## Expert settings |
| 32 | +################################################################ |
| 33 | +## |
| 34 | +## All settings below here are considered expert settings. Do |
| 35 | +## not adjust them unless you understand what you are doing. Do |
| 36 | +## not edit them in this file; instead, create a new file in the |
| 37 | +## jvm.options.d directory containing your adjustments. |
| 38 | +## |
| 39 | +################################################################ |
| 40 | + |
| 41 | +-XX:+UseG1GC |
| 42 | + |
| 43 | +## JVM temporary directory |
| 44 | +-Djava.io.tmpdir=${ES_TMPDIR} |
| 45 | + |
| 46 | +# Leverages accelerated vector hardware instructions; removing this may |
| 47 | +# result in less optimal vector performance |
| 48 | +20:--add-modules=jdk.incubator.vector |
| 49 | + |
| 50 | +## heap dumps |
| 51 | + |
| 52 | +# generate a heap dump when an allocation from the Java heap fails; heap dumps |
| 53 | +# are created in the working directory of the JVM unless an alternative path is |
| 54 | +# specified |
| 55 | +-XX:+HeapDumpOnOutOfMemoryError |
| 56 | + |
| 57 | +# exit right after heap dump on out of memory error |
| 58 | +-XX:+ExitOnOutOfMemoryError |
| 59 | + |
| 60 | +# specify an alternative path for heap dumps; ensure the directory exists and |
| 61 | +# has sufficient space |
| 62 | +-XX:HeapDumpPath={{ elasticsearch_heap_dump_path }} |
| 63 | + |
| 64 | +# specify an alternative path for JVM fatal error logs |
| 65 | +-XX:ErrorFile={{ elasticsearch_logpath }}/hs_err_pid%p.log |
| 66 | + |
| 67 | +## GC logging |
| 68 | +-Xlog:gc*,gc+age=trace,safepoint:file={{ elasticsearch_logpath }}/gc.log:utctime,pid,tags:filecount=32,filesize=64m |
| 69 | +{% else %} |
| 70 | +################################################################ |
| 71 | +## Expert settings |
| 72 | +################################################################ |
| 73 | +## |
| 74 | +## All settings below this section are considered |
| 75 | +## expert settings. Don't tamper with them unless |
| 76 | +## you understand what you are doing |
| 77 | +## |
| 78 | +################################################################ |
| 79 | + |
| 80 | +## GC configuration |
| 81 | +{% if elasticstack_release is version('7.6.0', '<') %} |
| 82 | +-XX:+UseConcMarkSweepGC |
| 83 | +-XX:CMSInitiatingOccupancyFraction=75 |
| 84 | +-XX:+UseCMSInitiatingOccupancyOnly |
| 85 | +{% else %} |
| 86 | +8-13:-XX:+UseConcMarkSweepGC |
| 87 | +8-13:-XX:CMSInitiatingOccupancyFraction=75 |
| 88 | +8-13:-XX:+UseCMSInitiatingOccupancyOnly |
| 89 | +{% endif %} |
| 90 | + |
| 91 | +## G1GC Configuration |
| 92 | +# NOTE: G1 GC is only supported on JDK version 10 or later |
| 93 | +{% if elasticstack_release is version('7.6.0', '<') %} |
| 94 | +# To use G1GC uncomment the lines below. |
| 95 | +# 10-:-XX:-UseConcMarkSweepGC |
| 96 | +# 10-:-XX:-UseCMSInitiatingOccupancyOnly |
| 97 | +# 10-:-XX:+UseG1GC |
| 98 | +{% if elasticstack_release is version('7.4.0', '<') %} |
| 99 | +# 10-:-XX:InitiatingHeapOccupancyPercent=75 |
| 100 | +{% else %} |
| 101 | +# 10-:-XX:G1ReservePercent=25 |
| 102 | +# 10-:-XX:InitiatingHeapOccupancyPercent=30 |
| 103 | +{% endif %} |
| 104 | +{% else %} |
| 105 | +# to use G1GC, uncomment the next two lines and update the version on the |
| 106 | +# following three lines to your version of the JDK |
| 107 | +# 10-13:-XX:-UseConcMarkSweepGC |
| 108 | +# 10-13:-XX:-UseCMSInitiatingOccupancyOnly |
| 109 | +14-:-XX:+UseG1GC |
| 110 | +14-:-XX:G1ReservePercent=25 |
| 111 | +14-:-XX:InitiatingHeapOccupancyPercent=30 |
| 112 | +{% endif %} |
| 113 | + |
| 114 | +## JVM temporary directory |
| 115 | +-Djava.io.tmpdir=${ES_TMPDIR} |
| 116 | + |
| 117 | +## heap dumps |
| 118 | + |
| 119 | +# generate a heap dump when an allocation from the Java heap fails |
| 120 | +# heap dumps are created in the working directory of the JVM |
| 121 | +-XX:+HeapDumpOnOutOfMemoryError |
| 122 | + |
| 123 | +# specify an alternative path for heap dumps; ensure the directory exists and |
| 124 | +# has sufficient space |
| 125 | +-XX:HeapDumpPath={{ elasticsearch_heap_dump_path }} |
| 126 | + |
| 127 | +# specify an alternative path for JVM fatal error logs |
| 128 | +-XX:ErrorFile={{ elasticsearch_logpath }}/hs_err_pid%p.log |
| 129 | + |
| 130 | +## JDK 8 GC logging |
| 131 | + |
| 132 | +8:-XX:+PrintGCDetails |
| 133 | +8:-XX:+PrintGCDateStamps |
| 134 | +8:-XX:+PrintTenuringDistribution |
| 135 | +8:-XX:+PrintGCApplicationStoppedTime |
| 136 | +8:-Xloggc:{{ elasticsearch_logpath }}/gc.log |
| 137 | +8:-XX:+UseGCLogFileRotation |
| 138 | +8:-XX:NumberOfGCLogFiles=32 |
| 139 | +8:-XX:GCLogFileSize=64m |
| 140 | + |
| 141 | +# JDK 9+ GC logging |
| 142 | +9-:-Xlog:gc*,gc+age=trace,safepoint:file={{ elasticsearch_logpath }}/gc.log:utctime,pid,tags:filecount=32,filesize=64m |
| 143 | +{% endif %} |
| 144 | + |
| 145 | +{% if elasticsearch_jvm_custom_parameters !='' %} |
| 146 | +{% for item in elasticsearch_jvm_custom_parameters %} |
| 147 | +{{ item }} |
| 148 | +{% endfor %} |
| 149 | +{% endif %} |
0 commit comments