In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you how php-fpm checks which script takes a long time to execute through request_slowlog_timeout, I believe most people don't know much about it, so share this article for your reference. I hope you can learn a lot after reading this article. Let's learn about it together.
After many webmasters transferred to nginx+php-fpm, they were plagued by the 500502 problem.
When nginx receives the above error code, you can determine that there is something wrong with the back-end php-fpm parsing php, such as execution error and execution timeout.
There is a parameter request_slowlog_timeout in the configuration file of php-fpm.conf that describes it like this.
; 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 = 0
When request_slowlog_timeout is set to a specific second, request_slowlog_timeout = 5, indicating that if a script takes more than 5 seconds to execute, the script will be recorded in the slow log file.
Request_slowlog_timeout = 0 means that slow log output is turned off.
By default, the slow log file location is located in the log folder under the installation directory of php, which can be specified by modifying the slowlog = log/$pool.log.slow parameter.
In the case of the php-fpm slow log, the slow log records the process number, the name of the script, which file, which line of code, and which function takes too long to execute.
[21-Nov-2013 14:30:38] [pool www] pid 11877
Script_filename = / usr/local/lnmp/nginx/html/www.quancha.cn/www/fyzb.php
[0xb70fb88c] file_get_contents () / usr/local/lnmp/nginx/html/www.quancha.cn/www/fyzb.php:2
[21-Nov-2013 14:15:23] ERROR: [pool www] 'slowlog' must be specified for use with' request_slowlog_timeout'
Request_slowlog_timeout and slowlog need to be set at the same time, and slowlog needs to be enabled when request_slowlog_timeout is enabled.
[21-Nov-2013 14:16:27] ERROR: Unable to create or open slowlog (/ usr/local/lnmp/php/log/www.log.slow): No such file or directory (2)
Slow log paths need to be created manually
Specific steps to enable php-fpm slow log:
Cd / usr/local/lnmp/php
Vi etc/php-fpm.conf
Remove the prefix semicolon';'of request_slowlog_timeout and slowlog, and set request_slowlog_timeout = 5
: wq
Save exit
Create a slow log directory
Mkdir log
Restart php-fpm
Kill-INT `cat var/run/php-fpm.pid
Sbin/php-fpm
The above is all the content of the article "how to check which script takes a long time through request_slowlog_timeout". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.