开发者社区 > 云原生 > 正文

EagerThreadPoolExecutor 在Jmeter压测时出现线程池耗尽问题

最近在学习Dubbo源码,当学习到Dubbo中有关EagerThreadPool相关知识时遇到了一个问题,下面是我的dubbo-demo的一些配置:

提问35.png

提问36.png

然后我使用Jmeter进行压测,模拟高并发场景

提问37.png

提问38.png

紧接着,使用 jmeter -n -t命令执行压测

在这个过程中,会出现 Dubbo线程池耗尽的警告信息

提问39.png

[08/09/22 10:13:07:886 CST] NettyServerWorker-3-4 WARN support.AbortPolicyWithReport: [DUBBO] Thread pool is EXHAUSTED! Thread Name: dubbo-demo-annotation-provider-198.18.0.1:20880, Pool Size: 10 (active: 1, core: 5, max: 10, largest: 10), Task: 92341 (completed: 92340), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://198.18.0.1:20880!, dubbo version: , current host: 198.18.0.1 [08/09/22 10:13:07:886 CST] NettyServerWorker-3-5 WARN support.AbortPolicyWithReport: [DUBBO] Thread pool is EXHAUSTED! Thread Name: dubbo-demo-annotation-provider-198.18.0.1:20880, Pool Size: 10 (active: 0, core: 5, max: 10, largest: 10), Task: 92342 (completed: 92341), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://198.18.0.1:20880!, dubbo version: , current host: 198.18.0.1 [08/09/22 10:13:07:886 CST] NettyServerWorker-3-8 WARN support.AbortPolicyWithReport: [DUBBO] Thread pool is EXHAUSTED! Thread Name: dubbo-demo-annotation-provider-198.18.0.1:20880, Pool Size: 10 (active: 0, core: 5, max: 10, largest: 10), Task: 92342 (completed: 92341), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://198.18.0.1:20880!, dubbo version: , current host: 198.18.0.1 [08/09/22 10:13:07:886 CST] NettyServerWorker-3-9 WARN support.AbortPolicyWithReport: [DUBBO] Thread pool is EXHAUSTED! Thread Name: dubbo-demo-annotation-provider-198.18.0.1:20880, Pool Size: 10 (active: 0, core: 5, max: 10, largest: 10), Task: 92342 (completed: 92341), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://198.18.0.1:20880!, dubbo version: , current host: 198.18.0.1 [08/09/22 10:13:07:886 CST] NettyServerWorker-3-6 WARN support.AbortPolicyWithReport: [DUBBO] Thread pool is EXHAUSTED! Thread Name: dubbo-demo-annotation-provider-198.18.0.1:20880, Pool Size: 10 (active: 0, core: 5, max: 10, largest: 10), Task: 92341 (completed: 92340), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://198.18.0.1:20880!, dubbo version: , current host: 198.18.0.1

本来也很正常,Jmeter文件里设置了线程数为 100

提问40.png

但是报错信息的 Pool的activeCount竟然不是10,如果线程池耗尽的话,这里的activeCount应该是10才对。

提问41.png

这是为什么?

然后我改造了一下,增加了一下日志打印参数,如下:

提问42.png

之后还是使用Jmeter进行压测,结果如下:

提问43.png

submittedTaskCount、active和Pool Size还是对不上

原提问者GitHub用户workingonescape

展开
收起
大圣东游 2023-05-11 16:43:18 166 0
1 条回答
写回答
取消 提交回答
  • debug 看了下,active 小于 pool 的原因是中间的 queue 存在竞争以及 worker 获取任务不够及时导致的。queue 队列长度只有 1,在高并发场景下会导致 worker 来不及获取任务就有新任务提交导致被拒绝。

    原回答者GitHub用户AlbumenJ

    2023-05-12 10:32:35
    赞同 展开评论 打赏

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关产品

  • 性能测试
  • 相关电子书

    更多
    上云时代业务压测和诊断最佳实践 立即下载
    超大规模性能测试的云端方案及案例分享 立即下载
    Cassandra 性能压测及调优实战 立即下载