Antipattern9.1 Resource Pool Contention

I have a love/hate relationship with database connection pools. I view them as a necessary evil. Because it takes up to 250 milliseconds to establish a new database connection, it is worth reusing database connections when possible. Used well, connection pools, like all resource pools, can improve capacity by improving throughput. Left untended, however, resource pools can quickly become the biggest bottleneck in an application.

The bottleneck arises when there is contention for the resources. More threads require one of the resources than are available. In this case, most connection pools will simply block the requesting ...

Get Release It! now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.