HikariCP icon indicating copy to clipboard operation
HikariCP copied to clipboard

Make queue for Hikari instead Of throw SQL Exception when reached max active Connection

Open cuong02n opened this issue 7 months ago • 1 comments

I am using Spring boot with HikariDataSource, this is my config

spring.datasource.hikari.maximum-pool-size=50
spring.datasource.hikari.minimum-idle=50
spring.datasource.hikari.idle-timeout=0
spring.datasource.hikari.max-lifetime=0
spring.datasource.hikari.connection-timeout=2000
spring.datasource.hikari.leak-detection-threshold=0
spring.datasource.hikari.keepalive-time=0

But my application need perfomance. When it about 400 concurrent request and make query to database, request create new connection. And there are errors:

Connection is not available, request timed out after 30437ms (total=50, active=50, idle=0, waiting=37)
Connection is not available, request timed out after 30437ms (total=50, active=50, idle=0, waiting=36)
Connection is not available, request timed out after 30437ms (total=50, active=50, idle=0, waiting=35)

The exception:

CannotCreateTransactionException: Could not open JPA EntityManager for transaction   I want to make the whole application query in 50 connections, and those connections not shutdown, no create more, and if there is a request, it should wait before another request.

cuong02n avatar Jul 07 '24 11:07 cuong02n