The default size of the services' Thread Pool(Fixed) is 100 in user manual, but the source code of FixedThreadPool is 200. There are inconsistent.
1. desc of user manual
dubbo-protocol.md,dubbo-provider.md
| 属性 | 对应URL参数 | 类型 | 是否必填 | 缺省值 | 作用 | 描述 | 兼容性 |
| threads | threads | int | 可选 | 100 | 性能调优 | 服务线程池大小(固定大小) | 2.0.5以上版本 |
| Attribute | Corresponding URL parameter | Type | Required | Default Value | Function | Description | Compatibility |
| threads | threads | int | False | 100 | Performance optimize | The size of the services' Thread Pool(Fixed) | Above 2.0.5 |
2. source code of FixedThreadPool
org.apache.dubbo.common.Constants
public static final String DEFAULT_THREAD_NAME = "Dubbo";
public static final int DEFAULT_CORE_THREADS = 0;
public static final int DEFAULT_THREADS = 200;
public class FixedThreadPool implements ThreadPool {
@Override
public Executor getExecutor(URL url) {
String name = url.getParameter(Constants.THREAD_NAME_KEY, Constants.DEFAULT_THREAD_NAME);
int threads = url.getParameter(Constants.THREADS_KEY, Constants.DEFAULT_THREADS);
int queues = url.getParameter(Constants.QUEUES_KEY, Constants.DEFAULT_QUEUES);
return new ThreadPoolExecutor(threads, threads, 0, TimeUnit.MILLISECONDS,
queues == 0 ? new SynchronousQueue<Runnable>() :
(queues < 0 ? new LinkedBlockingQueue<Runnable>()
: new LinkedBlockingQueue<Runnable>(queues)),
new NamedInternalThreadFactory(name, true), new AbortPolicyWithReport(name, url));
}
}
The default size of the services' Thread Pool(Fixed) is
100
in user manual, but the source code ofFixedThreadPool
is200
. There are inconsistent.1. desc of user manual
dubbo-protocol.md
,dubbo-provider.md
2. source code of FixedThreadPool
org.apache.dubbo.common.Constants
org.apache.dubbo.common.threadpool.support.fixed.FixedThreadPool