ElasticSearch version: 6.0.0
No of nodes : 3
Operating System : CentOS 7
Client : Low Level Rest Client of java
No of Index : 3
No of Shards per Index : 3
No of Replicas for Shard : 1
Each machine capacity : 32 Cores CPU
**I am want to know No of threads used for single search query and what formula you using .I checked Elastic Search source its telling No of Nodes * No of Shard per Index and below is proof of source code. **
1.searchRequest.setMaxConcurrentShardRequests(Math.min(256, nodeCount*IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getDefault(Settings.EMPTY)));
Case 1 : Based on source code it should use max number of threads are 9 (3 Nodes * 3 Shards for Index ) but its showing active threads count 3 only entire cluster.
Case 2: If single search query checking on multiple index(3 ) it that case its showing active threads count 9 only entire cluster.
Above two cases we are tried more than 100 times ,Any of the single cases also we are not seeing those many active threads count or queue or rejected. For verification purpose we are used _cat/thread_pool/search url.
Each query is coordinated on the node where it arrives, so will use a thread there at least periodically. Each query against a shard runs in a single thread so I would guess the number of threads used would roughly be the total number of primary shards addressed by the query. Primary or replica shards can serve the query so the shard distribution will determine on which node the threads are used.
I know Each query against a shard runs in single thread.Suppose Total No of Index are 5 in Elastic Search Cluster(Three Nodes).Three Index having 3 shards per Index and 1 Replicas.Remaining Twp Index having 5 shards per index and one replicas
Index Name
Node1
Node2
Node3
1
Shard1
Shard2
Shard3
Replica1
Replica3
Replica2
2
Shard1
Shard2
Shard3
Replica1
Replica3
Replica2
3
Shard1
Shard2
Shard3
Replica1
Replica3
Replica2
4
Shard1
Shard2
Shard3
Shard4
Shard5
Replica1
Replica2
Replica3
Replica4
Replica5
5
Shard1
Shard2
Shard3
Shard4
Shard5
Replica1
Replica2
Replica3
Replica4
Replica5
Test Cases : I want to know below each search query how many threads is going use doing search operation plus explanation.Format is indices/types/_search
1,2,3/1,2,3/_search
1,3,4/1,3,4,/_search
1,4/1,4/_search
Problem Statement: I will sent every one second 100 search queries to Elastic Search.First 100 search queries itself using entire search thread pool to run concurrent shards requests but at the time next 100 request not getting chase to execute until first 100 request to completed.If am able to control parallel shard request than we can able to give some threads to next 100 search queries.I know if I control parallel shard request it will reduce search speed its a not problem for me.
I am not sure I understand your question. All shard operations are queued up and processed by a fixed sized search thread pool. The more you throw at it the more will get queued up.
If you send 100 queries all targeting all the shards listed (19 different shards in total) a total of 1900 tasks (plus coordinating tasks) will get queued up. All threads in the thread pool are likely going to be busy working through this (depends on number of nodes and the size of the thread pool on each node). New queries coming in will end up at the end of the queue. As the nodes fill up the latency will increase.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.