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.
随机推荐
- C++字符串转化为数字的库函数
原文链接:http://blog.csdn.net/tsinfeng/article/details/5844838 1.atoi 功 能:把一字符串转换为整数 用 法:int atoi(const ...
- 【java 类加载的深入研究1】loadClass()的研究
1.开门见山 以前曾经看到过一个java的面试题,当时觉得此题很简单,可是自己把代码运行起来,可是结果并不是自己想象的那样.题目如下: class SingleTon { private static ...
- jQuery-修改元素属性
1.attr方法 获取匹配的元素集合中的第一个元素的属性的值 或 设置匹配元素指定的属性 使用说明: 1)只传一个参数的情况: 1>字符串(属性名称) 只传一个字符串属性名称 表示获取匹配的元素 ...
- C++ string char[] 转化
可见到string转char[]相当简单,只要呼叫string class的成员函式c_str(),即可将string转为char[].那么char[]转string呢?有两种方法,第一种是初始str ...
- 如何用MathType编辑化学等式
MathType在数学中应用非常广泛,被大量用于编辑数学公式,MathType不仅可以用来编辑数学公式,还可以编辑化学反应式,那么MathType编辑化学等式怎么操作的呢? 具体操作如下: 1.打开M ...
- tiny4412 linux+qtopia nfs网络文件系统的挂载
1,首先确定uboot启动内核的bootargs参数 Linux-CommandLine = root=/dev/nfs nfsroot=192.168.1.131:/home/tiny4412/ro ...
- NHibernate实例
1. 下载相关资源: 下载NHibernate.下载地址: http://nhforge.org/Default.aspx 下载微软Northwind示例数据库,下载地址:http://www.mic ...
- JBPM4.4_jBPM4.4应用(与Spring集成&自行控制事务等)
1. jBPM4.4应用 1.1. 与Spring集成(jBPM4.4 Developers Guide, Chapter 17. Spring Integration) 1.1.1. 在jbpm.c ...
- scala函数进阶篇
1.求值策略scala里有两种求值策略Call By Value -先对函数实参求值,在函数体中用这个求出的参数值.Call By Name -先不对函数实参求值,而是函数实参每次在函数体内被用到时都 ...
- Spring装配Bean的过程补充
对上一篇的<Spring装配Bean的过程>的过程说一下,不然真产生了误区. 误区在哪里呢?那就是spring bean的作用域问题. 说哈常用的两种作用域:默认是scope = sing ...