Connection失效的校验-TestOnBorrow等参数

项目中用到数据库连接,对这些配置感兴趣后查了些资料,下面的文章说明了如何对

  1. testWhileIdle
  2. testOnBorrow
  3. testOnReturn

进行配置能够优化IO性能。

结论:

druid的推荐配置:

<property name="validationQuery" value="SELECT 'x'" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />

 

文章:

https://mysql-rtdocs.readthedocs.io/en/latest/%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0/connection%E5%A4%B1%E6%95%88-testOnBorrow/

posted @ 2021-11-22 14:44  andrew-chen  阅读(170)  评论(0编辑  收藏  举报