Apache is usual and convenient for most of website owners, but as far i'm not aware if you can find slowly executing scripts with mod_php, with php-fpm you can, sometimes it may even surprize you with discovering some things in scripts you wasnt aware. So how to find what makes your site slow?
Its very simple, just open your php-fpm.conf and set 2 directives for your pool :
request_slowlog_timeout = 90s ; log slow operations for WP
slowlog = /var/logs/slow.log ; log here
this will trace and log anything that takes more than 90 seconds.
the trace will look like this:
[06-Jul-2011 09:02:38] [pool POOLNAME] pid 23929
script_filename = index.php
ql_query() wp-db.php:1074
query() wp-db.php:1357
get_results() query.php:2623
get_posts() query.php:2904
query() class-wp.php:454
query_posts() class-wp.php:501
main() functions.php:1567
wp() wp-blog-header.php:14
(this one is not a good example, its happened occasionally, but i dont have anything else in slowlog to show)
so if some script is repeteadly or occasionally slow and you see it in logs - its better to check why it is so, fix that script, or even remove it, when setting request_slowlog_timeout to short values, you can profile and find slowly executing scripts and ( an good example ) wordpress plugins. So i've found that "Meet Your commenters" plugin makes WordPress dashboard load slower a lot, there are other tools for finding what makes your site slow, but php-fpm slowlog is simple and efficient one.
Hoping this tip will be useful. Enjoy.

Post new comment