An elasticsearch node has multiple thread pools, but the following four are important:
Index: mainly refers to data indexing and data deletion operations (the default type is cached)
Search: mainly for obtaining, statistics, and search operations (the default type is cached)
BULK: mainly refers to batch operations on indexes (the default type is cached)
Refresh: mainly for update operations (the default type is cached)
You can set a parameter to change the thread pool type. For example, you can change the index thread pool to the blocking type:
threadpool: index: type: blocking min: 1 size: 30 wait_time: 30s
The following are three types of thread pools that can be set:
Cache
The cache thread pool is an infinite thread pool. Multiple Threads are created if many requests exist. The following is an example:
threadpool: index: type: cached
Fixed
The fixed thread pool maintains a fixed number of threads to process request queues.
The size parameter sets the number of threads. The default setting is 5 times the number of CPU cores.
Queue_size can control the size of the queue to be processed. The default value is-1, which means no limit. When a request arrives but the queue is full, the reject_policy parameter can control its behavior. The default value is abort, which will cause the request to fail. If it is set to caller, the request will be executed in the IO thread.
threadpool: index: type: fixed size: 30 queue: 1000 reject_policy: caller
Blocking
The blocking thread pool allows you to set a minimum value (min, 1 by default) and a thread pool size (size, 5 times the number of CPU cores by default ). It also has a waiting queue. The queue size (queue_size) is 1000 by default. When the queue is full. It will call the IO thread Based on the specified wait time (wait_time, 60 seconds by default). If the thread is not executed, an error will be reported.
threadpool: index: type: blocking min: 1 size: 30 wait_time: 30s
References: http://www.searchtech.pro/articles/2013/02/15/1360942982347.html