Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Update jvm.options for ES7 #628

Closed
andrx opened this issue Nov 3, 2019 · 4 comments
Closed

Update jvm.options for ES7 #628

andrx opened this issue Nov 3, 2019 · 4 comments
Labels

Comments

@andrx
Copy link

andrx commented Nov 3, 2019

Elasticsearch version
7.4+

Role version:
7.1

JVM version
bundled with ES7.4

OS version (uname -a if on a Unix-like system):
centos7 Linux 3.10.0-957.1.3.el7.x86_64

Description of the problem including expected versus actual behaviour:
I had a question on RAM issues described on discuss that led me to check the diff of jvm.options between ansible and current default shipped with ES7
There are updates that should be synchronized.

Playbook:

- name: Elasticsearch init nodes
  hosts: es
  roles:
	- role: elastic.elasticsearch
  gather_facts: true
  vars:
	es_major_version: "7.x"
	es_version: "7.4.2"
	es_instance_name: "{{ ansible_env.NODETYPE }}-{{ ansible_env.INSTANCE_INDEX }}"
	es_data_dirs:
	  - "/opt/elasticsearch/data"
	es_log_dir: "/opt/elasticsearch/logs"
	es_config:
	  node.name: "{{ ansible_env.NODETYPE }}-{{ ansible_env.INSTANCE_INDEX }}"
	  cluster.name: "{{ansible_env.CLUSTER_NAME}}"
	  node.attr.role: "{{ansible_env.NODETYPE}}"
	  discovery.seed_hosts: "{{ hostvars[inventory_hostname].groups.es }}"
	  cluster.initial_master_nodes: "{{ hostvars[inventory_hostname].groups.master }}"
	  network.host: "{{ ansible_default_ipv4.address }}"
	  http.port: 9200
	  transport.port: 9300
	  node.data: "{{true if (ansible_env.NODETYPE=='data' or ansible_env.NODETYPE=='shadow') else false}}"
	  node.master: "{{true if ansible_env.NODETYPE=='master' else false}}"
	  node.ml: false
	  bootstrap.memory_lock: true
	  thread_pool.write.queue_size: 1000
	  thread_pool.search.queue_size: 10000
	  indices.queries.cache.size: 5%
	  indices.breaker.total.use_real_memory: false
	  cluster.fault_detection.follower_check.timeout: "30s"
	es_scripts: false
	es_templates: false
	es_version_lock: false
	es_heap_size: 16g
	es_api_port: 9200
	es_api_host: "{{ ansible_default_ipv4.address }}"
	es_enable_xpack: true

Provide logs from Ansible:

ES Logs if relevant:

@jmlrt
Copy link
Member

jmlrt commented Nov 12, 2019

Hi @andrx,
Thanks for reporting this issue.
Can you create a pull request to update the jvm.options template we ship with this role?

@andrx
Copy link
Author

andrx commented Nov 13, 2019

@jmlrt sure, i'll create it this week

andrx added a commit to andrx/ansible-elasticsearch that referenced this issue Nov 14, 2019
@andrx
Copy link
Author

andrx commented Nov 14, 2019

Just wanted to post a sample workaround with es_jvm_custom_parameters that I'm using to fix it:

- name: Elasticsearch init nodes
  hosts: es
  roles:
	- role: elastic.elasticsearch
  gather_facts: true
  vars:
	es_major_version: "7.x"
	es_version: "7.4.2"
	es_instance_name: "{{ ansible_env.NODETYPE }}-{{ ansible_env.INSTANCE_INDEX }}"
	es_data_dirs:
	  - "/opt/elasticsearch/data"
	es_log_dir: "/opt/elasticsearch/logs"
	es_config:
	  node.name: "{{ ansible_env.NODETYPE }}-{{ ansible_env.INSTANCE_INDEX }}"
	  cluster.name: "{{ansible_env.CLUSTER_NAME}}"
	  node.attr.role: "{{ansible_env.NODETYPE}}"
	  discovery.seed_hosts: "{{ hostvars[inventory_hostname].groups.es }}"
	  cluster.initial_master_nodes: "{{ hostvars[inventory_hostname].groups.master }}"
	  network.host: "{{ ansible_default_ipv4.address }}"
	  http.port: 9200
	  transport.port: 9300
	  node.data: "{{true if (ansible_env.NODETYPE=='data' or ansible_env.NODETYPE=='shadow') else false}}"
	  node.master: "{{true if ansible_env.NODETYPE=='master' else false}}"
	  node.ml: false
	  bootstrap.memory_lock: true
	  thread_pool.write.queue_size: 1000
	  thread_pool.search.queue_size: 10000
	  indices.queries.cache.size: 5%
	  indices.breaker.total.use_real_memory: false
	  cluster.fault_detection.follower_check.timeout: "30s"
	es_jvm_custom_parameters:
	  - ""
	  - "## G1GC Configuration"
	  - "#10-:-XX:-UseConcMarkSweepGC"
	  - "#10-:-XX:-UseCMSInitiatingOccupancyOnly"
	  - "#10-:-XX:+UseG1GC"
	  - "#10-:-XX:G1ReservePercent=25"
	  - "#10-:-XX:InitiatingHeapOccupancyPercent=30"
	  - "#10-:-XX:MaxGCPauseMillis=300"
	  - ""
	  - "## DNS cache policy"
	  - "# cache ttl in seconds for positive DNS lookups noting that this overrides the"
	  - "# JDK security property networkaddress.cache.ttl; set to -1 to cache forever"
	  - "-Des.networkaddress.cache.ttl=60"
	  - "# JDK security property networkaddress.cache.negative ttl; set to -1 to cache"
	  - "# forever"
	  - "-Des.networkaddress.cache.negative.ttl=10"
	  - ""
	  - "# explicitly set the stack size"
	  - "-Xss1m"
	  - ""
	  - "# turn off a JDK optimization that throws away stack traces for common"
	  - "# exceptions because stack traces are important for debugging"
	  - "#-XX:-OmitStackTraceInFastThrow"
	  - ""
	  - "-Dio.netty.allocator.numDirectArenas=0"
	  - ""
	  - "-Djava.io.tmpdir=${ES_TMPDIR}"
	  - ""
	  - "# specify an alternative path for JVM fatal error logs"
	  - "-XX:ErrorFile=logs/hs_err_pid%p.log"
	  - ""
	  - "9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m"
	  - "9-:-Djava.locale.providers=COMPAT"
	es_scripts: false
	es_templates: false
	es_version_lock: false
	es_heap_size: 16g
	es_api_port: 9200
	es_api_host: "{{ ansible_default_ipv4.address }}"
	es_enable_xpack: true

@jmlrt
Copy link
Member

jmlrt commented Dec 5, 2019

fixed by merging #637

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants