'Large number of Sleep connections to database in TYPO3
Our TYPO3 application is experiencing downtime issues, with the logs displaying the error:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: An exception occured in driver: Too many connections
If I connect to the MySQL database and run SHOW PROCESSLIST, all I see are lots of connections with the command “Sleep”. This seems like a red flag to me but this is not my area of expertise; is there a good reason for this and if not what might the fix be?
Solution 1:[1]
the PHP mysqli Driver allows for Persistent connections.
which basically means a connection is kept open and put to "sleep" till needed again.
this is a tradeoff: an already open connection does not need to be re-establisched so you can query faster. but at the cost that both systems spend some resources (Memory, CPU) on keeping the connection alive.
see the PHP documentation for more details: https://www.php.net/manual/de/mysqli.persistconns.php
and configuration options (php.ini) https://www.php.net/manual/de/mysqli.configuration.php
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wolffc |
