[英]Why is my DBCP connection pool running out of connections?
我已经在Sql Server 2005中使用连接池(DBCP)开发了Java应用程序。在我的配置文件中,我具有MaxActive="500"
但在某些情况下,它将超过500个连接。 为什么? 那时候数据库很慢。
<Resource
name="jdbc/tm4u"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://XXXX;databaseName=XX;User=abc;Password=son;selectMethod=cursor"
username="abc"
password="son"
autoReconnect="true"
maxActive="500"
removeAbandoned="true"
logAbandoned="true"
removeAbandonedTimeout="60"
maxIdle="10"
/>
在您的代码中,您是否关闭了已打开的连接? 这样,连接将返回到池中并重新使用。 在这种情况下,不应有性能下降。 但是,如果我们需要500个以上的活动连接,则其中一些必须等待。
另请参阅有关与池相关的SO的其他问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.