Mobile app version of vmapp.org
Login or Join
Bryan171

: Monitoring load/resource drain of individual scripts on apache We have a website and for some reason lately its been grinding our server to a halt. It has had a spike of traffic, but even

@Bryan171

Posted in: #Apache #Mysql #Php #Server #Wordpress

We have a website and for some reason lately its been grinding our server to a halt. It has had a spike of traffic, but even still that spike is only possibly 1k or 2k.

We installed eAccelerator PHP bytecode cache on the server, but this doesn't seem to be doing much. I've also installed a wordpress plugin that is supposed to work with eAccelerator, but the server's still going down.

We've moved all the images to amazon s3 and still the website goes down, so the load must be created by a certain script on the server (or a fault on the server, although our hosting company have assured us that there is no technical fault their end).

Is there any tool or piece of software, or technique to find out what scripts cause the most load on the server, to see if we can pin point it to a script somewhere that is maybe causing an infinite loop.

Or any more general tools that can monitor the usage on our server completely to see where problems may be caused? We're not entirely sure its a script error - it could be a mysql error or anything.

Thanks for your help.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

2 Comments

Sorted by latest first Latest Oldest Best

 

@Jamie184

If it is a script-related error, the tool you are looking for is called a profiler. It will tell you how long each function call takes and how often it is being called.
stackoverflow.com/questions/21133/simplest-way-to-profile-a-php-script has several good profilers you can try.

The YSlow plugin can also give you some tips for optimizing your site.

10% popularity Vote Up Vote Down


 

@Tiffany637

My recommendation would be to start to familiarize yourself with error logs. I avoided them for years, but here is the startling truth: all the answers lie in the error logs. There just isn't any other way around it. Adding extra services like eAccelerator can be helpful, if you have read the logs and can identify that it solves a specific problem with your configuration; but if you are not familiar with the logs and don't know the source of the problem, they can distract or possibly worsen an issue.

The learning curve for error logs can be intimidating, so I would recommend that you start by creating a list of all of the error log locations on your server. Finding the logs is the first obstacle. Knowing how to read them is the second obstacle. Over time you will get faster at tracking down what caused the problem, but just knowing where to go can be a big help.

The other thing to keep in mind is the different type of logs. Error Logs and Access Logs are two of the big ones, but in the future you may want to look at logs other than just the error logs. You will have logs for each service running on your server: Apache Error log, Apache Access log, MySQL error log, MySQL access log, etc.

Start here since you mentioned apache: www.cyberciti.biz/faq/apache-logs/ Make a note of the apache log location for your server type. Then google the same for mysql. If you are on a shared host, you may be able to log into your CPanel and view logs for your website, but I would recommend using SSH and viewing the logs through the terminal.

Once you have found the apache error log, make a note of the date that the server went down and simply work your way back through the log to that date. Odds are you'll find something and have no idea why it is causing the server to crash, but that should arm you for another question back here.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme