Doctrine 2 Close Connection

后端 未结 3 2403
萌比男神i
萌比男神i 2021-02-20 00:27

I use doctrine 2 PDO with mysql.

When stress testing the server, mysql reports a lot of aborted connections (up-to 20%).

I am trying to locate the issue.

3条回答
  •  隐瞒了意图╮
    2021-02-20 00:47

    From what I've observed, Doctrine uses persistent connections.

    We've stumbled upon a problem, launching unit tests in symfony2, where the database was spammed with connections in "Sleep" status. The solution that worked for us:

    $entityManager->getConnection()->close();
    

提交回复
热议问题