Spring Boot & Microservices (50 Qs)•Part 2: Persistence, Transactions & Security (11 - 24)
How does HikariCP connection pooling work and how do you size it?
mid LevelState ManagementSecurity & AuthDatabases & SQL
In Simple Words: HikariCP is Spring Boot's default ultra-fast, zero-overhead JDBC connection pool:
- Formula:
Pool Size = 2 * (CPU Cores) + Effective Spindle Count. - On a 4-core database server with fast SSDs: A pool of 10–20 connections outperforms a pool of 200 connections, because excessive connections waste CPU on context switching and lock contention.