最近在生产环境发现mysql中的实际连接数远超tomcat中配置的连接池maxActive值。所以在本地做了下测试,确实不明觉厉,求教各位大侠,请看配置和现象。
tomcat连接池配置:
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
validationInterval="30000"
timeBetweenEvictionRunsMillis="30000"
maxActive="10"
minIdle="2"
maxIdle="5"
maxWait="10000"
initialSize="5"
removeAbandonedTimeout="60"
removeAbandoned="true"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
jmxEnabled="true"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
username="root"
password="root"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/test"/>
apache-tomcat-7.0.59,没有部署任何应用,启动后数据库连接数量达到27个,除去第一个客户端连接和第二个莫名连接还有25个,这就已经超过maxActive的10个了。
请教各位大侠这是什么原因? 哪里配置不对还是?