DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Optimum Database Connection Pool Size

Optimum Database Connection Pool Size

Want to figure out the best size for your connection pool? Here's how the math pans out, courtesy of some simple logic.

Anubhav R Mulchandani user avatar by
Anubhav R Mulchandani
·
Nov. 28, 16 · Tutorial
Like (5)
Save
Tweet
Share
39.70K Views

Join the DZone community and get the full member experience.

Join For Free

Long ago, I was working on a project where I dealt with a situation — what should be the optimum size of connection pool?

While I was aware that it had to be configured on the application server side (web sphere application server v.5.x, in this case), I did not know the optimum pool size.

So I started having a discussion with my peers to try to understand more about it. I received some input and one of them was good enough, backed by strong reasoning, for me to recommend it to the admin. So what was it?

It’s quite simple and straightforward — look for the maximum size of the web container thread pool.

What Is a Web Container Thread Pool?

This pool consists of a number of threads that an application server will create and use to process the requests concurrently. So, for example, if the thread pool size is 50 (not realistic figure), the maximum number of requests an application may process concurrently will be 50.

So, the connection pool size has to be lower than the maximum size of the web container thread pool. Does it look reasonable and logical?

Let’s Analyze It

Max size of web container thread pool: 50

Max size of connection pool size: 65

Now if there are 50 concurrent requests coming to our application server, only 50 connections will be consumed by those 50 requests. But we are still left with 15 more connections — a sheer waste of resource. So, keeping performance statistics in mind; the connection pool size should be lower than the maximum thread pool size.

It may be 30/35 in our case.

There is another factor/attribute that should be considered, connection timeout. This should be calculated by obtaining the average time a database operation takes in our application, plus a few seconds more (let’s say 5).

I believe this post will be quite enlightening for many, and I  hope to receive your input so that I may update my post accordingly.

I always believe that knowledge is free and should always be free.

Connection pool Database connection Web container application Application server

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top Five Tools for AI-based Test Automation
  • A Real-Time Supply Chain Control Tower Powered by Kafka
  • The Quest for REST
  • How Do the Docker Client and Docker Servers Work?

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: