Find the request of a particular domain under apache

Hey Experts!

After couple of months, I got an another problem with the Apache things. I have a cloud server hosted couple of websites (5 websites for now). Two of the websites are Magento web shops and some others are sub domains (number of sub domains is little higher like around 25) and some of the sub domains are also pointed with some domains.

Now the problem is that sometimes the server’s CPU usage goes quite higher (99%) in some cases and all the websites, FTPs, Plesk and even SSH goes hang and we have to ask the Hosting to kill everything and restart everything. When I monitor the CPU usage using ‘top’ command, it says that most of the CPU is being used by ‘apache’. I asked hosting guys to help me to find out which website is giving more requests to Apache but they haven’t responded me yet. My question:

  • Is it possible to see which exact website among 5/6 websites is giving more requests which consumed more CPU to respond?

Or anything else that you guys can suggest me what exactly could be the problem in this case to hang/freeze the server.

Thanking you in advance.

With warm regards,
Raju Gautam

Raju,

Correctly, you’ve asked your host for help in identifying the problem. However, if you have access to the server(s?) logs, you should check those, too, as the information contained therein can be invaluable.

Further, CMS packages are almost renown for their sloppy code. This will mean that they do not close db accesses properly, they do not close their PHP scripts, etc. Over time, these will build into a massive backlog (number of child processes - in laymans’ terms, that’s number of Apache servers running at any one time) which will easily overpower the limited RAM commonly available and effectively stop your server.

Of course, the same can be said if someone is running a DOS attack on your website(s), too, but that SHOULD be handled by the host.

Regards,

DK