elasticsearch 线程与核数

☆樱花仙子☆ 提交于 2020-08-10 02:16:29

1. 背景

ES中的线程数以及核数主要体现在ES线程池使用上,见

https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html

2. processors

通过 GET /_nodes/os  可以查看各个节点processors分片情况

5.X版本,单个节点 allocated_processors 最多分配32核

最新的7.X版本已经没有这个限制, available_processors 和 allocated_processors 保持一致为最大可用核数

3. ES中的线程池

以thread_pool.search.size为例:

公式一:thread_pool.search.size = ( 3 * available_processors/2 )+1

公式二:thread_pool.search.queue_size  = 1000

1、只设置processors大小,ES会根据公式一计算出thread_pool.search.size,ES使用的CPU核数最大为min(系统最大核数,thread_pool.search.size)

2、只设置thread_pool.search.size大小,ES使用的CPU核数最大为min(系统最大核数,thread_pool.search.size)

3、同时设置processors、thread_pool.search.size,以公理2 thread_pool.search.size情况为准

4. 线程池和查询性能关系

经过大量实验,thread_pool.search.size从30线程到300线程,查询耗时总体呈先下降后上升趋势

thread_pool.search.size设置为CPU核数的95%的时候性能最优

thread_pool.search.queue_size设置为-1的时候,并发查询性能最优

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!