Fine-Tuning Tomcat 8 JDBC Connection Pool

π§ 1. Right-Size maxActive
Description: Maximum number of active connections in the pool.
π Issue: Too low = connection starvation. Too high = DB overload.
β Recommendation:
maxActive="100"
π Tomcat 8 Docs - maxActive
β± 2. Set a Sensible maxWait
Description: How long (in ms) to wait for a connection before throwing an exception.
π Issue: Low value = frequent timeouts under load.
β Recommendation:
maxWait="10000"
β
3. Avoid Stale Connections with validationQuery, testOnBorrow, and validationInterval
Description: Checks that a DB connection is valid before returning it to the app.
π Issue: Stale connections lead to failed transactions.
β Recommendation:
testOnBorrow="true"
validationQuery="SELECT 1"
validationInterval="30000"
π Tomcat 8 Docs - validationQuery & testOnBorrow
π€ 4. Manage Idle Connections with minIdle, maxIdle, timeBetweenEvictionRunsMillis, minEvictableIdleTimeMillis
Description: Controls idle connection cleanup to avoid leaks and unnecessary DB usage.
β Recommendation:
minIdle="10"
maxIdle="30"
timeBetweenEvictionRunsMillis="30000"
minEvictableIdleTimeMillis="60000"
π Tomcat 8 Docs - Idle Connection Settings
About the author
- I'm Ayyanar Jeyakrishnan ; aka AJ. With over 21 years in IT, I'm a passionate Multi-Cloud Architect specialising in crafting scalable and efficient cloud solutions. I've successfully designed and implemented multi-cloud architectures for diverse organisations, harnessing AWS, Azure, and GCP. My track record includes delivering Machine Learning and Data Platform projects with a focus on high availability, security, and scalability. I'm a proponent of DevOps and MLOps methodologies, accelerating development and deployment. I actively engage with the tech community, sharing knowledge in sessions, conferences, and mentoring programs. Constantly learning and pursuing certifications, I provide cutting-edge solutions to drive success in the evolving cloud and AI/ML landscape.
Comments
Join the discussionNo comments yet. Be the first to comment.






