# Number of replicas and query speed

**URL:** <https://discuss.elastic.co/t/number-of-replicas-and-query-speed/6321>\
**Category:** Elasticsearch\
**Created:** [January 9, 2012, 10:08am UTC](https://discuss.elastic.co/t/number-of-replicas-and-query-speed/6321 "2012-01-09T10:08:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bogdanionescu](https://avatars.discourse-cdn.com/v4/letter/b/7cd45c/32.png) [@bogdanionescu](https://discuss.elastic.co/u/bogdanionescu)\
**Post date:** [January 9, 2012, 10:08am UTC](https://discuss.elastic.co/t/number-of-replicas-and-query-speed/6321/1 "2012-01-09T10:08:23Z")

</div>

Hello

I have a 4 node cluster with 7.7M docs indexed. 5 shards.  
Fist I've tried with 1 replica (default config) and we tested the  
query speed. It worked fine.  
The we used the REST API to increase the number of replicas to 4 and  
after a while the nodes reflected this change (in shards dirs stored  
locally all had a copy of all the 5 shards).  
The problems is that the query speed was exactly the same as when  
using 1 replica config!  
Any ideas why this happens? Shouldn't be any improvement at all?

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 9, 2012, 10:25am UTC](https://discuss.elastic.co/t/number-of-replicas-and-query-speed/6321/2 "2012-01-09T10:25:11Z")

</div>

Hiya

> I have a 4 node cluster with 7.7M docs indexed. 5 shards.  
> Fist I've tried with 1 replica (default config) and we tested the  
> query speed. It worked fine.  
> The we used the REST API to increase the number of replicas to 4 and  
> after a while the nodes reflected this change (in shards dirs stored  
> locally all had a copy of all the 5 shards).  
> The problems is that the query speed was exactly the same as when  
> using 1 replica config!  
> Any ideas why this happens? Shouldn't be any improvement at all?

ES still has to talk to exactly the same number of shards for your  
query. The fact that there are more of them to choose from doesn't  
affect your query speed.

Where it will make a difference is when you reach the point that your 1  
replica setup is too busy to cope with all of your queries. At that  
stage, having more replicas to choose from will help you to scale

clint

---

<div class="post-metadata">

**Author:** ![bogdanionescu](https://avatars.discourse-cdn.com/v4/letter/b/7cd45c/32.png) [@bogdanionescu](https://discuss.elastic.co/u/bogdanionescu)\
**Post date:** [January 9, 2012, 10:55am UTC](https://discuss.elastic.co/t/number-of-replicas-and-query-speed/6321/3 "2012-01-09T10:55:11Z")

</div>

I see... I agree the response time should be the same, but the I  
thought the throughput should increase.  
I'll try to increase the load and compare the results then.

On Jan 9, 12:25 pm, Clinton Gormley [cl...@traveljury.com](mailto:cl...@traveljury.com) wrote:

> Hiya
> 
> > I have a 4 node cluster with 7.7M docs indexed. 5 shards.  
> > Fist I've tried with 1 replica (default config) and we tested the  
> > query speed. It worked fine.  
> > The we used the REST API to increase the number of replicas to 4 and  
> > after a while the nodes reflected this change (in shards dirs stored  
> > locally all had a copy of all the 5 shards).  
> > The problems is that the query speed was exactly the same as when  
> > using 1 replica config!  
> > Any ideas why this happens? Shouldn't be any improvement at all?
> 
> ES still has to talk to exactly the same number of shards for your  
> query. The fact that there are more of them to choose from doesn't  
> affect your query speed.
> 
> Where it will make a difference is when you reach the point that your 1  
> replica setup is too busy to cope with all of your queries. At that  
> stage, having more replicas to choose from will help you to scale
> 
> clint

---

<div class="post-metadata">

**Author:** ![bogdanionescu](https://avatars.discourse-cdn.com/v4/letter/b/7cd45c/32.png) [@bogdanionescu](https://discuss.elastic.co/u/bogdanionescu)\
**Post date:** [January 9, 2012, 3:50pm UTC](https://discuss.elastic.co/t/number-of-replicas-and-query-speed/6321/4 "2012-01-09T15:50:03Z")

</div>

I did some tests under heavier load and I still could not see any  
improvement when using more replicas...

On Jan 9, 12:55 pm, [bogdaniones...@yahoo.com](mailto:bogdaniones...@yahoo.com) wrote:

> I see... I agree the response time should be the same, but the I  
> thought the throughput should increase.  
> I'll try to increase the load and compare the results then.
> 
> On Jan 9, 12:25 pm, Clinton Gormley [cl...@traveljury.com](mailto:cl...@traveljury.com) wrote:
> 
> > Hiya
> 
> > > I have a 4 node cluster with 7.7M docs indexed. 5 shards.  
> > > Fist I've tried with 1 replica (default config) and we tested the  
> > > query speed. It worked fine.  
> > > The we used the REST API to increase the number of replicas to 4 and  
> > > after a while the nodes reflected this change (in shards dirs stored  
> > > locally all had a copy of all the 5 shards).  
> > > The problems is that the query speed was exactly the same as when  
> > > using 1 replica config!  
> > > Any ideas why this happens? Shouldn't be any improvement at all?
> 
> > ES still has to talk to exactly the same number of shards for your  
> > query. The fact that there are more of them to choose from doesn't  
> > affect your query speed.
> 
> > Where it will make a difference is when you reach the point that your 1  
> > replica setup is too busy to cope with all of your queries. At that  
> > stage, having more replicas to choose from will help you to scale
> 
> > clint

---

<div class="post-metadata">

**Author:** ![Berkay\_Mollamustafao](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@Berkay\_Mollamustafao](https://discuss.elastic.co/u/Berkay_Mollamustafao)\
**Post date:** [January 9, 2012, 4:01pm UTC](https://discuss.elastic.co/t/number-of-replicas-and-query-speed/6321/5 "2012-01-09T16:01:20Z")

</div>

Can you give the details of the tests you're running? What are the  
variables in your tests? What resource (CPU, Disk IO, etc.) seems to be the  
bottleneck? How many client connections do you use? Do you increase the  
number? Do the clients run on the same box with servers? Which language is  
the client written in, could it be the bottleneck? What are the queries? do  
you change the queries or run the same ones? Are you only querying or  
updating the indices at the same time as well?  
It's not feasible to guess what the reason may be without fully  
understanding details of the tests.

Regards,  
Berkay Mollamustafaoglu  
mberkay on yahoo, google and skype

On Mon, Jan 9, 2012 at 10:50 AM, [bogdanionescu3@yahoo.com](mailto:bogdanionescu3@yahoo.com) wrote:

> I did some tests under heavier load and I still could not see any  
> improvement when using more replicas...
> 
> On Jan 9, 12:55 pm, [bogdaniones...@yahoo.com](mailto:bogdaniones...@yahoo.com) wrote:
> 
> > I see... I agree the response time should be the same, but the I  
> > thought the throughput should increase.  
> > I'll try to increase the load and compare the results then.
> > 
> > On Jan 9, 12:25 pm, Clinton Gormley [cl...@traveljury.com](mailto:cl...@traveljury.com) wrote:
> > 
> > > Hiya
> > 
> > > > I have a 4 node cluster with 7.7M docs indexed. 5 shards.  
> > > > Fist I've tried with 1 replica (default config) and we tested the  
> > > > query speed. It worked fine.  
> > > > The we used the REST API to increase the number of replicas to 4 and  
> > > > after a while the nodes reflected this change (in shards dirs stored  
> > > > locally all had a copy of all the 5 shards).  
> > > > The problems is that the query speed was exactly the same as when  
> > > > using 1 replica config!  
> > > > Any ideas why this happens? Shouldn't be any improvement at all?
> > 
> > > ES still has to talk to exactly the same number of shards for your  
> > > query. The fact that there are more of them to choose from doesn't  
> > > affect your query speed.
> > 
> > > Where it will make a difference is when you reach the point that your 1  
> > > replica setup is too busy to cope with all of your queries. At that  
> > > stage, having more replicas to choose from will help you to scale
> > 
> > > clint

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 9, 2012, 7:49pm UTC](https://discuss.elastic.co/t/number-of-replicas-and-query-speed/6321/6 "2012-01-09T19:49:43Z")

</div>

On a 4 node setup with 5 shards and 1 replica increasing the number of  
replicas will not change the search performance, since all the nodes are  
already "maxed" in terms of search being executed on them. You are just  
"making" more shards, but you still have only 4 boxes.

If you have an index that is already spread out, lets say an index with 2  
shards and 1 replica on a 10 box cluster (there might be other indices),  
then increasing the number of replicas will help then, since you will span  
more boxes in this case.

On Mon, Jan 9, 2012 at 5:50 PM, [bogdanionescu3@yahoo.com](mailto:bogdanionescu3@yahoo.com) wrote:

> I did some tests under heavier load and I still could not see any  
> improvement when using more replicas...
> 
> On Jan 9, 12:55 pm, [bogdaniones...@yahoo.com](mailto:bogdaniones...@yahoo.com) wrote:
> 
> > I see... I agree the response time should be the same, but the I  
> > thought the throughput should increase.  
> > I'll try to increase the load and compare the results then.
> > 
> > On Jan 9, 12:25 pm, Clinton Gormley [cl...@traveljury.com](mailto:cl...@traveljury.com) wrote:
> > 
> > > Hiya
> > 
> > > > I have a 4 node cluster with 7.7M docs indexed. 5 shards.  
> > > > Fist I've tried with 1 replica (default config) and we tested the  
> > > > query speed. It worked fine.  
> > > > The we used the REST API to increase the number of replicas to 4 and  
> > > > after a while the nodes reflected this change (in shards dirs stored  
> > > > locally all had a copy of all the 5 shards).  
> > > > The problems is that the query speed was exactly the same as when  
> > > > using 1 replica config!  
> > > > Any ideas why this happens? Shouldn't be any improvement at all?
> > 
> > > ES still has to talk to exactly the same number of shards for your  
> > > query. The fact that there are more of them to choose from doesn't  
> > > affect your query speed.
> > 
> > > Where it will make a difference is when you reach the point that your 1  
> > > replica setup is too busy to cope with all of your queries. At that  
> > > stage, having more replicas to choose from will help you to scale
> > 
> > > clint

---

<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, 3:43am UTC](https://discuss.elastic.co/t/number-of-replicas-and-query-speed/6321/7 "2017-07-06T03:43:19Z")

</div>


