Add -XX+AlwaysPreTouch JVM flag

Enables the touching of all memory pages used by the JVM heap spaces
during initialization of the HotSpot VM, which commits all memory pages
at initialization time. By default, pages are committed only as they are
needed.
This commit is contained in:
Lee Hinman 2016-03-03 11:44:56 -07:00
parent 0bbb84c19a
commit 22e716551b
3 changed files with 17 additions and 0 deletions

View File

@ -85,6 +85,10 @@ REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof
REM Disables explicit GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC
REM Enable pre-touching of memory pages used by the JVM during hotspot
REM initialization
set JAVA_OPTS=%JAVA_OPTS% -XX:+AlwaysPreTouch
REM Ensure UTF-8 encoding by default (e.g. filenames)
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8

View File

@ -81,6 +81,10 @@ JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
# Disables explicit GC
JAVA_OPTS="$JAVA_OPTS -XX:+DisableExplicitGC"
# Enable pre-touching of memory pages used by the JVM during hotspot
# initialization
JAVA_OPTS="$JAVA_OPTS -XX:+AlwaysPreTouch"
# Ensure UTF-8 encoding by default (e.g. filenames)
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8"

View File

@ -808,6 +808,15 @@ changed to now route standard output to the journal and standard error
to inherit this setting (these are the defaults for systemd). These
settings can be modified by editing the elasticsearch.service file.
==== Longer startup times
In Elasticsearch 5.0.0 the `-XX:+AlwaysPreTouch` flag has been added to the JVM
startup options. This option touches all memory pages used by the JVM heap
during initialization of the HotSpot VM to reduce the chance of having to commit
a memory page during GC time. This will increase the startup time of
Elasticsearch as well as increasing the initial resident memory usage of the
Java process.
[[breaking_50_scripting]]
=== Scripting