PHP有慢执行日志slow log,可以定位脚本执行超过指定的时间的页面信息,方便排查性能问题~
类型下面的输出:
[11-Jul-2016 15:14:27] [pool www] pid 10292
script_filename = /home/xxxxxxxxxxxxxxxxx/web/public/index.php
[0x00007fe454c53410] imagecopyresampled() /home/ xxxxxxxxxxxxxxxxx/Service/ImageHandle.php:140
[0x00007fe454c53300] imagescaling() /home/ xxxxxxxxxxxxxxxxx/Service/ImageHandle.php:85
[0x00007fe454c53230] scaling() /home/ xxxxxxxxxxxxxxxxx/Service/ImageHandle.php:39
[0x00007fe454c52fd0] outimage() /home/ xxxxxxxxxxxxxxxxx/Service/Image.php:106
[0x00007fe454c52d10] upload() /home/ xxxxxxxxxxxxxxxxx/Service/Image.php:222
[0x00007fe454c52ba0] add() /home/ xxxxxxxxxxxxxxxxx/Common.php:48
[0x00007fff1e8d4bd0] uploadImageAction() unknown:0
[0x00007fe454c52a88] run() /home/ xxxxxxxxxxxxxxxxx/Bootstrap.php:39
[0x00007fe454c52950] run() /home/ xxxxxxxxxxxxxxxxx/index.php:19
从中可以发现,是上传图片导致cpu占用,进而导致负载上升的。
满日志的开启方法很简单,改下php.ini就可以了:
5.6如下:
request_slowlog_timeout = 5s
slowlog = /usr/local/php/log/php-fpm-slowlog.log
类型下面的输出:
[11-Jul-2016 15:14:27] [pool www] pid 10292
script_filename = /home/xxxxxxxxxxxxxxxxx/web/public/index.php
[0x00007fe454c53410] imagecopyresampled() /home/ xxxxxxxxxxxxxxxxx/Service/ImageHandle.php:140
[0x00007fe454c53300] imagescaling() /home/ xxxxxxxxxxxxxxxxx/Service/ImageHandle.php:85
[0x00007fe454c53230] scaling() /home/ xxxxxxxxxxxxxxxxx/Service/ImageHandle.php:39
[0x00007fe454c52fd0] outimage() /home/ xxxxxxxxxxxxxxxxx/Service/Image.php:106
[0x00007fe454c52d10] upload() /home/ xxxxxxxxxxxxxxxxx/Service/Image.php:222
[0x00007fe454c52ba0] add() /home/ xxxxxxxxxxxxxxxxx/Common.php:48
[0x00007fff1e8d4bd0] uploadImageAction() unknown:0
[0x00007fe454c52a88] run() /home/ xxxxxxxxxxxxxxxxx/Bootstrap.php:39
[0x00007fe454c52950] run() /home/ xxxxxxxxxxxxxxxxx/index.php:19
从中可以发现,是上传图片导致cpu占用,进而导致负载上升的。
满日志的开启方法很简单,改下php.ini就可以了:
5.6如下:
request_slowlog_timeout = 5s
slowlog = /usr/local/php/log/php-fpm-slowlog.log
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14184018/viewspace-2121841/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14184018/viewspace-2121841/