I'm getting something like it for days and I don't know what's going on too.
My client site is running smoothly, and randomly goes down, sometimes stating timed out by nginx or sometimes displaying the wordpress database connection error.
I don't know how to diagnose it, but this is what I've found on logs at the exact moment the site got down:
PHP-FPM:
WARNING: [pool www-two-php74] server reached max_children setting (50), consider raising it
WARNING: [pool www-two-php74] child 46209, script '/var/www/client.site/htdocs/index.php' (request: "GET /index.php") execution timed out (301.987724 sec), terminating
WARNING: [pool www-two-php74] child 46209 exited on signal 15 (SIGTERM) after 430.706390 seconds from start
For Syslog:
[Warning] Aborted connection 197272 to db: '*************' user: '***********' host: 'localhost' (Got timeout reading communication packets) instance-wordops sm-mta[1971]: rejecting connections on daemon MTA-v4: load average: 72
[Warning] Aborted connection 197271 to db: '************' user: '*************' host: 'localhost' (Got an error writing communication packets)
From Wordpress Debug.log
PHP Warning: mysqli_real_connect(): (HY000/1040): Too many connections in /var/www/client.site/htdocs/wp-includes/wp-db.php on line 1626
It is clear to me that it may be a mysql related problem, at least in my case, but I don't know what is causing it.