What would cause MySQL to suddenly run at almost 800% CPU or quit running? Our Drupal 7.50 site has started crashing recently.
First time the site went down, the website displayed this error to the public:
PDOException: SQLSTATE  Too many connections in _registry_check_code() (line 3462 of /var/www/html/example/docroot/includes/bootstrap.inc).
max_connections and I had to reboot the server because temporarily increasing from 151 to 500 still didn't help. I checked
top and saw that MySQL was running at almost 800% CPU.
Restarting the VPS was the only thing that helped this.
The second time, the Drupal site only displayed a white page to the public, but the command
drush ws produced the following error:
Drush command shows: PHP Fatal error: Call to undefined function module_exists() in /usr/local/src/drush/commands/core/drupal/environment_7.inc on line 187
I confirmed with top that MySQL was not running. Records show that it was running at this same high CPU for several hours just before it stopped.
In this case, all I had to do was restart MySQL.
Is this a Drupal performance issue, traffic related, spam or something else? Any help is appreciated to troubleshoot this issue.