欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

php-fpm7.0慢查詢?cè)O(shè)置的示例分析

這篇文章主要介紹php-fpm7.0慢查詢?cè)O(shè)置的示例分析,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

成都創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、外貿(mào)營(yíng)銷網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的鲅魚圈網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

環(huán)境說(shuō)明

root@ubuntu:/home/tb# cat /etc/issue
Ubuntu 16.04.2 LTS \n \l

root@ubuntu:/home/tb# php -v
PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-0ubuntu0.16.04.4, Copyright (c) 1999-2017, by Zend Technologies

查看php-fpm配置路徑

root@ubuntu:/home/tb# ps -ef |grep fpm
root      1642     1  0 10:17 ?        00:00:01 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
www-data  3685  1642  0 17:14 ?        00:00:04 php-fpm: pool www
www-data  3686  1642  0 17:14 ?        00:00:03 php-fpm: pool www
www-data  3808  1642  0 17:43 ?        00:00:03 php-fpm: pool www
root      3930  2208  0 18:10 pts/0    00:00:00 grep --color=auto fpm
root@ubuntu:/home/tb#

php-fpm.conf的最后一行為

include=/etc/php/7.0/fpm/pool.d/*.conf

那我們?nèi)ツ抢锔?code>www.conf,查看關(guān)于慢查詢的介紹

314 ; The log file for slow requests
315 ; Default Value: not set
316 ; Note: slowlog is mandatory if request_slowlog_timeout is set
317 ;slowlog = log/$pool.log.slow
318
319 ; The timeout for serving a single request after which a PHP backtrace will be
320 ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
321 ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
322 ; Default Value: 0
323 ;request_slowlog_timeout = 0

添加兩行配置

slowlog=/var/log/php7.0/fpm/slow.log
request_slowlog_timeout=1s

重啟fpm,同時(shí)注意目錄權(quán)限等一般問(wèn)題

service php7.0-fpm reload

查看log回顯結(jié)果

[03-Jan-2018 18:48:53]  [pool www] pid 4934
script_filename = /usr/share/nginx/ testapp/index.php
[0x00007fb626213520] session_start() /usr/share/nginx/ testapp/app/models/user_model.php:11
[0x00007fb6262134a0] __construct() /usr/share/nginx/ci_2.2.0/core/Loader.php:303
[0x00007fb626213390] model() /usr/share/nginx/ testapp/app/core/my_Controller.php:39
[0x00007fb6262132e0] __construct() /usr/share/nginx/ testapp/app/controllers/home.php:8
[0x00007fb626213270] __construct() /usr/share/nginx/ci_2.2.0/core/CodeIgniter.php:308
[0x00007fb6262130e0] [INCLUDE_OR_EVAL]() /usr/share/nginx/ testapp/index.php:325

[03-Jan-2018 18:48:53]  [pool www] pid 4931
script_filename = /usr/share/nginx/ testapp/index.php
[0x00007fb626213520] session_start() /usr/share/nginx/ testapp/app/models/user_model.php:11
[0x00007fb6262134a0] __construct() /usr/share/nginx/ci_2.2.0/core/Loader.php:303
[0x00007fb626213390] model() /usr/share/nginx/ testapp/app/core/my_Controller.php:39
[0x00007fb6262132e0] __construct() /usr/share/nginx/ testapp/app/controllers/home.php:8
[0x00007fb626213270] __construct() /usr/share/nginx/ci_2.2.0/core/CodeIgniter.php:308
[0x00007fb6262130e0] [INCLUDE_OR_EVAL]() /usr/share/nginx/ testapp/index.php:325

關(guān)于log的說(shuō)明

[03-Jan-2018 18:48:53]  [pool www] pid 4931

這個(gè)沒(méi)啥解釋,時(shí)間進(jìn)程id

script_filename = /usr/share/nginx/ testapp/index.php

執(zhí)行腳本名稱,php web應(yīng)用都為單入口

[0x00007fb626213520] session_start() /usr/share/nginx/ testapp/app/models/user_model.php:11

這個(gè)第三行比較重要:是堆棧頂部信息(is the top of the stack trace),他說(shuō)明指出了超出了閾值的當(dāng)前執(zhí)行的方法的函數(shù)調(diào)用是哪個(gè),以及具體的文件及代碼行數(shù)
剩下的其他部分就是 調(diào)用的順序(從下往上,最終導(dǎo)致變慢超時(shí)的結(jié)果)

其他說(shuō)明

如果發(fā)現(xiàn)第三行是以類似curl_exec(),比如:這一般是網(wǎng)絡(luò)io占用了時(shí)間,如果是必須請(qǐng)求第三方,那么。。忍吧。

[0x00007fb6262136f0] curl_exec() /usr/share/nginx/

同樣,如果有MySQL_query之類的,也是由于sql 慢查詢導(dǎo)致的

以上是“php-fpm7.0慢查詢?cè)O(shè)置的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

當(dāng)前名稱:php-fpm7.0慢查詢?cè)O(shè)置的示例分析
網(wǎng)頁(yè)路徑:http://chinadenli.net/article44/ppdiee.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站企業(yè)建站品牌網(wǎng)站建設(shè)移動(dòng)網(wǎng)站建設(shè)手機(jī)網(wǎng)站建設(shè)靜態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司