Running out of DB connections!

前端 未结 5 1691
误落风尘
误落风尘 2021-02-03 11:52

I\'m running a Spring/Hibernate connecting to MySQL setup using c3p0 as my connection pool. For some bizarre reason it runs out of connections when the system is under load (of

5条回答
  •  被撕碎了的回忆
    2021-02-03 12:30

    It's pretty unlikely that @Transactional leaks connections - otherwise, your site would stop working after the first 100 requests.

    But there is another reason why this happens:

    Maybe you have set a timeout for "dead" connections and some queries take longer than that. That means that your pool removed a busy connection as "dead" from the pool and requests another from the DB - until the DB pulls the plug.

    To debug this, enable logging for your connection pool, so you can see when it requests new connections.

提交回复
热议问题