Search code examples
postgresqlspring-boothikaricp

HikariCP with SpringBoot


I have configured the max. connection pool size of my SpringBoot application to 1 by using the following command:

spring.datasource.hikari.maximum-pool-size=1

Is there any way to verify and confirm this change. I want to check that this is working for my application.


Solution

  • You can see the pool values in log, if you enable debug log for HikariCP. HikariCP housekeeper thread logs pool information at fixed time interval.

    Just set com.zaxxer.hikari logging level to debug. In logback.xml you can do it like

    <logger name="com.zaxxer.hikari" level="debug"/>
    

    Or you can do it in application.properties

    logging.level.com.zaxxer.hikari=debug
    

    In your console of log file you will find something similar like this.

    DEBUG [HikariPool-1 housekeeper] com.zaxxer.hikari.pool.HikariPool: HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
    

    Total value should not exceed maximum-pool-size value.