用PHP-FPM 的 slow log 分析网站
最近从GOOGLE ananlytics 发现网站速度变慢了很多, 于是想到了PHP中的FPM慢日志功能。
好在 PHP-FPM 提供了慢执行日志,可以将执行比较慢的脚本的调用过程 dump 到日志中。
cd /etc/php5/fpm/pool.d/ vi www.conf
修改配置
; The timeout for serving a single request after which a PHP backtrace will be ; dumped to the 'slowlog' file. A value of '0s' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 request_slowlog_timeout = 1s ; The log file for slow requests ; Default Value: /usr/local/php/log/php-fpm.log.slow slowlog = /usr/local/php/log/php-fpm.log.slow
加上慢执行日志后,我们可以很容易从慢执行日志中看出问题所在,比如:
[13-May-2013 05:17:12] [pool www] pid 13557 script_filename = /opt/www/inkebook/index.php [0x000000000292e0f0] commit() /opt/www/inkebook/includes/database/mysql/database.inc:166 [0x000000000292de88] popCommittableTransactions() /opt/www/inkebook/includes/database/database.inc:1128 [0x000000000292dcf0] popTransaction() /opt/www/inkebook/includes/database/database.inc:1905 [0x00007fffe78cc460] __destruct() unknown:0 [0x000000000292c690] execute() /opt/www/inkebook/modules/statistics/statistics.module:73 [0x00007fffe78cc900] statistics_exit() unknown:0 [0x000000000292c208] call_user_func_array() /opt/www/inkebook/includes/module.inc:857 [0x000000000292bf10] module_invoke_all() /opt/www/inkebook/includes/common.inc:2688 [0x000000000292ade0] drupal_page_footer() /opt/www/inkebook/includes/common.inc:2676 [0x000000000292aa28] drupal_deliver_html_page() /opt/www/inkebook/includes/common.inc:2560 [0x000000000292a378] drupal_deliver_page() /opt/www/inkebook/includes/menu.inc:532 [0x000000000292a198] menu_execute_active_handler() /opt/www/inkebook/index.php:21
再进行进一步的程序分析,就更具方向性了。
欢迎访问下面网站, 下载电子书
http://www.inkebook.com/
相关推荐
zhuxue 2020-10-14
zhangbingb 2020-09-21
HeronLinuxampARM 2020-09-14
美丽的泡沫 2020-09-08
goodstudy 2020-08-19
luvhl 2020-08-17
littleFatty 2020-08-16
gamestart0 2020-08-15
URML 2020-08-15
sfkong 2020-08-02
82941732 2020-07-27
偏头痛杨 2020-07-18
timewind 2020-07-04
89407707 2020-06-27
xiaoxiaoCNDS 2020-06-26
lyjava 2020-06-26
运算符用于执行程序代码运算,会针对一个以上操作数项目来进行运算。以上实例中 7、5 和 12 是操作数。关系运算符用于计算结果是否为 true 或者 false。逻辑运算符用于测定变量或值之间的逻辑。
ChaITSimpleLove 2020-06-25
Strongding 2020-06-25