From 2e6d20c87c812192b3b5da2b7ac88350f44a4c59 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 17 Jul 2013 17:55:36 -0700 Subject: [PATCH] Tune ElasticSearch settings. * modules/logstash/templates/elasticsearch.yml.erb: Give 33% of memory to indexing instead of 40%. * modules/logstash/files/es-logstash-template.json: Flush the translog every 50k operations instead of the default 5k (we can do 5k ops every second or two so the flushing was happening too often). Limit the total number of shards per index per node to 3. We have 5 nodes and 10 shards per index, 5*3 > 10 so we should be fine. Set the field cache to soft type so that its entries can be garbage collected in memory constricted situations. * modules/logstash/manifests/elasticsearch.pp: Apply es-logstash-template.json to the elasticsearch servers. Change-Id: I2337fc41998fd00e090b0acfd29f007dfb6ec8df --- .../logstash/files/es-logstash-template.json | 10 ++++++++++ modules/logstash/manifests/elasticsearch.pp | 18 ++++++++++++++++++ .../logstash/templates/elasticsearch.yml.erb | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 modules/logstash/files/es-logstash-template.json diff --git a/modules/logstash/files/es-logstash-template.json b/modules/logstash/files/es-logstash-template.json new file mode 100644 index 0000000000..c1909b2d77 --- /dev/null +++ b/modules/logstash/files/es-logstash-template.json @@ -0,0 +1,10 @@ +{ + "logstash_settings" : { + "template" : "logstash*", + "settings" : { + "index.routing.allocation.total_shards_per_node" : "3", + "index.translog.flush_threshold_ops" : "50000", + "index.cache.field.type" : "soft" + } + } +} diff --git a/modules/logstash/manifests/elasticsearch.pp b/modules/logstash/manifests/elasticsearch.pp index f4b2410fe6..eb4562274e 100644 --- a/modules/logstash/manifests/elasticsearch.pp +++ b/modules/logstash/manifests/elasticsearch.pp @@ -50,6 +50,24 @@ class logstash::elasticsearch ( require => Package['elasticsearch'], } + file { '/etc/elasticsearch/templates': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + require => Package['elasticsearch'], + } + + file { '/etc/elasticsearch/templates/logstash_settings.json': + ensure => present, + source => 'puppet:///modules/logstash/es-logstash-template.json', + replace => true, + owner => 'root', + group => 'root', + mode => '0644', + require => File['/etc/elasticsearch/templates'], + } + file { '/etc/elasticsearch/default-mapping.json': ensure => present, source => 'puppet:///modules/logstash/elasticsearch.mapping.json', diff --git a/modules/logstash/templates/elasticsearch.yml.erb b/modules/logstash/templates/elasticsearch.yml.erb index 4e82837d36..f07cf9327f 100644 --- a/modules/logstash/templates/elasticsearch.yml.erb +++ b/modules/logstash/templates/elasticsearch.yml.erb @@ -139,7 +139,7 @@ node.name: "<%= scope.lookupvar("::hostname") %>" index.store.compress.stored: true index.store.compress.tv: true -indices.memory.index_buffer_size: "40%" +indices.memory.index_buffer_size: "33%" #################################### Paths ####################################