ES 线程池(thread pool)

ES 线程池(thread pool)

ES 中每个节点有多种线程池

 

generic

For generic operations (for example, background node discovery). Thread pool type is scaling.

search

For count/search/suggest operations. Thread pool type is fixed_auto_queue_size with a size of int((# of available_processors * 3) / 2) + 1, and initial queue_size of 1000.

search_throttled

For count/search/suggest/get operations on search_throttled indices. Thread pool type is fixed_auto_queue_size with a size of 1, and initial queue_size of 100.

get

For get operations. Thread pool type is fixed with a size of # of available processors, queue_size of 1000.

analyze

For analyze requests. Thread pool type is fixed with a size of 1, queue size of 16.

write

For single-document index/delete/update and bulk requests. Thread pool type is fixed with a size of # of available processors, queue_size of 200. The maximum size for this pool is 1 + # of available processors.

snapshot

For snapshot/restore operations. Thread pool type is scaling with a keep-alive of 5m and a max of min(5, (# of available processors)/2).

warmer

For segment warm-up operations. Thread pool type is scaling with a keep-alive of 5m and a max of min(5, (# of available processors)/2).

refresh

For refresh operations. Thread pool type is scaling with a keep-alive of 5m and a max of min(10, (# of available processors)/2).

listener

Mainly for java client executing of action when listener threaded is set to true. Thread pool type is scaling with a default max of min(10, (# of available processors)/2).

fetch_shard_started

For listing shard states. Thread pool type is scaling with keep-alive of 5m and a default maximum size of 2 * # of available processors.

fetch_shard_store

For listing shard stores. Thread pool type is scaling with keep-alive of 5m and a default maximum size of 2 * # of available processors.

flush

For flushsynced flush, and translog fsync operations. Thread pool type is scaling with a keep-alive of 5m and a default maximum size of min(5, (# of available processors)/2).

force_merge

For force merge operations. Thread pool type is fixed with a size of 1 and an unbounded queue size.

management

For cluster management. Thread pool type is scaling with a keep-alive of 5m and a default maximum size of 5.详细可参

 

考官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html

 

查看线程池

curl localhost:9200/_cat/thread_pool/?v

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Elasticsearch使用线程池来处理各种操作,包括索引、搜索、删除等。通过合理配置线程池,可以提高Elasticsearch的性能和可靠性。 要导入Elasticsearch的线程池配置,你可以按照以下步骤进行操作: 1. 打开Elasticsearch的配置文件,通常位于 `config` 目录下的 `elasticsearch.yml` 文件。 2. 在配置文件中,找到或创建一个名为 `thread_pool` 的配置块。如果没有,则可以直接添加。 3. 在 `thread_pool` 配置块中,你可以定义多个线程池。每个线程池都有自己的名称和相关的设置。例如,你可以指定线程池的大小、最大队列长度、线程优先级等。 4. 根据你的需求,为每个线程池设置参数。以下是一些常用的线程池参数: - `size`:线程池的大小(默认为 1)。 - `max_queue_size`:最大队列长度,指定了允许排队等待执行的任务数。 - `queue_type`:队列类型,可以是 `bounded`(有界队列)或者 `unbounded`(无界队列)。 - `priority`:线程优先级,用于控制线程在竞争资源时的执行顺序。 - 其他可用参数,请参考官方文档以获取更多信息。 以下是一个示例配置,包含了两个自定义的线程池: ```yaml thread_pool: custom_pool1: size: 10 max_queue_size: 100 queue_type: bounded custom_pool2: size: 5 max_queue_size: 50 queue_type: unbounded priority: 1 ``` 5. 保存配置文件并重启Elasticsearch,以使新的线程池配置生效。 请注意,线程池的配置需要根据你的具体场景进行调整。过小的线程池可能会导致性能瓶颈,而过大的线程池可能会占用过多的系统资源。因此,建议根据实际负载和硬件情况进行测试和优化。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值