I was wondering how to check how many connection pool is being used in this instant? Like I want to find the number of connection pool that is being used in current moment, how to do that? FYI, I am using spring boot and mysql as a db.
CodePudding user response:
Spring Boot uses Hikari Connection Pool by default. The simplest way to check to pool size is the enable in the logs.
logging:
level:
com.zaxxer.hikari.HikariConfig: DEBUG
com.zaxxer.hikari: TRACE
It will simply show the pool stats in logs at intervals
| HikariPool housekeeper | | DEBUG | com.zaxxer.hikari.pool.HikariPool | HikariPool - Pool stats (total=9, active=0, idle=9, waiting=0)
| HikariPool housekeeper | DEBUG | com.zaxxer.hikari.pool.HikariPool | HikariPool - Fill pool skipped, pool is at sufficient level.