# Increasing indexing performance without sacrificing reliability

**URL:** https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718
**Category:** Elasticsearch
**Created:** [January 2, 2019, 10:06pm UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718 "2019-01-02T22:06:00Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![amomchilov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amomchilov/32/30271_2.png) [@amomchilov](https://discuss.elastic.co/u/amomchilov)
#### Post date: [January 2, 2019, 10:06pm UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/1 "2019-01-02T22:06:00Z")

</div>

Hey guys, I've got a 6.5 PB cluster, composed of 150 d2.8xlarge instances (36 cores @ 2.5 GHz, 244 GB RAM, 24 hard disks (2 TB each, not in RAID)) that act as both data and ingest nodes. I have Filebeat running on 700+ prod service hosts, streaming around 3.5 GB/s of logs into hourly indexes. I've got a few questions regarding how I can optimize the performance of this cluster.

At the moment, I've configured my indexes to have 100 shards, and 0 replicas. Every hour, when the traffic starts pouring into a new index, I can see the CPU graphs of some servers drops, and other increase. This quite clearly shows which 100 servers were chosen for this hours' index, while the others are close to idle. Thus, I conclude that an a given server only contributes to indexing performance IF it stores a shard of the current index. Is this correct?

Secondly, from [this page on maximizing index performance](https://www.elastic.co/guide/en/elasticsearch/reference/master/tune-for-indexing-speed.html#_disable_refresh_and_replicas_for_initial_loads), I see that you guys recommend disabling replicas for initial loads of one-off data. That suggests to me that having 2 copies of a shard (1 primary, 1 replica) doubles that load, thus replication can't be used to increase indexing performance (although I understand that it _does_ help with search performance).

So then, in order to get peak index performance out of my 150 nodes, I'll need an index with at least 150 shards. The issue there is that any one host going down will completely bring down the cluster. Are there any options? Have all hosts participate in the indexing, without each one becoming a risk to the whole cluster?

From what I gather, replica shards work like RAID 1, where you pay for 100% extra space, but have instant failover recovery. But there are many RAID schemes that can protect against a single drive failure, with only a small portion of extra space reserved for parity data. Recovering after a lost drive takes a little bit of processing time (to recompute the drive value from the other drives plus the parity), but it comes at the benefit of MUCH lower disk over-provisioning. Does Elasticsearch have anything similar?

When I get some free time, I'll work on switching to a hot/cold setup, but that poses its own challenges, because force-merging/shrinking on such large indexes becomes really difficult. Any advice?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 3, 2019, 5:28am UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/2 "2019-01-03T05:28:45Z")

</div>

What is your average shard size? What is the retention period of your data? Are you indexing into a single index at a time? Which version of Elasticsearch are you using? Are you running more than one node per host? Do you have dedicated master nodes?

---

<div class="post-metadata">

### Author: ![amomchilov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amomchilov/32/30271_2.png) [@amomchilov](https://discuss.elastic.co/u/amomchilov)
#### Post date: [January 3, 2019, 7:30pm UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/3 "2019-01-03T19:30:08Z")

</div>

1. Average shard size: 10-50 GB (varies depending on the time of day).
2. Retention period: As long as we can given the 6.5 PB limit, which is like a month.
3. Are you indexing into a single index at a time? Yes, except for brief overlap during the rollover every hour.
4. Which version of Elasticsearch are you using? `6.4.1`
5. Are you running more than one node per host? Do you mean more than 1 ES instance per server? Nope, just 1:1
6. Do you have dedicated master nodes? Yes, 3 `c5.4xlarge` servers.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 3, 2019, 7:45pm UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/4 "2019-01-03T19:45:28Z")

</div>

How much data do you have in the cluster at the moment? What heap size are you using?

---

<div class="post-metadata">

### Author: ![amomchilov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amomchilov/32/30271_2.png) [@amomchilov](https://discuss.elastic.co/u/amomchilov)
#### Post date: [January 3, 2019, 8:06pm UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/5 "2019-01-03T20:06:26Z")

</div>

- How much data do you have in the cluster at the moment? About 1.5 PB

- What heap size are you using? Half of the available 244 GB per `d2.8xlarge` server (144 GB per node).

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 3, 2019, 8:34pm UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/6 "2019-01-03T20:34:22Z")

</div>

What is the heap pressure looking like on the nodes with this volume of data?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 3, 2019, 9:01pm UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/7 "2019-01-03T21:01:41Z")

</div>

