You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "edwardlee03 (GitHub)" <gi...@apache.org> on 2019/01/16 17:02:08 UTC

[GitHub] [incubator-dubbo] edwardlee03 commented on issue #890: 希望在文档中可以给出详细一些的线程模型图

**消费者线程池数据模型**比想象的还要复杂,我们将线程池的`核心池数(corethreads)`从`0`调整为`40`,同时某提供者服务配置了`connections=50`,结果消费者线程数`DubboClientHandler-*-thread-*`直接达到了15000+个,报`OutOfMemoryError: unable to create new native thread`异常。 @zhaojigang 

简版的**Dubbo消费者线程池数据模型**:
```
消费者线程池模型:
1、共享连接(connections=0)场景
	简版数据结构:<host:port, CachedThreadPool(corePoolSize)>
	线程池数量:sum(host:port)
	线程池数量示例:假设提供者节点有6个,则消费者应用会创建6个CachedThreadPool实例
2、每服务每连接(connections>0)场景
	简版数据结构:ExchangeClient[connections]<service-host:port, CachedThreadPool(corePoolSize)>
	线程池数量:sum(host:port * connections)
	线程池数量示例:假设提供者节点有6个,且某个服务配置了`connections=50`,则消费者应用对于这个服务会创建6*50=300个CachedThreadPool实例
提供者线程池模型:
1、全局使用一个线程池实例
```

即使`核心池数(corethreads)`为0,当消费者应用依赖的服务提供者处理很慢时且请求并发量比较大时,也会出现消费者线程数很多问题。


[ Full content available at: https://github.com/apache/incubator-dubbo/issues/890 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org