這篇文章主要介紹Linux平臺(tái)PHP5.4如何設(shè)置FPM線程數(shù)量,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供蒲縣網(wǎng)站建設(shè)、蒲縣做網(wǎng)站、蒲縣網(wǎng)站設(shè)計(jì)、蒲縣網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、蒲縣企業(yè)網(wǎng)站模板建站服務(wù),10余年蒲縣做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。具體如下:
PHP5.4安裝完畢后,F(xiàn)PM的默認(rèn)配置文件位于/usr/local/php/etc/php-fpm.conf.default
>cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf >vim /usr/local/php/etc/php-fpm.conf
輸入”/www”,搜索www所在的POOL
pm = dynamic ; The number of child processes to be created when pm is set to 'static' and the ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. ; This value sets the limit on the number of simultaneous requests that will be ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP ; CGI. The below defaults are based on a server without much resources. Don't ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. pm.max_children = 5 ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 pm.start_servers = 2 ; The desired minimum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.min_spare_servers = 1 ; The desired maximum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.max_spare_servers = 3 ; The number of seconds after which an idle process will be killed. ; Note: Used only when pm is set to 'ondemand' ; Default Value: 10s ;pm.process_idle_timeout = 10s; ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. ; Default Value: 0 ;pm.max_requests = 500
解釋一下:
pm = dynamic 如何控制子進(jìn)程,選項(xiàng)有static和dynamic,默認(rèn)采用dynamic;如果選擇static,則由pm.max_children指定固定的子進(jìn)程數(shù)。
如果選擇dynamic,則由以下參數(shù)決定:
pm.max_children | 子進(jìn)程較大數(shù) |
pm.start_servers | 啟動(dòng)時(shí)的進(jìn)程數(shù) |
pm.min_spare_servers | 保證空閑進(jìn)程數(shù)最小值,如果空閑進(jìn)程小于此值,則創(chuàng)建新的子進(jìn)程 |
pm.max_spare_servers | 保證空閑進(jìn)程數(shù)較大值,如果空閑進(jìn)程大于此值,則進(jìn)行清理。對(duì)于專用服務(wù)器,pm可以設(shè)置為static。 |
pm.max_requests | 設(shè)置每個(gè)子進(jìn)程重生之前服務(wù)的請(qǐng)求數(shù). 對(duì)于可能存在內(nèi)存泄漏的第三方模塊來說是非常有用的. 如果設(shè)置為 '0′ 則一直接受請(qǐng)求. 設(shè)置為500就可以了(默認(rèn)0)。 |
將值修改為如下:
pm.max_children = 32 pm.start_servers = 16 pm.min_spare_servers = 8 pm.max_spare_servers = 32 pm.max_requests = 500
:wq 保存退出VIM
>/usr/local/php/sbin/php-fpm -t NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful
測(cè)試配置文件是否正常,沒問題,殺掉當(dāng)前的FPM進(jìn)程
>/usr/local/php/sbin/php-fpm
啟動(dòng)
以上是“Linux平臺(tái)PHP5.4如何設(shè)置FPM線程數(shù)量”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
網(wǎng)頁(yè)標(biāo)題:Linux平臺(tái)PHP5.4如何設(shè)置FPM線程數(shù)量-創(chuàng)新互聯(lián)
當(dāng)前網(wǎng)址:http://jinyejixie.com/article12/dedddc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、小程序開發(fā)、搜索引擎優(yōu)化、外貿(mào)建站、域名注冊(cè)、響應(yīng)式網(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í)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容