HikariCP too many connections

后端 未结 1 701
轮回少年
轮回少年 2021-02-07 20:05

i have a Java Servlet and i want to use connection pooling together with jdbc (Database: mysql).

So here is what i\'m doing:

(This class is public final class DB

相关标签:
1条回答
  • 2021-02-07 20:33

    Couple of things. First, What version of HikariCP, Java, and the MySQL driver?

    Second, 400 connections in one pool? Way too many! Start with 10 to 20, in each pool. You'll be surprised that you can handle a few thousand transactions per second.

    Third, this is the second question in the FAQ. Read the answer and the link. You need to set maxLifetime to something shorter (by 1 minute) than your MySQL native timeout.

    Lastly, turn on DEBUG logging, HikariCP is not noisy. Every 30 seconds, the housekeeping thread runs and logs pool statistics.

    0 讨论(0)
提交回复
热议问题