最大连接池大小
我在阅读有关数据库连接池属性时遇到以下文本:
最大池大小
属性指定池维护的可用连接和借用(正在使用)连接的最大数量。如果借用的连接数达到最大数量,则在将连接返回到池中之前,将没有可用的连接。 此属性允许池中的连接数量随着需求的增加而增加。同时,该属性可确保池不会增长到耗尽系统资源
的程度,从而最终影响应用程序的性能和可用性。
我的问题是:当上面的文字谈论“耗尽系统资源
”时,这是否意味着数据库的性能下降?如果答案是肯定的,为什么数据库没有在不影响性能的情况下设置它可以承受的最大连接限制,而不是依赖应用程序来指定适当的最大连接限制?数据库中是否有任何内容表明它可以支持多少并发连接(例如 Oracle/SQL Server?)
I came across below text while reading about Database Connection pool properties:
The maximum pool size
property specifies the maximum number of available and borrowed (in use) connections that a pool maintains. If the maximum number of connections are borrowed, no connections will be available until a connection is returned to the pool.
This property allows the number of connections in the pool to increase as demand increases. At the same time, the property ensures that the pool doesn't grow to the point of exhausting a system's resources,
which ultimately affects an application's performance and availability.
My Question is: When above text talk about 'exhausting system resources
' does that mean degrading performance of Database? If answer is yes, why not databases have maximum connection limit that it can withstand without compromising with performance rather than relying on applications to specify proper maximum connection limit? Is there anything in database that says how much concurrent connection it can supports (say for Oracle/SQL Server?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,对“耗尽系统资源”的担忧适用于应用程序服务器和数据库服务器。允许的数据库连接越多,应用程序服务器上运行的并发会话就越多,应用程序服务器 VM 需要的 RAM 就越大,对应用程序服务器和数据库服务器上的 CPU 的要求就越高,等等。如果积压的工作队列变得太大,您可能会发现自己花费更多时间在 CPU 上交换进程以及调度任务,而不是做有用的工作。连接池的最大大小允许您通过快速出错而不是让用户超时等待永远不会到来的答复来更优雅地处理雪崩的流量或意外的性能瓶颈。
一般来说,数据库确实能够限制它们支持的连接数量。例如,Oracle 具有 PROCESSES 和 SESSIONS 参数,并支持多种连接架构(专用服务器和共享服务器),让您可以在性能与资源消耗之间进行权衡,以增加连接数量。数据库可以支持的并发连接。
In general, the concern about "exhausting system resources" applies to both the application server and the database server. The more database connections you allow, the more concurrent sessions are running on the application server(s), the more RAM the application server(s) VM requires, the more demand is placed on CPUs on application servers and database servers, etc. If the queue of backlogged work gets too big, you may find yourself spending more time swapping processes on and off the CPU and scheduling tasks than in doing useful work. A maximum size on the connection pool allows you to handle an avalanche of traffic or an unexpected performance bottleneck slightly more gracefully by quickly erroring out rather than letting users time out waiting for replies that will never come.
Databases do, in general, have the ability to limit the number of connections they support. Oracle has
PROCESSES
andSESSIONS
parameters, for example, and supports multiple connection architectures (dedicated server and shared server) to let you trade off performance against resource consumption to increase the number of concurrent connections the database can support.