HikariCP too many connections

后端 未结 1 1401
盖世英雄少女心
盖世英雄少女心 2021-02-07 20:04

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:35

    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)
提交回复
热议问题