简体   繁体   English

apache-commons-dbcp 连接池 maxActive 参数

[英]apache-commons-dbcp connection pooling maxActive parameter

We are using Apache DBCP 1.4 for database connection pooling, with Java back-end, in our application.我们在我们的应用程序中使用 Apache DBCP 1.4 进行数据库连接池,带有 Java 后端。 We set the value for maxActive = 20(by default), there was a scenario where requests needed more than 20 connection for execution.我们将 maxActive 的值设置为 20(默认情况下),有一个场景是请求需要超过 20 个连接才能执行。 At that time application gets hang/unresponsive.那时应用程序挂起/无响应。

I have increased the value to maxActive = 50. Then execution completes successfully.我已将值增加到 maxActive = 50。然后执行成功完成。 In documentation of Apache DBCP, I have seen we can put the value of maxActive = -1, and this will not set upper limit on connection creation.在Apache DBCP的文档中,我看到我们可以设置maxActive = -1的值,这不会设置连接创建的上限。 Can I set maxActive = -1, if not can you please help me understand why it is not desirable and also what can be descent value we can set for maxActive so that my application do not gets hang/unresponsive.我可以设置 maxActive = -1,如果不是,请帮助我理解为什么它是不可取的,以及我们可以为 maxActive 设置的下降值是什么,这样我的应用程序就不会挂起/无响应。

Motivations to limit the number of connections in a db-Pool限制 db-Pool 中连接数的动机

  • The maximum number of connections clients might create to a DBMS normally is limited.客户端通常可以创建到 DBMS 的最大连接数是有限的。 By limiting the number of connections a node can use at the same time, you can calculate the hard limit and avoid meeting it.通过限制一个节点可以同时使用的连接数,您可以计算硬限制并避免满足它。
  • if your application has a connection leak, this will hopefully lead on a single node to an error, not on the complete cluster, so you can handle it earlier, not when the DBMS stops working because all possible connections a dangling.如果您的应用程序有连接泄漏,这有望在单个节点上导致错误,而不是在整个集群上,因此您可以更早地处理它,而不是在 DBMS 停止工作时,因为所有可能的连接都悬而未决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Apache-Commons-DBCP问题 - Apache-Commons-DBCP Issue DBCP(Apache Commons Database Connection Pooling)仍然相关吗? - Is DBCP (Apache Commons Database Connection Pooling) still relevant? Apache Commons DBCP 连接对象问题,线程:org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper 中的 ClassCastException - Apache Commons DBCP connection object problem, Thread: ClassCastException in org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper DBCP连接池 - DBCP Connection pooling 如何为连接池配置Hibernate,Spring和Apache dbcp? - How to configure Hibernate, Spring and Apache dbcp for connection pooling? 与DBCP连接池和线程的混淆 - Confusion with DBCP connection pooling and Threads mysql连接超时后无法从Apache DBCP连接池获得连接 - Unable to get connection from apache DBCP connection pooling after mysql connection timeout JavaSE和JPA的DBCP(数据库连接池) - DBCP (DataBase Connection Pooling) from JavaSE with JPA apache commons dbcp connection pool error:使用Spring Transactions在Spring + Hibernate应用程序中等待空闲对象超时 - apache commons dbcp connection pool error: Timeout waiting for idle object in a Spring + Hibernate app using Spring Transactions jdbc spring 安全,apache 公用 dbcp - jdbc spring security, apache commons dbcp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM