From c3041180a50a915ad9515774cc1540a504e2157b Mon Sep 17 00:00:00 2001 From: amalgamm Date: Thu, 14 Nov 2019 14:36:46 +0300 Subject: [PATCH] Es cold gc change (#47) --- sls/elasticsearch/config.sls | 4 +++- sls/elasticsearch/files/jvm.options.tpl | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sls/elasticsearch/config.sls b/sls/elasticsearch/config.sls index 100e024..45600ad 100644 --- a/sls/elasticsearch/config.sls +++ b/sls/elasticsearch/config.sls @@ -54,6 +54,7 @@ jvm = pillar('elastic:jvm', {}) jvm_heap_size = jvm.get('heap_size', '1g') jvm_stack_size = jvm.get('stack_size', '1m') jvm_extra_options = jvm.get('extra_options', {}) +jvm_gc_type = jvm.get('gc_type', 'CMS') jvm_gc_occupancy_value = jvm.get('gc_occupancy_value', '75') tls = pillar('elastic:tls', {}) @@ -127,7 +128,8 @@ File.managed( mode=644, user='root', group='root', template='jinja', source='salt://elasticsearch/files/jvm.options.tpl', defaults={'heap_size': jvm_heap_size, 'stack_size': jvm_stack_size, - 'gc_occupancy_value': jvm_gc_occupancy_value, 'extra_options': jvm_extra_options}, + 'gc_type': jvm_gc_type, 'gc_occupancy_value': jvm_gc_occupancy_value, + 'extra_options': jvm_extra_options}, require=[File(conf_path)]) File.managed( diff --git a/sls/elasticsearch/files/jvm.options.tpl b/sls/elasticsearch/files/jvm.options.tpl index ed24dc8..11edf5f 100644 --- a/sls/elasticsearch/files/jvm.options.tpl +++ b/sls/elasticsearch/files/jvm.options.tpl @@ -18,10 +18,16 @@ ################################################################ ## GC configuration +{% if gc_type == 'G1GC' %} +-XX:+UseG1GC +-XX:G1ReservePercent=25 +-XX:InitiatingHeapOccupancyPercent={{ gc_occupancy_value }} +-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=10,filesize=64m +{% else %} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction={{ gc_occupancy_value }} -XX:+UseCMSInitiatingOccupancyOnly - +{% endif %} ## optimizations # pre-touch memory pages used by the JVM during initialization