We have a production nginx web server with php FPM. We ran a php script which updates a particular field in mysql database and mails some content using php mail
function. This php script was executed from the command line. There were around 900 records, i.e, 900 times db was updated and php mail
function was called. It took around 15 minutes to finish this script.
Problem: The problem was the nginx
web server went unresponsive during these 15 minutes. I was under the impression that executing the php script in command line will not affect the http server, but for some reason server just hanged. Normally, our server throws a 502 bad gateway. But this time, the site showed the loading symbol and was just unresponsive. When we stopped the script, the site was up again.
- What is the relation between the nginx http server and the script that was run on the command line which caused the server to go down ?
- Is there any other system configurations like RAM etc a reason behind this downtime problem ?
Any pointers to this problem is greatly appreciated.
UPDATE: The script was using mysql persistent connections which lead to flooding of connections of mysql server reaching the max limit. Thanks for people in pointing me in the right direction.