Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restrict initial pool size in hikaricp?

I used to have a tomcat connection pool configuration restricting the initial pool size: spring.datasource.tomcat.initial-size=2

Now switching to hikaricp: what is the equivalent to restrict the initially started connections?

Sidenote: spring.datasource.hikari.minimumIdle does not prevent initializing 10 connections at startup.

like image 342
membersound Avatar asked Dec 24 '22 05:12

membersound


2 Answers

You can use these properties provided in spring boot:

spring.datasource.hikari.minimumIdle=5
spring.datasource.hikari.maximumPoolSize=8

and then:

spring.datasource.hikari.idleTimeout=120000

to limit the life of idle connections, but hikari doesn't give you such property for initial number of connections.

like image 79
NiVeR Avatar answered Jan 11 '23 06:01

NiVeR


With spring boot, set these properties in your application.properties.

spring.jpa.hibernate.hikari.minimumIdle=5
spring.datasource.hikari.maximum-pool-size=10
like image 21
priteshbaviskar Avatar answered Jan 11 '23 05:01

priteshbaviskar