Today morning, I posted something which drew a flock of people to my website. I had concurrent visitors of about 100 + according to Google analytics. They were downloading a 1 MB pdf file.
At such situations (when there is a crowd on my VPS), I like to see what the load is and what the consumption of RAM is.
When I entered the ‘top’ command, I was stunned to see that my load was extremely high, ranging from 75 to 80 (the normal load does not exceed 1). I waited a few moments to see whether it would subside. It did not.
When I entered the “free –m” command to check the status of the RAM, I was stunned to see that the entire 2GB RAM ( and even the Swap RAM) had been consumed.
I knew that it was only a question of time before the Hosting company noticed the abuse on my server and sent me a warning. So, I dashed off a mail pointing out the excessive load and asking if they had an idea what was going on.
I received an immediate reply:
You’re webservers php5-fpm process is consuming the CPU resources. Please troubleshoot to resolve this as soon as possible to avoid suspension of your server.
I did a quick google search to check if there were any ready-made solutions to solve the problem, but there weren’t.
So, I immediately rebooted the VPS.
Fortunately, that seems to have solved the problem. It has been more than an hour, and I still have 100+ concurrent visitors downloading the 1MB pdf file, but the load on the VPS is very much under control. My RAM consumption is also normal.
What caused the php5-fpm process to go amok and lead to high CPU & RAM usage is a big mystery. The good part is that a simple reboot appears to have solved the problem, at least for now.