@@ -7,42 +7,48 @@ to ensure that Elasticsearch has enough heap available.
77
88Elasticsearch will assign the entire heap specified in
99<<jvm-options,jvm.options>> via the `Xms` (minimum heap size) and `Xmx` (maximum
10- heap size) settings.
10+ heap size) settings. You should set these two settings to be equal to each
11+ other.
1112
1213The value for these setting depends on the amount of RAM available on your
13- server. Good rules of thumb are :
14+ server:
1415
15- * Set the minimum heap size (`Xms`) and maximum heap size (`Xmx`) to be equal to
16- each other.
16+ * Set `Xmx` and `Xms` to no more than 50% of your physical RAM. {es} requires
17+ memory for purposes other than the JVM heap and it is important to leave
18+ space for this. For instance, {es} uses off-heap buffers for efficient
19+ network communication, relies on the operating system's filesystem cache for
20+ efficient access to files, and the JVM itself requires some memory too. It is
21+ normal to observe the {es} process using more memory than the limit
22+ configured with the `Xmx` setting.
1723
18- * The more heap available to Elasticsearch, the more memory it can use for
19- caching. But note that too much heap can subject you to long garbage
20- collection pauses.
21-
22- * Set `Xmx` to no more than 50% of your physical RAM, to ensure that there is
23- enough physical RAM left for kernel file system caches.
24-
25- * Don’t set `Xmx` to above the cutoff that the JVM uses for compressed object
26- pointers (compressed oops); the exact cutoff varies but is near 32 GB. You can
27- verify that you are under the limit by looking for a line in the logs like the
28- following:
24+ * Set `Xmx` and `Xms` to no more than the threshold that the JVM uses for
25+ compressed object pointers (compressed oops); the exact threshold varies but
26+ is near 32 GB. You can verify that you are under the threshold by looking for a
27+ line in the logs like the following:
2928+
3029 heap size [1.9gb], compressed ordinary object pointers [true]
3130
32- * Even better, try to stay below the threshold for zero-based compressed oops;
33- the exact cutoff varies but 26 GB is safe on most systems, but can be as large
34- as 30 GB on some systems. You can verify that you are under the limit by
35- starting Elasticsearch with the JVM options `-XX:+UnlockDiagnosticVMOptions
36- -XX:+PrintCompressedOopsMode` and looking for a line like the following:
31+ * Ideally set `Xmx` and `Xms` to no more than the threshold for zero-based
32+ compressed oops; the exact threshold varies but 26 GB is safe on most
33+ systems, but can be as large as 30 GB on some systems. You can verify that
34+ you are under this threshold by starting {es} with the JVM options
35+ `-XX:+UnlockDiagnosticVMOptions -XX:+PrintCompressedOopsMode` and looking for
36+ a line like the following:
3737+
3838--
3939 heap address: 0x000000011be00000, size: 27648 MB, zero based Compressed Oops
4040
41- showing that zero-based compressed oops are enabled instead of
41+ showing that zero-based compressed oops are enabled. If zero-based compressed
42+ oops are not enabled then you will see a line like the following instead:
4243
4344 heap address: 0x0000000118400000, size: 28672 MB, Compressed Oops with base: 0x00000001183ff000
4445--
4546
47+ The more heap available to {es}, the more memory it can use for its internal
48+ caches, but the less memory it leaves available for the operating system to use
49+ for the filesystem cache. Also, larger heaps can cause longer garbage
50+ collection pauses.
51+
4652Here are examples of how to set the heap size via the jvm.options file:
4753
4854[source,txt]
@@ -66,7 +72,7 @@ ES_JAVA_OPTS="-Xms4000m -Xmx4000m" ./bin/elasticsearch <2>
6672<2> Set the minimum and maximum heap size to 4000 MB.
6773
6874NOTE: Configuring the heap for the <<windows-service,Windows service>> is
69- different than the above. The values initially populated for the Windows service
70- can be configured as above but are different after the service has been
75+ different than the above. The values initially populated for the Windows
76+ service can be configured as above but are different after the service has been
7177installed. Consult the <<windows-service,Windows service documentation>> for
7278additional details.
0 commit comments