Chris2018998 / beecp

A small JDBC Connection pool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

默认配置下多核处理器中borrowConcurrentSize大于maxActive

looly opened this issue · comments

在BeeDataSourceConfig中默认的:

borrowConcurrentSize = Runtime.getRuntime().availableProcessors();
maxActive = 10;

此项默认配置有问题,当CPU核心数超过10时,默认配置会检查无效。

我用的锐龙CPU,6核12线程,得到的availableProcessors为12;

感谢您的Issue,代码已调整为:取最大连接数/2与CPU核心数的最小数

this.borrowConcurrentSize=Math.min(maxActive/2,Runtime.getRuntime().availableProcessors());

这样的默认结果就不会大于最大连接数了. 另外可通过调用方法**setBorrowConcurrentSize()** 避开这个问题.

下一个版本将包含进去这个Issue fix

OK~~感谢回复。