Teach you to use PHP-FPM's slow log analytics website

Source: Internet
Author: User
Tags execution fpm log

Recently from Google Ananlytics found that the Web site slowed a lot, so think of PHP fpm slow log function.

Fortunately, the PHP-FPM provides a slow execution log, which dumps the call procedure that executes the slower script into the log.

Shell Code

cd/etc/php5/fpm/pool.d/

VI www.conf

Modify Configuration

Java code

; The timeout for serving a i after which a PHP backtrace'll 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

With the slow execution log, we can easily see the problem from the slow execution log, such as:

Log Code

[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] popcom                                                         
Mittabletransactions ()/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/modu le.inc:857 [0X000000000292BF10] Module_invoke_a                                                                             
LL ()/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/commo n.inc:2560 [0x000000000292a378] Drupal_deliver_page ( )/opt/www/inkebook/includes/menu.inc:532 [0x000000000292a198] Menu_ Execute_active_handler ()/opt/www/inkebook/index.php:21

Further analysis of the procedure will be more directional.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/PHP/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.