> [@amomchilov](#):
>
> At the moment, I've configured my indexes to have 100 shards, and 0 replicas. Every hour, when the traffic starts pouring into a new index, I can see the CPU graphs of some servers drops, and other increase. This quite clearly shows which 100 servers were chosen for this hours' index, while the others are close to idle. Thus, I conclude that an a given server only contributes to indexing performance IF it stores a shard of the current index. Is this correct?

Yes that is correct. Given that you have set up your disks in a multi-path configuration as far as I understand, you will be working a single disk per node quite hard per node all the time. Once you have more data in the cluster and this disk also need to serve more queries this could potentially result in bottlenecks. As these nodes have ephemeral disks and data will be lost on node failure, it is a bit risky to index without any replica. It does increase indexing performance and takes up less space but is considerably less reliable.

> [@amomchilov](#):
>
> Secondly, from [this page on maximizing index performance](https://www.elastic.co/guide/en/elasticsearch/reference/master/tune-for-indexing-speed.html#_disable_refresh_and_replicas_for_initial_loads), I see that you guys recommend disabling replicas for initial loads of one-off data. That suggests to me that having 2 copies of a shard (1 primary, 1 replica) doubles that load, thus replication can't be used to increase indexing performance (although I understand that it _does_ help with search performance).

If you are looking for reliability and want to avoid data loss and reprocessing of data I would recommend having one replica shard enabled so you can lose a node without losing all copies of the shard.

> [@amomchilov](#):
>
> So then, in order to get peak index performance out of my 150 nodes, I'll need an index with at least 150 shards. The issue there is that any one host going down will completely bring down the cluster. Are there any options? Have all hosts participate in the indexing, without each one becoming a risk to the whole cluster?

You could have 75 primary shards and 1 replica, which gives 150 total shards.

> [@amomchilov](#):
>
> From what I gather, replica shards work like RAID 1, where you pay for 100% extra space, but have instant failover recovery. But there are many RAID schemes that can protect against a single drive failure, with only a small portion of extra space reserved for parity data. Recovering after a lost drive takes a little bit of processing time (to recompute the drive value from the other drives plus the parity), but it comes at the benefit of MUCH lower disk over-provisioning. Does Elasticsearch have anything similar?

Each node owns it's shards and require separate storage for it. It is not possible to rely on the redundancy of a shared file system and have multiple nodes access this data.

> [@amomchilov](#):
>
> When I get some free time, I'll work on switching to a hot/cold setup, but that poses its own challenges, because force-merging/shrinking on such large indexes becomes really difficult. Any advice?

In order to reach high node densities, which you will need to do in order to reach the 6.5PB capacity, you will need to optimise your storage as outlined in [this webinar](https://www.elastic.co/webinars/optimizing-storage-efficiency-in-elasticsearch). This might be more easily achieved in a hot-warm architecture.

> [@amomchilov](#):
>
> Retention period: As long as we can given the 6.5 PB limit, which is like a month.

If I calculate correctly generating 100 shards per hour will give around 72000 shards for a month, even without considering replicas. That is in my experience far too much for a single cluster, so I would recommend splitting this cluster into multiple smaller ones and use cross-cluster search to query across them. In order to hold as much data as possible, you also want to optimise the shard size. You can do this by using the rollover API and roll over to new indices based on size and not a fixed time. This can allow you to get all shards at the target size of e.g. 50GB, which will reduce the number of shards you hold in the cluster quite significantly. You may even go beyond 50 Gb as you have good networking in place.

---

<div class="post-metadata">

### Author: ![amomchilov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amomchilov/32/30271_2.png) [@amomchilov](https://discuss.elastic.co/u/amomchilov)
#### Post date: [January 23, 2019, 9:53pm UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/8 "2019-01-23T21:53:19Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> If I calculate correctly generating 100 shards per hour will give around 72000 shards for a month, even without considering replicas. That is in my experience far too much for a single cluster, so I would recommend splitting this cluster into multiple smaller ones and use cross-cluster search to query across them.

Yeah, I was thinking about this, but I don't have a finer-grained way to subdivide my production servers to make them ship their logs to different end points. I've already segregated my production servers by realm. This 6.5 PB cluster is just for NA, alone. EU and the rest of the world have their own separate ES clusters.

> [@Christian\_Dahlqvist](#):
>
> You can do this by using the rollover API and roll over to new indices based on size and not a fixed time. This can allow you to get all shards at the target size of e.g. 50GB

This is a good idea. I'll investigate it

> [@Christian\_Dahlqvist](#):
>
> You may even go beyond 50 Gb as you have good networking in place.

Yeah, I've got 10 gbps networking. How much larger do you think I can go?

> [@Christian\_Dahlqvist](#):
>
> Given that you have set up your disks in a multi-path configuration as far as I understand, you will be working a single disk per node quite hard per node all the time.

Are the underlying lucene segments of a shard spread across the available data paths? That would contribute to IO parallelism, and would be quite useful.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 24, 2019, 6:37am UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/9 "2019-01-24T06:37:45Z")

</div>

> [@amomchilov](#):
>
> Yeah, I've got 10 gbps networking. How much larger do you think I can go?

I would probably start somewhere in the 50GB to 100GB range and see how that works. As a single shard can contain a maximum of 2 billion documents, this may limit how far you can go.

> [@amomchilov](#):
>
> Are the underlying lucene segments of a shard spread across the available data paths? That would contribute to IO parallelism, and would be quite useful.

Each shard and all its segments is always located on a single data path.

---

<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: [February 21, 2019, 6:37am UTC](https://discuss.elastic.co/t/increasing-indexing-performance-without-sacrificing-reliability/162718/10 "2019-02-21T06:37:52Z")

</div>

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