ES_DEVOPS-1
When dealing with a large number of parallel operations in elasticsearch, such as search requests or bulk indexing operations, you may encounter thread pool related errors. Here we explain thread pools and discuss a typical search request thread pool error that might be faced, as well as how to handle such issues.
Thread pools
Thread pools are a collection of threads which are made available to perform specific tasks in elasticsearch. The main goal of thread pools is to make the memory management easier by managing the life-cycles of the threads when it comes to executing large number of requests.
A single node in elasticsearch holds several thread pools for different operations such as search, indexing, bulk operations, and more. Most thread pools are associated with a queue whose purpose is to deal with pending requests. For ease of understanding, let's consider the search thread pool and discuss more about the concept and structure.
Search Thread Pools
Search operations in elasticsearch have a dedicated search pool and an associated queue for each node. The thread pools will have "N"
workers, which accept the requests. The number of workers is equal to the number of cores in that node. These N workers can accept a total of N search requests at a time. The number of workers is determined by the number of cores the node is equipped with.
Thread pool queues are deployed when request numbers are exceeded. The default size of the search queue is 1000, and the requests which exceed the thread pool worker numbers are queued in here.
The below picture shows the search thread pool and its queue existing in a single node. The first set of requests are handled by the "search thread pool"
with its "N"
workers. The next set of search requests go to the search queue whose default size is 1000.
Requests Exceeding Limits
What happens when requests exceed the number of workers and search queue size? As in the figure shown below, if the number of parallel requests are more than the thread pool and the queue can handle, Elasticsearch throws an exception error.
Solutions
There are a few solutions that can be applied, according to the use case to solve the request, which include:
- Increasing the size of the thread pool. We can increase the size of the thread pool by setting the
"threadpool.search.size"
parameter. But, it will affect the query speed performance. - Increasing the size of the search queue. The ideal and most common practice is increasing the search queue size. It should be noted that the search queue resides in the memory. Increasing it extensively can lead to out-of-memory exception errors.
- Increasing the nodes and replicas. This issue is caused by the overload of parallel requests, depending on use case. This method is rarely employed.
- Changing input data to serial data. This less popular method is used to serialize the data. This method depends on the use case and is employed only if the query performance is not considered.
Conclusion
In this post we discussed search thread pools and the exception errors that might incur in the case of multiple requests. We also explained solutions for the exception errors thrown in cases of multiple requests. Questions/Comments? Drop us a line below.
随机推荐
- 最短路径问题-Floyd算法
概念 最短路径也是图的一个应用,即寻找图中某两个顶点的最短路径长度. 实际应用:例如确定某两个城市间的坐火车最短行车路线长度等. Floyd algorithm 中文名就是弗洛伊德算法. 算法思路:用 ...
- 3D游戏与计算机图形学中的数学方法-视截体
视截体用来表示一个空间的范围,位于这个空间范围内的三维场景的任何物体都可以被看到. 视截体由六个平面围成,其中的四个平面与场景的边界相对应,分别被称为左,右,底,顶视截面.另外两个平面称为近视截面和远 ...
- 【Java面试题】41 两个对象值相同(x.equals(y) == true),但却可有不同的hash code,这句话对不对?
对. 如果对象要保存在HashSet或HashMap中,它们的equals相等,那么,它们的hashcode值就必须相等. 如果不是要保存在HashSet或HashMap,则与hashcode没有什么 ...
- Shell 获取Shell所在目录
SHELL_PATH=$(cd ")";pwd) echo $SHELL_PATH
- iperf/netperf网络性能测试工具、Wireshark网络包分析工具
iperf http://www.linuxidc.com/Linux/2014-05/101160.htm netperf http://www.linuxidc.com/Linux/2013 ...
- go语言的time.Sleep
首先:time.sleep单位为:1ns (纳秒) 转换单位: 1纳秒 =1000皮秒 1纳秒 =0.001 微秒 1纳秒 =0.000 001毫秒 1纳秒 =0.0 ...
- ios 获取设备相关的信息
.获取设备的信息 UIDevice *device = [[UIDevice alloc] int]; NSString *name = device.name; //获取设备所有者的名称 NSStr ...
- 关于直播学习笔记-005-nginx-rtmp-win32在Win10上使用
在Win10上使用nginx-rtmp-win32会提示文件路径问题. 可以将nginx-rtmp-win32拷贝到用户目录文件夹之中. 在命令行中执行nginx.exe程序
- 微信移动端(wap)开发调试工具
为帮助开发者更方便.更安全地开发和调试基于微信的网页,微信官方推出了 web 开发者工具.它是一个桌面应用,通过模拟微信客户端的表现,使得开发者可以使用这个工具方便地在 PC 或者 Mac 上进行开发 ...
- 【渗透测试学习平台】 web for pentester -8.XML
example1: http://192.168.91.139/xml/example1.php?xml=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%2 ...