Multisearch query performance

(Anatoly Petkevich) #1

We execute multisearch requests with 50 almost identical search queries. These queries took very close time being ran separately.
With multisearch query we see that "took" element in each subsequent response is greater than the previous one.
For example took=6 for the first response and took=145 for the last response.
Interesting that running these requests concurrently via standard search api gives even better overall time than multisearch query.
Are multisearch requests executed sequentially and not parallelized?

The version of Elasticsearch is 1.7.2, and number of primary shards is 7, replicas - 1.

(Tanguy) #2


Search requests are concurrently executed but this overall execution is bounded, meaning that if you submit 10 000 requests in a multi search request you don't end with 10 000 concurrent executions.

Since you don't have replica, the 7 primary shards will be queried for every search request - so around 7 * 50 concurrent search operations where some of them will be executed concurrently and other will wait for a slot to be executed.

How many nodes do you have? Having replica in your case will improve search performance.

(Anatoly Petkevich) #3

Thank you.
Actually we have 3 nodes, 7 primary shards with one replica.
As a potential solution we could increase size of thread pool for search operations, but not sure it helps.

(Tanguy) #4

Oh ok I misunderstood replicas - 1 :slight_smile:

If you're using an official client to connect to your cluster you can execute your requests and let the client act as a kind of load balancer between your nodes. You can also try to use routing.

(system) #5