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.
随机推荐
- Linux远程连接Windows桌面
Ubuntu对初始用户的界面友好是有目共睹的:Fedora一向以创新.傲慢的姿态示人.其实,对于两者,我虽然更倾向于选择Fedora,但不可避免地会两者比较,发现Ubuntu更加人性化,这点是经过很多 ...
- 监听程序未启动或数据库服务未注册到该监听程序。启动该监听程序并注册数据库服务 然后重新运行 em configuration assistant。
在WIN 7/64Bit上安装ORACLE 11gR2后,管理网页Database Control(如:https://localhost:1158/em)始终登录不进去,总是说密码错误,使用配置工具 ...
- 如何快捷地使用ChemBio 3D检查结构信息
ChemBio 3D是一款三维分子结构演示软件,能够轻松快捷地进行化学结构的制作和立体旋转.ChemBio 3D Ultra 14作为ChemBio 3D的最新版本可以更加快捷地制作化学结构.本教程将 ...
- [转] Windows局域网通过NTP设置时间同步
NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议. 如果局域网计算机(Windows系统)可以连接Internet,可以通过“控制面板”— ...
- JavaScript编码encode和decode escape和unescape
encodeURI() 函数可把字符串作为 URI 进行编码. 语法 encodeURI(URIstring) 参数 描述 URIstring 必需.一个字符串,含有 URI 或其他要编码的文本. 返 ...
- ubuntu下vim配置(刷题和比赛两套)
1. 平时刷题练习使用 "mswin.vim 插件提供windows下的编辑快捷键功能 source $VIMRUNTIME/mswin.vim behave mswin set nu se ...
- python文件和目录操作方法大全(含实例)【python】
转自:http://www.jb51.net/article/48001.htm 一.python中对文件.文件夹操作时经常用到的os模块和shutil模块常用方法. 1.得到当前工作目录,即当前Py ...
- ios错误大全
/读取数据库数据 -(void)movethesqlitefile{ NSString *sourcepath=[[NSBundle mainBundle]pathForResource:@" ...
- 【VUE】Mac下vue 开发环境搭建,以及目录结构
1 安装Node.js 参看 node.js环境安装 http://www.cnblogs.com/richerdyoung/p/7265786.html 2 安装淘宝镜像 npm install ...
- MUI 图片上传剪切预览,可选(拍照+系统相册)
整合网上的例子..麻蛋.没跑通..没办法.自己就拿他们的例子完善了一下..已经可以使用了! 准备工作: 这几个文件要引入.特别是JS 文件!!! <link href="../css/ ...