conductor client端源码解析(批量拉取)

1.背景:

conductor的主分支在2022-11-01这天提交了一个变更,即worker从server端拉取任务时是批量拉取;如此,worker作为消费端能减少

pull任务时的耗时,批次越大,每次拉取任务的平均耗时就越低,此在梳理下其相关逻辑。
在这里插入图片描述

2.关键代码:

2.1 拉取批量的配置

配置代码:
com.netflix.conductor.client.spring.ClientProperties#taskThreadCount
在这里插入图片描述
这是之前就有的一个配置项,用于精细化配置每个worker的执行执行线程数

在applicaiton.properties中:
conductor.client.task-thread-count.aaa=5
或者
conductor.client.taskThreadCount.aaa=5

若不配置 conductor.client.taskThreadCount,则会通过 conductor.client.threadCount计算,该参数配置的是所有worker的执行线程池大小

若不配置conductor.client.threadCount,则默认取worker的数量,即平均一个worker一个执行线程

代码: com.netflix.conductor.client.automator.TaskRunnerConfigurer#TaskRunnerConfigurer
在这里插入图片描述
注意:conductor.client.taskThreadCount 和 conductor.client.threadCount 不能同时配置,否则报错
在这里插入图片描述

2.2 批量拉取动作

com.netflix.conductor.client.automator.TaskPollExecutor#TaskPollExecutor
在这里插入图片描述
拉取任务:
com.netflix.conductor.client.automator.TaskPollExecutor#pollAndExecute
在这里插入图片描述

3.一批次pull数量设置的取舍

** 在任务积压时,一次pull的任务数量越多,理论上在pull上的平均耗时就越少,消费能力越强,但是,若设置太大,会影响低负载时的耗时;**

执行批量拉取时,请求的rest接口为 : GET /api/tasks/poll/batch/{taskType}
com.netflix.conductor.rest.controllers.TaskResource#batchPoll

com.netflix.conductor.service.ExecutionService#poll(java.lang.String, java.lang.String, java.lang.String, int, int)
在这里插入图片描述

com.netflix.conductor.redis.dao.DynoQueueDAO#pop
在这里插入图片描述

我们走的实现为:com.netflix.dyno.queues.redis.RedisDynoQueue#pop
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值