【问题标题】:Tomcat JDBC connection pool, connections are created more than maxActiveTomcat JDBC连接池,创建的连接数超过maxActive
【发布时间】:2018-09-30 12:16:50
【问题描述】:

我正在使用 tomcat 8.0.39、mysql 5.7 服务器和 mysql 连接器 5.1.34 这是我的 context.xml 配置

<Resource
          name="jdbc/provider"
          auth="Container"
          driverClassName="com.mysql.jdbc.ReplicationDriver"
          factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
           url="******"
           username="******"
           password="******"
           maxActive="40"
           maxIdle="10"
           minIdle="10"
           maxWait="4500"
           maxAge="21600000"
           minEvictableIdleTimeMillis="60000"
           timeBetweenEvictionRunsMillis="5000"
           validationInterval="0"
           removeAbandoned="true"
           removeAbandonedTimeout="60"
           validationQuery="SELECT 1"
           testOnBorrow="true"
           type="javax.sql.DataSource"
           logAbandoned="true"/>

连接数增加到 130,但预计最多 40

【问题讨论】:

    标签: jdbc tomcat8 mysql-5.7 connection-pool


    【解决方案1】:

    Tomcat 已将其默认连接池库更新为 Tomcat 8 中的 Apache Commons DBCP 2.x。Tomcat 7 及更早版本使用 DBCP 1.x。 DDBCP 2 使用 maxTotal 而不是 maxActive 来限制连接数。还有其他显着的变化。请阅读Tomcat 8 migration guide 数据库连接池部分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-10
      • 2014-11-13
      • 2013-05-01
      • 2012-03-02
      • 2018-10-30
      • 1970-01-01
      • 1970-01-01
      • 2012-07-12
      相关资源
      最近更新 更多