Slow queries during users peak

(Nerijus Oftas) #1

We have project with a lot of users in website. All site information we store in elaticsearch in AWS i3.8xlarge.elasticsearch 8 instances. We have one index and in this index 7 types. Total documents count is 80millions. I think this number of documents is not big for elasticsearch. But when we get users peak, elasticsearch become so slow and we get timeouts from AWS ELB. Elasticsearch intances CPU increase to 95%. maybe you can provide us suggestions or what we can tweak to get better performance. I checked queries count in each website page. We have 1-3 queries per page.

Thanks if you will be able to help me.
More info about our cluster:
3 Master nodes (1 active - the other 2 in case of failing)
11 data nodes
Default configuration:
1 index / 5 shards
We've changed from 1 to 2 replicas

(Christian Dahlqvist) #2

How large is the index? How large are your documents? What type of queries are you using? How many queries per second are you serving? Which version of Elasticsearch are you using?

(Nerijus Oftas) #3

Thanks for quick answer. We are using Elastic search 5.6 version. I attached file with few query examples which we are using. Most of our queries are similar to these.

Index size 63.6gb at this moment.
Document size is not big (about 0,81KB / Document). Document contains 10-20 attributes. These attributes are integers or keywords.
Actually I do not know how many queries per second we serve. We can not enable logging on prod, because this will impact performance.
But like I said before we have 1-3 queries per page load. And AWS load balancer shows 120 000 queries per minute.
Hope this info will be enough to help me.

I use this library

(Christian Dahlqvist) #4

If I understand this correctly, you have a single index in the cluster with 2 replicas (15 shards in total) across 11 data nodes. This means that each node only have 1 or 2 shards. As your data set is reasonably small, have you tried to increase the replica count further to spread out load better?

Can you also provide the output of the cluster stats API.

How frequently are you updating or indexing data?

(Nerijus Oftas) #5

Yes. single index and 2 replicas and 11 nodes. Every hour we update about 600 000 different documents. Also we get about 200 000- 300 000 new documents records in a hour. We did not try to increase replica count anymore.

Here is a cluster stats:

(Christian Dahlqvist) #6

Typically you increase query throughput in Elasticsearch by scaling out the number of replica shards. The trade-off is naturally that this requires more effort when indexing and updating data. I would recommend slowly increasing the number of replicas to see what effect it has unless you have a separate cluster to run benchmarks on.

(Nerijus Oftas) #7

Thanks for suggestion. Also If I will split my index to smaller. Will it help?

(Christian Dahlqvist) #8

It is difficult to know if more, smaller shards will perform better or not, so the best way id probably to test or benchmark. It may make sense to align the number of primary shards with the number of data nodes you have.

(Nerijus Oftas) #9

We changed instance type and added more nodes. Seems that this helped. Also from AWS guys we get suggestion to reindex data. So we moved types to other index with more shards.

(system) #10

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