最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Linux平臺(tái)PHP5.4設(shè)置FPM線程數(shù)量的方法

 更新時(shí)間:2016年11月09日 15:24:39   作者:單曲.碼農(nóng)的生活  
這篇文章主要介紹了Linux平臺(tái)PHP5.4設(shè)置FPM線程數(shù)量的方法,較為詳細(xì)的分析了Linux平臺(tái)php5.4設(shè)置FPM的相關(guān)參數(shù)、功能及使用技巧,需要的朋友可以參考下

本文實(shí)例講述了Linux平臺(tái)PHP5.4設(shè)置FPM線程數(shù)量的方法。分享給大家供大家參考,具體如下:

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

測試配置文件是否正常,沒問題,殺掉當(dāng)前的FPM進(jìn)程

>/usr/local/php/sbin/php-fpm

啟動(dòng)

更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《php程序設(shè)計(jì)安全教程》、《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》、《PHP數(shù)學(xué)運(yùn)算技巧總結(jié)》、《PHP數(shù)組(Array)操作技巧大全》、《php字符串(string)用法總結(jié)》、《PHP數(shù)據(jù)結(jié)構(gòu)與算法教程》、《php程序設(shè)計(jì)算法總結(jié)》及《php常見數(shù)據(jù)庫操作技巧匯總

希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • PHP操作XML作為數(shù)據(jù)庫的類

    PHP操作XML作為數(shù)據(jù)庫的類

    寫入xml文件時(shí)速度粉快(我測試過30000條記錄的情況),插入時(shí)只插入一條記錄,修改速度也相當(dāng)?shù)目?,挺適合中型網(wǎng)站生成XML時(shí)使用,所以推薦一下。
    2010-12-12
  • PHP中應(yīng)該避免使用同名變量(拆分臨時(shí)變量)

    PHP中應(yīng)該避免使用同名變量(拆分臨時(shí)變量)

    這篇文章主要介紹了PHP中應(yīng)該避免使用同名變量(拆分臨時(shí)變量),當(dāng)一個(gè)臨時(shí)變量被賦值多次時(shí),那么將其拆分成多個(gè),除非它是一個(gè)循環(huán)計(jì)數(shù)器,需要的朋友可以參考下
    2015-04-04
  • 利用PHP實(shí)現(xiàn)智能文件類型檢測的實(shí)現(xiàn)代碼

    利用PHP實(shí)現(xiàn)智能文件類型檢測的實(shí)現(xiàn)代碼

    通常我們想嚴(yán)格限制文件類型的時(shí)候,可以簡單地用$_FILES['myFile']['type']  取得文件的 MIME類型然后來檢測它是否是合法的類型。
    2011-08-08
  • php繪圖中顯示不出圖片的原因及解決

    php繪圖中顯示不出圖片的原因及解決

    php繪圖首先要確認(rèn)gd庫是否啟用,到php.ini文件中,找到extension=php_gd2.dll將前面的;去掉,重新啟動(dòng)服務(wù)器
    2014-03-03
  • 檢查用戶名是否已在mysql中存在的php寫法

    檢查用戶名是否已在mysql中存在的php寫法

    檢查用戶名是否已在mysql中存在的方法有很多,下面為大家介紹下使用php是如何做到的
    2014-01-01
  • php ci框架中加載css和js文件失敗的解決方法

    php ci框架中加載css和js文件失敗的解決方法

    在將html頁面整合到ci框架里面的時(shí)候,加載css和js失敗,下面對(duì)這個(gè)問題進(jìn)行分析及解決
    2014-03-03
  • PHP 抽象方法與抽象類abstract關(guān)鍵字介紹及應(yīng)用

    PHP 抽象方法與抽象類abstract關(guān)鍵字介紹及應(yīng)用

    抽象方法指沒有方法體的方法,只要一個(gè)類里面有一個(gè)方法是抽象方法,那么這個(gè)類就要定義為抽象類,不了解的朋友可以看看
    2014-10-10
  • PHP基于新浪IP庫獲取IP詳細(xì)地址的方法

    PHP基于新浪IP庫獲取IP詳細(xì)地址的方法

    這篇文章主要介紹了PHP基于新浪IP庫獲取IP詳細(xì)地址的方法,涉及php正則、curl及編碼轉(zhuǎn)換相關(guān)操作技巧,需要的朋友可以參考下
    2017-05-05
  • 最新評(píng)論

    平湖市| 临清市| 区。| 饶河县| 泰和县| 南城县| 大洼县| 贡山| 新泰市| 泾阳县| 行唐县| 广德县| 施秉县| 延庆县| 武宁县| 永寿县| 鹤壁市| 诏安县| 新郑市| 宜君县| 彭泽县| 芦山县| 长宁县| 包头市| 翁牛特旗| 丰顺县| 鄂托克旗| 泰安市| 原平市| 莒南县| 西华县| 穆棱市| 苏州市| 拜泉县| 连江县| 大安市| 正蓝旗| 曲沃县| 双辽市| 廉江市| 萨嘎县|