DUBBO Thread pool is EXHAUSTED!

2,374 阅读2分钟

一、问题

在测试环境遇到的异常信息,如下:

16-10-17 00:00:00.033 [New I/O server worker #1-6] WARN com.alibaba.dubbo.common.threadpool.support.AbortPolicyWithReport – [DUBBO] Thread pool is EXHAUSTED! Thread Name: DubboServerHandler-10.0.0.77:20703, Pool Size: 500 (active: 500, core: 500, max: 500, largest: 500), Task: 5897697 (completed: 5897197), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://10.0.0.77:20703!, dubbo version: 2.5.3, current host: 127.0.0.116-10-17 00:00:00.033 [New I/O server worker #1-6] WARN org.jboss.netty.channel.DefaultChannelPipeline – [DUBBO] An exception was thrown by a user handler while handling an exception event ([id: 0x3c650867, /10.0.0.83:53184 => /10.0.0.77:20703] EXCEPTION: com.alibaba.dubbo.remoting.ExecutionException: class com.alibaba.dubbo.remoting.transport.dispatcher.all.AllChannelHandler error when process received event .), dubbo version: 2.5.3, current host: 127.0.0.1com.alibaba.dubbo.remoting.ExecutionException: class com.alibaba.dubbo.remoting.transport.dispatcher.all.AllChannelHandler error when process caught event . at com.alibaba.dubbo.remoting.transport.dispatcher.all.AllChannelHandler.caught(AllChannelHandler.java:67) ~[dubbo-2.5.3.jar:2.5.3]

二、问题分析

项目的实际配置:

  1. <dubbo:provider timeout="50000" threadpool="fixed" threads="500" accepts="1000" />

timeout=”5000″:设置远程调用服务的超时时间为5000毫秒
threadpool=”fixed”:线程模型为固定大小的线程池,启动时建立线程,不关闭,一直持有
threads=”500″:线程数为500
accepts=”1000″:限制服务器端的接受的连接的最大值为1000

再看看dubbo官网上的线程模型的内容


  • Dispatcher

    • all 所有消息都派发到线程池,包括请求,响应,连接事件,断开事件,心跳等。

    • direct 所有消息都不派发到线程池,全部在IO线程上直接执行。

    • message 只有请求响应消息派发到线程池,其它连接断开事件,心跳等消息,直接在IO线程上执行。

    • execution 只请求消息派发到线程池,不含响应,响应和其它连接断开事件,心跳等消息,直接在IO线程上执行。

    • connection 在IO线程上,将连接断开事件放入队列,有序逐个执行,其它消息派发到线程池。

  • ThreadPool

    • fixed 固定大小线程池,启动时建立线程,不关闭,一直持有。(缺省)

    • cached 缓存线程池,空闲一分钟自动删除,需要时重建。

    • limited 可伸缩线程池,但池中的线程数只会增长不会收缩。(为避免收缩时突然来了大流量引起的性能问题)。

配置如:

<dubbo:protocolname="dubbo"dispatcher="all"threadpool="fixed"threads="100"/>

配置标签

<dubbo:provider/>

<dubbo:protocol/>

例:

<!– 当ProtocolConfig和ServiceConfig某属性没有配置时,采用此缺省值 –>
<dubbo:provider timeout=”10000″ threadpool=”fixed” threads=”100″ accepts=”1000″ />

<dubbo:protocol/>

https://github.com/HadesJK/dubbo-demo