Search code examples
magentonginxhttp-status-code-503

Running Nginx I receive an error with site downtime typically once a day ("SQLSTATE[08004] [1040] Too many connections")


It's a magento build EE 1.14. The site puts itself into maintenance mode which means typically that it could be a module conflict or something trying to update or process. After a few minutes it resolves itself. The only errors in my "reports" is about too many connections.

lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()

Should I increase my my worker_processes or worker_connections? max_connections?

Currently my nginx.conf is like so:

worker_processes 8;
pid /run/nginx.pid;

events {
        worker_connections 1024;

new relic keeps saying 503 SERVICE UNAVAILABLE when it happens... everyday at the same time for like 5 minutes.

Any help or ideas, greatly appreciated. Thank you.


Solution

  • "Too many connections" error is usually caused by slow/unoptimized sql queries in php script. Check if there's any cron job scheduled to run at that time by looking at the cron_schedule table. You can also enable Mysql slow query log to find out if there's any slow queries and which custom module they belong to.