spring-boothikaricp

Unable to set HikariCP max-pool-size


I'm using Spring Boot 2.0.3 release. I want to increase the maximum pool size of HikariCP which is 10 by default.

I tried changing it in applicaiton.properties with

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

but it is not working because in the logs it still show that max pool size is 10.

The reason I want to change is because I am somehow reaching that limit in staging and I have no idea what's causing it.


Solution

  • As per HikariCP Github README it's maximumPoolSize so try using:

    spring.datasource.hikari.maximumPoolSize = 200
    

    But this will work only if you allow Spring Boot to create the DataSource. If you create the DataSource yourself Spring Boot properties have no effect.

    Do note that 200 is a very high value that may negatively impact your database as each physical connection requires server resources. In most cases a lower value will yield better performance, see HikariCP wiki: About Pool Sizing.