一、問題
在測試環境遇到的異常信息,如下:
16-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.1
com.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]
p
二、問題分析
項目的實際配置:
<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:protocol
name
=
"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/>
