Default JAVA_OPTS in elasticsearch.in.sh

I tried opening [[ the ticket with elasticsearch-puppet but was sent here instead:

elasticsearch.in.sh (/usr/share/elasticsearch/bin/elasticsearch.in.sh on Ubuntu 12.04) contains following JAVA_OPTS defaults:

JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75"
JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly"

It seems there is no way to disable them at the moment. This is
causing issues when one wants to enable G1GC instead. How about making these defaults conditional?

Please advise

Well, those are the recommended Java options for Elasticsearch, and we don't really recommend changing them :smile:

G1GC is not recommended because we still see it throw fatal exceptions, index corruptions, etc due to bugs. For example, the recent 8u60 release had a handful of G1 related bugs.

Lucene tests against G1 regularly and finds index-corrupting errors as well. From Lucene's "known java bugs" page:

Do not, under any circumstances, run Lucene with the G1 garbage collector. Lucene's test suite fails with the G1 garbage collector on a regular basis, including bugs that cause index corruption. There is no person on this planet that seems to understand such bugs (see Loading..., open for over a year), so don't count on the situation changing soon.

So, morale of the story is don't use G1GC yet =)

If you absolutely must change the java options, you'll simply have to change the elasticsearch.in.sh script. But then you are essentially running "unsupported" and any issues you encounter will likely need to set back to default before anyone will be able to help, since ES is designed/tested against those defaults.

1 Like