UPDATE 1:
After doing an strace on the server, I have discovered that the mmap's process is taking 90% of this processing time. I've discoverd that 1 of the pages is taking a minute to load.
So I found this link: PHP script keeps doing mmap/munmap
It possibly shows the same problem. However, I don't understand what the anwer means by correctly disabling the php error handlers?
ORIGINAL QUESTION:
How do I check for bottle necks on my web server when loading a specific web page which is being served by my server?
For some reason, a couple of pages on my site have become very slow, and I am not sure where the slowness is happening.
Screenshot from Chrome Dev Tools:
Click here to enlarge:
So basically, I need to find out what is taking this section to long to load? Client Side web tools can't seem to break this down?
If you want a generic way to find bottlenecks, try using a HTTP monitoring tool. This allows you to see what types of requests are taking longer, or if they are returning error messages. You can then use a platform specific profiling tool to zero in on specific areas of your application based on the data from the tool.
A bottleneck can occur in the user network or storage fabric or within servers when there is excessive contention for internal server resources, such as central processing unit (CPU) power, memory or input/output. As a result, data flow slows down to the speed of the slowest point in the data path.
Large Image Sizes. An example of a performance bottleneck would be a website that contains a huge number of images, trying to render all of the images in the web browser at the same time. This would put a huge strain on the webserver to deliver all of the data, leading to a longer load time.
Xdebug: Profiling PHP Scripts - pay attention to KCacheGrind tool or, alternatively, you can use Advanced PHP debugger apd_set_pprof_trace() function and pprofp to process generated data file.
Derick Rethans (author of Xdebug) released quite a nice article today called What is PHP doing?
It covers the strace that you've already done, but also shows you how you can use a custom .gdbinit
to get the actual php function name that is causing the problem.
Of course you have to run your script from the command line with gdb, so I hope that your problem is reproducible in this way.
mmap
is for creating a memory mapped view of a file.
If it really is the error handler causing it, I'd guess that your script is generating a lot of errors (which you are trying to log), maybe a NOTICE for an undefined index in a loop or something).
Check the log file (is anything being logged at all?), check permissions on the log file if nothing is logged, also double check what your error reporting level is set to.
var_dump(ini_get('error_reporting') & E_NOTICE);
- Non-zero if you are reporting notices.
error_reporting(E_ALL & ~E_NOTICE);
- Turn off reporting notices.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With