Does the replica shard can help to speed up aggregation also?


(Kramer Li) #1

Hi

Hi

I know Replica Shard can help to improve search. speed. But how about aggregation? Aggregation is based on field data or Doc Value. So I`m not sure if the replica shard (which is inverted index) will help aggregation also?

Regards
Mingwei


(Mark Walkom) #2

Yes they do!
Although adding in a lot of replicas can slow things down, so don't go crazy.


(Kramer Li) #3

Hi

Thanks very much. But can you give some details like how replica can help AGG? Or if there is any doc talking about this?

Regards
Mingwei


(Mark Walkom) #4

Adding a replica means that you have the data in (at least) two places, so it adds the ability to spread the load of the query over more nodes.


(Nik Everett) #5

It'll really only speed up the aggregation if you are doing two or more at the same time. If you are just doing one then it is just executed on a single replica.

There are some cases where you can make performance worse with replicas - mostly around disk cache hits. If you have zillions of replicas then each node will have a copy of data and it'll randomly be picked to aggregate on it. So it'll have to load it from the disk. If you have fewer replicas it is more likely that that data will already by in the disk cache. Sometimes. Sometimes having more replicas just lets you bring more CPUs to bear on concurrent requests. So..... its complicated?

Replicas are always good for redundancy.


(system) #6