# What elasticsearch does when restarting a cluster?

**URL:** https://discuss.elastic.co/t/what-elasticsearch-does-when-restarting-a-cluster/176793
**Category:** Elasticsearch
**Created:** [April 14, 2019, 7:06pm UTC](https://discuss.elastic.co/t/what-elasticsearch-does-when-restarting-a-cluster/176793 "2019-04-14T19:06:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![yishain11](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yishain11](https://discuss.elastic.co/u/yishain11)
#### Post date: [April 14, 2019, 7:06pm UTC](https://discuss.elastic.co/t/what-elasticsearch-does-when-restarting-a-cluster/176793/1 "2019-04-14T19:06:07Z")

</div>

I have en elasticsearch cluster consisting 3 nodes, and a pretty big index (~1500 fields), and when it restarts, ether from a "clean" restart or forced shotdown, it takes a while to go back up, and it hoggs the JVM heap and indexing slow down, as described in feeds such as:

> [@Garbage Collection blackout](https://discuss.elastic.co/t/garbage-collection-blackout/81652):
>
> Hi all, I have set up a ELK server (mostly using defaults) on a VM with 2GB of memory and 200GB of disk. It has been been loading about 250 log files from another server using Filebeat. (The files are only about 300KB each.) Performance has been really terrible, though, and log files are showing numerous errors. Also -- (and the reason for this message) -- I've been seeing extended time periods where the ES server appears to almost completely black out while doing GC. Notice the logs below, w…

> [@ES5 Indexing performance (seems slow)](https://discuss.elastic.co/t/es5-indexing-performance-seems-slow/65084):
>
> Hi, When indexing 200000 documents in batches of 1000 using the bulk REST API I am seeing the following log messages: [2016-11-03T21:30:55,263][INFO][o.e.i.IndexingMemoryController] [node-1] now throttling indexing for shard [[myindex][1]]: segment writing can't keep up [2016-11-03T21:30:57,708][INFO][o.e.i.IndexingMemoryController] [node-1] now throttling indexing for shard [[myindex][2]]: segment writing can't keep up [2016-11-03T21:31:01,213][INFO][o.e.i.IndexingMemoryController] [nod…

My question is not how to handle this issues, but to understand: What does elasticsearch tries to do when the cluser is restrating? what is happening behind the scenes that cause this slowdown and heavy memory usage?  
To what configurations does it relate to?  
I need to be able to explain the process to my peers and then think how to make the cluser restart not stop other process in the machine that also uses JVM heap memory.  
Thanks!

---

<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: [April 15, 2019, 6:57am UTC](https://discuss.elastic.co/t/what-elasticsearch-does-when-restarting-a-cluster/176793/2 "2019-04-15T06:57:31Z")

</div>

> [@yishain11](#):
>
> What does elasticsearch tries to do when the cluser is restrating? what is happening behind the scenes that cause this slowdown and heavy memory usage?

Elasticsearch is preparing everything it needs to serve searches and indexing requests, loading various data structures from disk and doing other preparatory work.

The threads you linked were nothing to do with startup, so I don't see how they're relevant here.

> [@yishain11](#):
>
> how to make the cluser restart not stop other process in the machine that also uses JVM heap memory.

Elasticsearch runs in a JVM on its own. It does not share a heap with any other process.

However, let me turn the question around: why does the startup performance matter to you? A properly configured 3-node cluster only needs to restart from cold after a serious disaster affecting multiple nodes.

---

<div class="post-metadata">

### Author: ![yishain11](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yishain11](https://discuss.elastic.co/u/yishain11)
#### Post date: [April 15, 2019, 7:33am UTC](https://discuss.elastic.co/t/what-elasticsearch-does-when-restarting-a-cluster/176793/3 "2019-04-15T07:33:16Z")

</div>

Thanks for your answer.

```
Elasticsearch is preparing everything it needs to serve searches and indexing requests, loading 
various data structures from disk and doing other preparatory work

```

What preperations? reindexing? remapping?  
Does it matter if the data currently stored in elastic is big in size/mapping?

I have two java process in my VM, one of them is elastic. When I push a large number of files to elastic (meaning: a large number of files (~1,000,000 at a time for a while) with a large number of fields), and I stop elastic an restart it to see what happens if the machine would crash, the second process running stop to a crawl (or even carshes completely) and elasticsearch log tells me that:

1. now throttling indexing for shard segment writing can't keep up stop throttling indexing for shards
2. JVM garbage collector reports on overhead, like in the post I linked too (I know that the posts themselves are not related to cluster restart, but the log messages are the same for me, when I restart my cluster).
3. etc

Again, I'm not here to understad the perticular issues I face when I restart, I'm Just trying to understand what elasticsearch is going through when restarting, how many tasks does it has, and how the number of docs or fields in mapping effect the restart.

---

<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: [April 15, 2019, 7:57am UTC](https://discuss.elastic.co/t/what-elasticsearch-does-when-restarting-a-cluster/176793/4 "2019-04-15T07:57:24Z")

</div>

> [@yishain11](#):
>
> What preperations? reindexing? remapping?

No, it does not do any [reindexing](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) unless you ask it to. I do not know what you mean by remapping.

> [@yishain11](#):
>
> Does it matter if the data currently stored in elastic is big in size/mapping?

Yes, I would expect it to take longer to restart if it has more data and/or if the data are more complex.

You can find out what the Elasticsearch process is doing at any time using the [hot threads API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html) or by taking a thread dump with `jstack`. You can also [increase the logging level](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/logging.html#configuring-logging-levels) to get more information in the logs.

I would expect a certain amount of GC activity when starting up a node - it's working as hard as it can trying to get the node back up as quickly as possible, so it will try and use all the resources that you've allowed it to use. This includes CPU, memory and I/O bandwidth. If it's a problem that it's affecting other processes then it sounds like you will need to isolate these processes better.

---

<div class="post-metadata">

### Author: ![yishain11](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yishain11](https://discuss.elastic.co/u/yishain11)
#### Post date: [April 15, 2019, 8:03am UTC](https://discuss.elastic.co/t/what-elasticsearch-does-when-restarting-a-cluster/176793/5 "2019-04-15T08:03:31Z")

</div>

Awsome.  
Thank you for your time and patience!

---

<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: [May 13, 2019, 8:16am UTC](https://discuss.elastic.co/t/what-elasticsearch-does-when-restarting-a-cluster/176793/6 "2019-05-13T08:16:51Z")

</div>

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