How to manage database connection pool in spring jpa?

前端 未结 2 783
星月不相逢
星月不相逢 2021-02-05 07:40

I am using spring-boot in my web application and use spring-jpa to read/write from/to my database. It works very well but I want to understand how to manage the database connect

2条回答
  •  攒了一身酷
    2021-02-05 08:14

    When using DB connection pooling, a call to sqlconnection.close() will not necessarily close the heavyweight connection to the database, instead most often will just release the connection as re-usable in the pool. That's why it is advisable to invoke the close() on connection as soon as possible when leveraging a client side connection pool.

    In your configuration, the pool will contain a maximum number of 500 connections ( it would be also good to configure maxIdle, minIdle, and minEvictableIdleTimeMillis to tune the number of ready-to-use connections and how often to release them when not used).

    Some more doc here

提交回复
热议问题