How can i find out what PHP scripts take longest to load in Apache?
|
feedback
|
|
There are a few ways to do this. 1: Enable mod_status on your webserver. This allows you to get an overview of how the apache server is behaving in general by browsing to /server-status/. Remember to limit access to this location:
2: Modify your LogFormat directive to add processing time. You can then associate URIs with response times:
Will display remote ip, request date-time, request, bytes sent, seconds and microseconds. 3: For script memory size and script hit ratio, the administrative console that comes with Xcache is very good. Scripts with large class heirarchies can expand to many megs in memory. 4: Profiling your php scripts might help. If you want to focus on profiling a single script, Xdebug will certainly help. User Damien suggests a way. I would suggest logging your memory usage and also using microtime, but putting a threshold for logging onit, like so:
Adjusting the threshold keeps your logs a lot cleaner. | |||
|
feedback
|
|
Run them with Apache JMeter.
| |||
|
feedback
|
|
Run your server logs through a report tool. A decent one should be able to tell you how long the average user takes to download each page. It should also show you min and max download time for each page and lots of other statistics. | |||||||
feedback
|
|
Y Slow is one the way to find out performance of page load speed. | |||
feedback
|
|
Depending on your scrip(s) you can use the microtime function:
Put as much breaks as you need to find the faulty portion of code. | |||
|
feedback
|