|
| 1 | +# Media Cloud NOTE: this is the jvm.options from |
| 2 | +# https://github.com/elastic/elasticsearch v8.17.3 release, with |
| 3 | +# @thing@ replaced |
| 4 | +################################################################ |
| 5 | +## |
1 | 6 | ## JVM configuration
|
| 7 | +## |
| 8 | +################################################################ |
| 9 | +## |
| 10 | +## WARNING: DO NOT EDIT THIS FILE. If you want to override the |
| 11 | +## JVM options in this file, or set any additional options, you |
| 12 | +## should create one or more files in the jvm.options.d |
| 13 | +## directory containing your adjustments. |
| 14 | +## |
| 15 | +## See https://www.elastic.co/guide/en/elasticsearch/reference/8.17/advanced-configuration.html#set-jvm-options |
| 16 | +## for more information. |
| 17 | +## |
| 18 | +################################################################ |
| 19 | + |
| 20 | + |
2 | 21 |
|
3 | 22 | ################################################################
|
4 | 23 | ## IMPORTANT: JVM heap size
|
5 | 24 | ################################################################
|
6 | 25 | ##
|
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: |
| 26 | +## The heap size is automatically configured by Elasticsearch |
| 27 | +## based on the available memory in your system and the roles |
| 28 | +## each node is configured to fulfill. If specifying heap is |
| 29 | +## required, it should be done through a file in jvm.options.d, |
| 30 | +## which should be named with .options suffix, and the min and |
| 31 | +## max should be set to the same value. For example, to set the |
| 32 | +## heap to 4 GB, create a new file in the jvm.options.d |
| 33 | +## directory containing these lines: |
10 | 34 | ##
|
11 | 35 | ## -Xms4g
|
12 | 36 | ## -Xmx4g
|
13 | 37 | ##
|
14 |
| -## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html |
| 38 | +## See https://www.elastic.co/guide/en/elasticsearch/reference/8.17/heap-size.html |
15 | 39 | ## for more information
|
16 | 40 | ##
|
17 | 41 | ################################################################
|
18 | 42 |
|
19 |
| -# Xms represents the initial size of total heap space |
20 |
| -# Xmx represents the maximum size of total heap space |
21 |
| -{% if es_heap_size is defined %} |
22 |
| --Xms{{ es_heap_size }} |
23 |
| --Xmx{{ es_heap_size }} |
24 |
| -{% else %} |
25 |
| --Xms2g |
26 |
| --Xmx2g |
27 |
| -{% endif %} |
28 | 43 |
|
29 | 44 | ################################################################
|
30 | 45 | ## Expert settings
|
31 | 46 | ################################################################
|
32 | 47 | ##
|
33 |
| -## All settings below this section are considered |
34 |
| -## expert settings. Don't tamper with them unless |
35 |
| -## you understand what you are doing |
| 48 | +## All settings below here are considered expert settings. Do |
| 49 | +## not adjust them unless you understand what you are doing. Do |
| 50 | +## not edit them in this file; instead, create a new file in the |
| 51 | +## jvm.options.d directory containing your adjustments. |
36 | 52 | ##
|
37 | 53 | ################################################################
|
38 | 54 |
|
39 |
| -## GC configuration |
40 |
| -{% if es_version is version('7.6.0', '<') %} |
41 |
| --XX:+UseConcMarkSweepGC |
42 |
| --XX:CMSInitiatingOccupancyFraction=75 |
43 |
| --XX:+UseCMSInitiatingOccupancyOnly |
44 |
| -{% else %} |
45 |
| -8-13:-XX:+UseConcMarkSweepGC |
46 |
| -8-13:-XX:CMSInitiatingOccupancyFraction=75 |
47 |
| -8-13:-XX:+UseCMSInitiatingOccupancyOnly |
48 |
| -{% endif %} |
49 |
| - |
50 |
| -## G1GC Configuration |
51 |
| -# NOTE: G1 GC is only supported on JDK version 10 or later |
52 |
| -{% if es_version is version('7.6.0', '<') %} |
53 |
| -# To use G1GC uncomment the lines below. |
54 |
| -# 10-:-XX:-UseConcMarkSweepGC |
55 |
| -# 10-:-XX:-UseCMSInitiatingOccupancyOnly |
56 |
| -# 10-:-XX:+UseG1GC |
57 |
| -{% if es_version is version('7.4.0', '<') %} |
58 |
| -# 10-:-XX:InitiatingHeapOccupancyPercent=75 |
59 |
| -{% else %} |
60 |
| -# 10-:-XX:G1ReservePercent=25 |
61 |
| -# 10-:-XX:InitiatingHeapOccupancyPercent=30 |
62 |
| -{% endif %} |
63 |
| -{% else %} |
64 |
| -# to use G1GC, uncomment the next two lines and update the version on the |
65 |
| -# following three lines to your version of the JDK |
66 |
| -# 10-13:-XX:-UseConcMarkSweepGC |
67 |
| -# 10-13:-XX:-UseCMSInitiatingOccupancyOnly |
68 |
| -14-:-XX:+UseG1GC |
69 |
| -14-:-XX:G1ReservePercent=25 |
70 |
| -14-:-XX:InitiatingHeapOccupancyPercent=30 |
71 |
| -{% endif %} |
72 |
| - |
73 |
| -{% if es_version is version('7.5.0', '<') %} |
74 |
| -## DNS cache policy |
75 |
| -# cache ttl in seconds for positive DNS lookups noting that this overrides the |
76 |
| -# JDK security property networkaddress.cache.ttl; set to -1 to cache forever |
77 |
| --Des.networkaddress.cache.ttl=60 |
78 |
| -# cache ttl in seconds for negative DNS lookups noting that this overrides the |
79 |
| -# JDK security property networkaddress.cache.negative ttl; set to -1 to cache |
80 |
| -# forever |
81 |
| --Des.networkaddress.cache.negative.ttl=10 |
82 |
| - |
83 |
| -## optimizations |
84 |
| - |
85 |
| -# pre-touch memory pages used by the JVM during initialization |
86 |
| --XX:+AlwaysPreTouch |
87 |
| - |
88 |
| -## basic |
89 |
| - |
90 |
| -# explicitly set the stack size |
91 |
| --Xss1m |
92 |
| - |
93 |
| -# set to headless, just in case |
94 |
| --Djava.awt.headless=true |
95 |
| - |
96 |
| -# ensure UTF-8 encoding by default (e.g. filenames) |
97 |
| --Dfile.encoding=UTF-8 |
98 |
| - |
99 |
| -# use our provided JNA always versus the system one |
100 |
| --Djna.nosys=true |
101 |
| - |
102 |
| -# turn off a JDK optimization that throws away stack traces for common |
103 |
| -# exceptions because stack traces are important for debugging |
104 |
| --XX:-OmitStackTraceInFastThrow |
105 |
| - |
106 |
| -# flags to configure Netty |
107 |
| --Dio.netty.noUnsafe=true |
108 |
| --Dio.netty.noKeySetOptimization=true |
109 |
| --Dio.netty.recycler.maxCapacityPerThread=0 |
110 |
| -{% if es_version is version('7.4.0', '>=') %} |
111 |
| --Dio.netty.allocator.numDirectArenas=0 |
112 |
| -{% endif %} |
113 |
| - |
114 |
| -# log4j 2 |
115 |
| --Dlog4j.shutdownHookEnabled=false |
116 |
| --Dlog4j2.disable.jmx=true |
117 |
| -{% endif %} |
| 55 | +-XX:+UseG1GC |
118 | 56 |
|
119 | 57 | ## JVM temporary directory
|
120 | 58 | -Djava.io.tmpdir=${ES_TMPDIR}
|
121 | 59 |
|
| 60 | +# Leverages accelerated vector hardware instructions; removing this may |
| 61 | +# result in less optimal vector performance |
| 62 | +20-:--add-modules=jdk.incubator.vector |
| 63 | + |
| 64 | +# Required to workaround performance issue in JDK 23, https://github.com/elastic/elasticsearch/issues/113030 |
| 65 | +23:-XX:CompileCommand=dontinline,java/lang/invoke/MethodHandle.setAsTypeCache |
| 66 | +23:-XX:CompileCommand=dontinline,java/lang/invoke/MethodHandle.asTypeUncached |
| 67 | + |
122 | 68 | ## heap dumps
|
123 | 69 |
|
124 |
| -# generate a heap dump when an allocation from the Java heap fails |
125 |
| -# heap dumps are created in the working directory of the JVM |
| 70 | +# generate a heap dump when an allocation from the Java heap fails; heap dumps |
| 71 | +# are created in the working directory of the JVM unless an alternative path is |
| 72 | +# specified |
126 | 73 | -XX:+HeapDumpOnOutOfMemoryError
|
127 | 74 |
|
| 75 | +# exit right after heap dump on out of memory error |
| 76 | +-XX:+ExitOnOutOfMemoryError |
| 77 | + |
128 | 78 | # specify an alternative path for heap dumps; ensure the directory exists and
|
129 | 79 | # has sufficient space
|
130 | 80 | -XX:HeapDumpPath={{ es_heap_dump_path }}
|
131 | 81 |
|
132 | 82 | # specify an alternative path for JVM fatal error logs
|
133 | 83 | -XX:ErrorFile={{ es_log_dir }}/hs_err_pid%p.log
|
134 | 84 |
|
135 |
| -## JDK 8 GC logging |
136 |
| - |
137 |
| -8:-XX:+PrintGCDetails |
138 |
| -8:-XX:+PrintGCDateStamps |
139 |
| -8:-XX:+PrintTenuringDistribution |
140 |
| -8:-XX:+PrintGCApplicationStoppedTime |
141 |
| -8:-Xloggc:{{ es_log_dir }}/gc.log |
142 |
| -8:-XX:+UseGCLogFileRotation |
143 |
| -8:-XX:NumberOfGCLogFiles=32 |
144 |
| -8:-XX:GCLogFileSize=64m |
145 |
| - |
146 |
| -# JDK 9+ GC logging |
147 |
| -9-:-Xlog:gc*,gc+age=trace,safepoint:file={{ es_log_dir }}/gc.log:utctime,pid,tags:filecount=32,filesize=64m |
148 |
| -{% if es_version is version('7.5.0', '<') %} |
149 |
| -# due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise |
150 |
| -# time/date parsing will break in an incompatible way for some date patterns and locals |
151 |
| -9-:-Djava.locale.providers=COMPAT |
152 |
| - |
153 |
| -{% if es_major_version == "6.x" %} |
154 |
| -# temporary workaround for C2 bug with JDK 10 on hardware with AVX-512 |
155 |
| -10-:-XX:UseAVX=2 |
156 |
| -{% endif %} |
157 |
| -{% endif %} |
158 |
| - |
159 |
| -{% if es_jvm_custom_parameters !='' %} |
160 |
| -{% for item in es_jvm_custom_parameters %} |
161 |
| -{{ item }} |
162 |
| -{% endfor %} |
163 |
| -{% endif %} |
| 85 | +## GC logging |
| 86 | +-Xlog:gc*,gc+age=trace,safepoint:file={{ es_log_dir }}/gc.log:utctime,level,pid,tags:filecount=32,filesize=64m |
0 commit comments