# Best config for Performance

**URL:** <https://discuss.elastic.co/t/best-config-for-performance/151109>\
**Category:** Elasticsearch\
**Created:** [October 4, 2018, 7:17pm UTC](https://discuss.elastic.co/t/best-config-for-performance/151109 "2018-10-04T19:17:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![merceskoba](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@merceskoba](https://discuss.elastic.co/u/merceskoba)\
**Post date:** [October 4, 2018, 7:17pm UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/1 "2018-10-04T19:17:59Z")

</div>

Hello,  
I have 1 dedicated server for Elasticsearch.  
Here's the detailed informations

Elasticsearch

- 4 cores; 16GB memory

I believe that i need to setup Graylog2 and Elasticsearch config.

Graylog2 config (/etc/default/graylog-server)

(/etc/graylog/server/server.conf)

> elasticsearch\_shards = 5  
> elasticsearch\_replicas = 1

Elasticsearch Config (/etc/elasticsearch/jvm.options)

> -Xms8g  
> -Xmx8g

What do you think guys ?  
Could you give me different between elasticsearch\_shards and replicas ? I am still confused reading the documentation  
I hope you can give me the best suggestions from your experiences 🙂  
Thanks all

---

<div class="post-metadata">

**Author:** ![jakelandis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jakelandis/32/36163_2.png) [@jakelandis](https://discuss.elastic.co/u/jakelandis)\
**Post date:** [October 4, 2018, 9:00pm UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/2 "2018-10-04T21:00:41Z")

</div>

With 1 server, I would suggest 1 shard and 0 replicas. The obvious downside of only 1 server is that if it fails you can loose data.

The 8g out of 16g seems about right.

> Could you give me different between elasticsearch\_shards and replicas ?

An index is composed of shards, and replicas are copies of those shards. Shards are how a single index can live across multiple nodes (e.g. if you had 5 servers, with 5 shards, each server would get 1 shard), since you only have 1 node it doesn't make much sense to have more then 1 shard. You also don't want copies for a single node since there is no where for the copy to go.

---

<div class="post-metadata">

**Author:** ![popa](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@popa](https://discuss.elastic.co/u/popa)\
**Post date:** [October 5, 2018, 3:52am UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/3 "2018-10-05T03:52:17Z")

</div>

Is it still recommended to plan ahead and set the shard size to something you know will not change? For example, I've set my shard count to 5 / 1 on a single node Elastic Stack.

> [@Decrease the number of shards](https://discuss.elastic.co/t/decrease-the-number-of-shards/86332/5):
>
> I'm somewhere here: curl -XGET 'localhost:9200/\_template/logstash?pretty' { "logstash" : { "order" : 0, "template" : "logstash-\*", "settings" : { "index" : { "number\_of\_shards" : "2" } }, "mappings" : { }, "aliases" : { } } } But my indices: curl -XGET 'localhost:9200/smsc-\*/\_settings?pretty' "smsc-2017.05.01" : { "settings" : { "index" : { "creation\_date" : "1495180973719", "number\_of\_shards" : "5", "number\_of\_replicas" : "1", "uuid" :…

---

<div class="post-metadata">

**Author:** ![jakelandis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jakelandis/32/36163_2.png) [@jakelandis](https://discuss.elastic.co/u/jakelandis)\
**Post date:** [October 5, 2018, 4:47pm UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/4 "2018-10-05T16:47:50Z")

</div>

In that referenced thread Luca says:

> You should therefore try to get the correct number of shards at index creation.

This is still true.

Say for example you have a typical logging use case with daily indexes, then index creation time is per-day. If you have 1 node then 5 shards are too many for that single node. Further for typical logging use cases have 30-90 retention, so for typical logging use cases it makes more sense to plan for today and if today needs more scale, add more nodes and re-plan for today.

On the other end of use cases, maybe you have index that is created once to hold inventory data. Today that inventory is small, but you expect it grow over time and there isn't a concept of daily indices or retention periods for this type of data. In those cases it may make sense to plan for the future, however the general advice is to use as few as shards as needed and if you get it wrong there is tooling to help re-size if needed.

---

<div class="post-metadata">

**Author:** ![merceskoba](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@merceskoba](https://discuss.elastic.co/u/merceskoba)\
**Post date:** [October 7, 2018, 7:07am UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/5 "2018-10-07T07:07:51Z")

</div>

I would like to say thank you for your feedback.  
Now, i understand difference between shards and replicas.  
This is my server condition right now (htop)  
  
Should i change the config to be [Shards = 1; Replicas = 0] ?  
Can i change the memory size settings ?

> -Xms11g  
> -Xmx11g  
> We have 5 GBs left

This is the graylog stats right now

What's your opinion guys ?

---

<div class="post-metadata">

**Author:** ![merceskoba](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@merceskoba](https://discuss.elastic.co/u/merceskoba)\
**Post date:** [October 8, 2018, 7:30am UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/6 "2018-10-08T07:30:04Z")

</div>

@jakelandis What does replicas do exactly ?

> You also don't want copies for a single node since there is no where for the copy to go.

Does it mean, it will make indices copy as many as indices for each nodes ?  
For example, first nodes, there are some indices (Abc1,dEf2,GHi3). Will they all be in second node and third nodes until X nodes where X = replicas ?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [October 8, 2018, 10:17am UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/7 "2018-10-08T10:17:21Z")

</div>

> [@merceskoba](#):
>
> For example, first nodes, there are some indices (Abc1,dEf2,GHi3). Will they all be in second node and third nodes until X nodes where X = replicas ?

This is almost right, but in fact it's X+1 rather than X because the primary doesn't count as a replica. So if you set `number_of_replicas:2` then the cluster will allocate up to _three_ copies of each shard: one primary and two replicas.

---

<div class="post-metadata">

**Author:** ![merceskoba](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@merceskoba](https://discuss.elastic.co/u/merceskoba)\
**Post date:** [October 8, 2018, 10:25am UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/8 "2018-10-08T10:25:29Z")

</div>

@DavidTurner Are Shards and Replicas config is only set in Master node only ?  
If i have data node, should i set Shards and Replicas in data node too ?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [October 8, 2018, 10:40am UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/9 "2018-10-08T10:40:48Z")

</div>

They are both properties of each index (i.e. different indices can have different values for these settings). You can specify them at index creation time, or in an index template, and you can change the number of replicas later through the API.

---

<div class="post-metadata">

**Author:** ![merceskoba](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@merceskoba](https://discuss.elastic.co/u/merceskoba)\
**Post date:** [October 8, 2018, 10:49am UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/10 "2018-10-08T10:49:38Z")

</div>

@DavidTurner If i have 5 ES servers (2 Masters, 3 Data Nodes), so Do i use same value of Shards and Replicas in all servers ?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [October 8, 2018, 11:03am UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/11 "2018-10-08T11:03:31Z")

</div>

> [@merceskoba](#):
>
> Do i use same value of Shards and Replicas in all servers

I don't understand the question. You specify the `number_of_shards` and `number_of_replicas` settings when you create an index. It's not something that you set on any one node.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 5, 2018, 11:03am UTC](https://discuss.elastic.co/t/best-config-for-performance/151109/12 "2018-11-05T11:03:41Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
