Add the ability to set the JVM heap size

This change makes it possible for users to set the `elastic_heap_size_default`
value. Before this change, the option was unreachable due to a series of facts
ganerated template values. The options `elastic_heap_size` or `logstash_heap_size`
have also been exposed giving deployers the ability to define service specific
heap sizes as needed.

Change-Id: Ida3a57fdcff388f8e4bb3f325b787205a6183970
Signed-off-by: Kevin Carter <kevin@cloudnull.com>
This commit is contained in:
Kevin Carter 2019-01-30 09:34:57 -06:00
parent 78221b17d4
commit 6017fc0e89
9 changed files with 36 additions and 8 deletions

View File

@ -42,3 +42,8 @@ elastic_lxc_template_config:
2:
aa_profile: lxc.aa_profile
mount: lxc.mount.entry
# Set the elastic search heap size. If this option is undefined the value will
# be derived automatically using 1/4 of the available RAM for logstash and 1/2
# of the available RAM for elasticsearch. The value is expected to be in MiB.
# elastic_heap_size_default: 10240 # type `int`

View File

@ -49,9 +49,8 @@
tags:
- always
- name: Set elastic heap defaults
- name: Set elastic log rotate path
set_fact:
elastic_heap_size_default: "{{ _elastic_heap_size_default }}"
elastic_log_rotate_path: "/var/log/{{ service_name }}"
- name: Configure systcl vm.max_map_count=524288 on elastic hosts

View File

@ -86,3 +86,8 @@ logstash_arcsight_event_brokers: []
## detect the media type where the queue will exist. If the media type is
## "rotational" in memory queues will be used.
# logstash_queue_type:
# Set the logstash search heap size. If this option is undefined the value will
# be derived automatically using 1/4 of the available RAM for logstash and 1/2
# of the available RAM for elasticsearch. The value is expected to be in MiB.
# logstash_heap_size: 10240 # type `int`

View File

@ -71,6 +71,12 @@
- key: LS_OPEN_FILES
value: 32768
- name: Set service specific haap size
set_fact:
_service_heap_size: "{{ logstash_heap_size }}"
when:
- logstash_heap_size is defined
- name: Drop jvm conf file(s)
template:
src: "{{ item.src }}"

View File

@ -28,3 +28,8 @@ elastic_plugins:
- ingest-attachment
- ingest-geoip
- ingest-user-agent
# Set the logstash search heap size. If this option is undefined the value will
# be derived automatically using 1/4 of the available RAM for logstash and 1/2
# of the available RAM for elasticsearch. The value is expected to be in MiB.
# elastic_heap_size: 10240 # type `int`

View File

@ -81,6 +81,12 @@
- key: MAX_MAP_COUNT
value: 524288
- name: Set service specific haap size
set_fact:
_service_heap_size: "{{ elastic_heap_size }}"
when:
- elastic_heap_size is defined
- name: Drop jvm conf file(s)
template:
src: "{{ item.src }}"

View File

@ -13,5 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Set elasticsearch facts
elastic_heap_size: "{{ elastic_heap_size_default }}"
place_holder: true

View File

@ -18,7 +18,6 @@ elasticsearch_node_master: false
elasticsearch_node_data: false
elasticsearch_node_ingest: false
elastic_coordination_node: true
elastic_heap_size: "{{ (elastic_heap_size_default | int) // 3 }}"
# This variable is redefined because kibana runs elasticsearch but only in a
# load balancer capacity.

View File

@ -1,8 +1,12 @@
## JVM configuration
{% if (not (elasticsearch_node_master | default(master_node)) | bool) and (not (elasticsearch_node_data | default(data_node)) | bool) %}
{% set heap_size = (elastic_heap_size_default | int) // 2 %}
{% if _service_heap_size is defined %}
{% set heap_size = _service_heap_size %}
{% else %}
{% set heap_size = (elastic_heap_size_default | int) %}
{% if (not (elasticsearch_node_master | default(master_node)) | bool) and (not (elasticsearch_node_data | default(data_node)) | bool) %}
{% set heap_size = elastic_heap_size_default | default((_elastic_heap_size_default | int) // 2) %}
{% else %}
{% set heap_size = elastic_heap_size_default | default(_elastic_heap_size_default | int) %}
{% endif %}
{% endif %}
# Xms represents the initial size of total heap space
-Xms{{ heap_size }}m