# Load balancing and a node with no primary shard

**URL:** <https://discuss.elastic.co/t/load-balancing-and-a-node-with-no-primary-shard/15078>\
**Category:** Elasticsearch\
**Created:** [January 2, 2014, 12:34pm UTC](https://discuss.elastic.co/t/load-balancing-and-a-node-with-no-primary-shard/15078 "2014-01-02T12:34:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy\_Aharoni](https://avatars.discourse-cdn.com/v4/letter/g/ee7513/32.png) [@Guy\_Aharoni](https://discuss.elastic.co/u/Guy_Aharoni)\
**Post date:** [January 2, 2014, 12:34pm UTC](https://discuss.elastic.co/t/load-balancing-and-a-node-with-no-primary-shard/15078/1 "2014-01-02T12:34:16Z")

</div>

Hi,

We have a system based on Elasticsearch and we're performing volume tests  
in order to come up with hardware requirements.

Following the tests, I am confused by the role of the primary shard in a  
load balanced environment and am wondering regarding performance after a  
node failure. I also have issues with ES\_MAX\_MEM.

Can you please help?

In my lab I have two data nodes and one client node (non-data), configured  
for two shards and one replica. My client is sending Index requests to the  
client node. ES\_MAX\_MEM=ES\_MIN\_MEM=8g and eace node has 16GB RAM. In the  
volume tests we sent a steady stream of messages to ES (12,500 messages  
every 5 seconds).

During testing I closed one of the data nodes and as a result the other  
node showed it's two shards are primary shards.  
When the first node came back up all turned green, but the second node  
still held both primary shards.  
The other thing that happened is the elasticseach memory consumption  
constantly grew until it consumed the entire 16GB RAM.

1. Shouldn't adding a new node result in splitting primary shards  
between all nodes? How come one of the shards in the first node did not  
become a primary share?
2. Since the client node is load balancing, what happens when it sends  
data to the node which has no primary shard? Does that impact performance?
3. How come ES consumed 16GBRAM when ES\_MAX\_MEM is set to 8g?

Thanks,  
Guy

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1de23735-5b44-49b3-8e2a-96ecdc362f14%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1de23735-5b44-49b3-8e2a-96ecdc362f14%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [January 2, 2014, 2:15pm UTC](https://discuss.elastic.co/t/load-balancing-and-a-node-with-no-primary-shard/15078/2 "2014-01-02T14:15:08Z")

</div>

1. What you observe is correct. Replica shards can be instantly promoted to  
primary shards. Primary shards stay as long as the node is running. The  
reason is, there is no functional difference between a primary and replica.  
You should not worry about primary shards at all, they do not matter for  
load balancing.

2. Each node is able to route any index request, over the whole cluster,  
whether it holds primary shards or not. All nodes that hold shards of an  
index will receive index requests. The primary first, the others next. Only  
the order is different, not the resulting indexing load.

3. ES\_MAX\_MEM is not limiting the maximum memory of the process. It is the  
maximum heap memory for the JVM. Beside the heap, the JVM allocates other  
memory spaces, direct buffer memory, or caches.

Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHo09zMa%3Dj%3DoMgE4FRkR7\_8pacDGH%3D5xNU3JvtdFYxawg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHo09zMa%3Dj%3DoMgE4FRkR7_8pacDGH%3D5xNU3JvtdFYxawg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 1:58am UTC](https://discuss.elastic.co/t/load-balancing-and-a-node-with-no-primary-shard/15078/3 "2017-07-06T01:58:41Z")

</div>


