# Replicas, balancing and cache

**URL:** <https://discuss.elastic.co/t/replicas-balancing-and-cache/14186>\
**Category:** Elasticsearch\
**Created:** [October 31, 2013, 11:01am UTC](https://discuss.elastic.co/t/replicas-balancing-and-cache/14186 "2013-10-31T11:01:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rodrigo\_Farto\_Alonso](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@Rodrigo\_Farto\_Alonso](https://discuss.elastic.co/u/Rodrigo_Farto_Alonso)\
**Post date:** [October 31, 2013, 11:01am UTC](https://discuss.elastic.co/t/replicas-balancing-and-cache/14186/1 "2013-10-31T11:01:51Z")

</div>

Hi.

With our current configuration we are not capable of taking full advantage  
of the cache.

We have 4 replicas, 15 nodes and node filter cache configuration. We need  
to execute a filter 5 consecutive times in order for it to be cached (we  
have run several test combining different filters and we are pretty sure  
that's how it is working)

So I guess there is some kind of round-robin balancing, the easy way out  
will be to set a index filter cache but as it is a _not recommended feature_I wonder if there is a way to change the balancing configuration (to make  
sure all the petitions in the same session are serviced by the same  
node-replica)

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 31, 2013, 11:09am UTC](https://discuss.elastic.co/t/replicas-balancing-and-cache/14186/2 "2013-10-31T11:09:56Z")

</div>

We've not encountered this as yet so I'm not 100% on this next bit, but  
would  
[http://exploringelasticsearch.com/book/advanced-techniques/routing.html](http://exploringelasticsearch.com/book/advanced-techniques/routing.html) be  
helpful?

Regards,  
Mark Walkom

Infrastructure Engineer  
Campaign Monitor  
email: [markw@campaignmonitor.com](mailto:markw@campaignmonitor.com)  
web: [www.campaignmonitor.com](http://www.campaignmonitor.com)

On 31 October 2013 22:01, Rodrigo Farto Alonso \<[rodrigofartoalonso@gmail.com](mailto:rodrigofartoalonso@gmail.com)

> wrote:

> Hi.\*\*\*\*
> 
> With our current configuration we are not capable of taking full  
> advantage of the cache.
> 
> We have 4 replicas, 15 nodes and node filter cache configuration. We need  
> to execute a filter 5 consecutive times in order for it to be cached (we  
> have run several test combining different filters and we are pretty sure  
> that's how it is working)
> 
> So I guess there is some kind of round-robin balancing, the easy way out  
> will be to set a index filter cache but as it is a _not recommended  
> feature_ I wonder if there is a way to change the balancing configuration  
> (to make sure all the petitions in the same session are serviced by the  
> same node-replica)\*\*\*\*
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Rodrigo\_Farto\_Alonso](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@Rodrigo\_Farto\_Alonso](https://discuss.elastic.co/u/Rodrigo_Farto_Alonso)\
**Post date:** [October 31, 2013, 11:40am UTC](https://discuss.elastic.co/t/replicas-balancing-and-cache/14186/3 "2013-10-31T11:40:58Z")

</div>

We are already using routing our query looks like:

curl -s -XPOST  
'[http://lpels001:9210/ebes\_index/movimientos/\_search?routing=XXXXXXXXX](http://lpels001:9210/ebes_index/movimientos/_search?routing=XXXXXXXXX)'  
--data-binary {

"query": {

```
"filtered": {

  "query": {

    "bool": {

      "should": [

        {

          "prefix": {

            "descripcionConcepto": "SOME TEXT"

          }

        }

      ]

    }

  },

  "filter": {

    "bool": {

      "must": {

        "terms": {

            "codigoInternoDelContratoIuc": [

             XXXXXXXXX #As in the routing parameter

            ]

        }

      }

    }

  }

}

```

},

"facets": {

```
"facetTextoPredictivo": {

  "terms": {

    "fields": [

      "descripcionConcepto.raw",

      "descripcionMovimiento.raw",

      "comentarios.raw",

      "notasDeUsuario.notas.raw"

    ],

    "size": 100

  }

}

```

},

"size": 0

}

That particular query takes around 50 seconds when not routed, 8s when  
routed but not cached and 20 ms when cached (we have over 3 TB of data).

So goal is for the query to take 8s just the first time, and not 8s for the  
first execution against each replica.

On Thursday, October 31, 2013 12:09:56 PM UTC+1, Mark Walkom wrote:

> We've not encountered this as yet so I'm not 100% on this next bit, but  
> would  
> [http://exploringelasticsearch.com/book/advanced-techniques/routing.htmlbe](http://exploringelasticsearch.com/book/advanced-techniques/routing.htmlbe) helpful?
> 
> Regards,  
> Mark Walkom
> 
> Infrastructure Engineer  
> Campaign Monitor  
> email: [ma...@campaignmonitor.com](mailto:ma...@campaignmonitor.com) \<javascript:\>  
> web: [www.campaignmonitor.com](http://www.campaignmonitor.com)
> 
> On 31 October 2013 22:01, Rodrigo Farto Alonso \<[rodrigofa...@gmail.com](mailto:rodrigofa...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi.\*\*\*\*
> > 
> > With our current configuration we are not capable of taking full  
> > advantage of the cache.
> > 
> > We have 4 replicas, 15 nodes and node filter cache configuration. We need  
> > to execute a filter 5 consecutive times in order for it to be cached (we  
> > have run several test combining different filters and we are pretty sure  
> > that's how it is working)
> > 
> > So I guess there is some kind of round-robin balancing, the easy way out  
> > will be to set a index filter cache but as it is a _not recommended  
> > feature_ I wonder if there is a way to change the balancing  
> > configuration (to make sure all the petitions in the same session are  
> > serviced by the same node-replica)\*\*\*\*
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
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, 2:09am UTC](https://discuss.elastic.co/t/replicas-balancing-and-cache/14186/4 "2017-07-06T02:09:38Z")

</div>

Closed on July 6, 2017, 2:09am UTC


