brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
19.81k stars 2.92k forks source link

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

Open cuong02n opened 1 month ago

cuong02n commented 1 month ago

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.

singh972509 commented 1 month ago

Can I get assigned with this task?