16
votes

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?)

1

1 Answers

19
votes

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 and SESSIONS 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.