久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      FPM鮮為人知的三種模式

      我們經(jīng)常使用php-fpm,但是不一定所有人都知道fpm有三種模式,今天小年就帶大家了解一下fpm的三種模式,有需要的可以參考參考。

      FPM鮮為人知的三種模式

      ; Choose how the process manager will control the number of child processes. ; Possible Values: ;   static  - a fixed number (pm.max_children) of child processes; ;   dynamic - the number of child processes are set dynamically based on the ;             following directives. With this process management, there will be ;             always at least 1 children. ;             pm.max_children      - the maximum number of children that can ;                                    be alive at the same time. ;             pm.start_servers     - the number of children created on startup. ;             pm.min_spare_servers - the minimum number of children in 'idle' ;                                    state (waiting to process). If the number ;                                    of 'idle' processes is less than this ;                                    number then some children will be created. ;             pm.max_spare_servers - the maximum number of children in 'idle' ;                                    state (waiting to process). If the number ;                                    of 'idle' processes is greater than this ;                                    number then some children will be killed. ;  ondemand - no children are created at startup. Children will be forked when ;             new requests will connect. The following parameter are used: ;             pm.max_children           - the maximum number of children that ;                                         can be alive at the same time. ;             pm.process_idle_timeout   - The number of seconds after which ;                                         an idle process will be killed. ; Note: This value is mandatory.

      pm有三種模式:static、dynamic和ondemand

      static

      這種方式比較簡單,在啟動時master按照pm.max_children配置fork出相應(yīng)數(shù)量的worker進(jìn)程,即worker進(jìn)程數(shù)是固定不變的。

      dynamic

      動態(tài)進(jìn)程管理,首先在fpm啟動時按照pm.start_servers初始化一定數(shù)量的worker。

      運行期間如果master發(fā)現(xiàn)空閑worker數(shù)低于pm.min_spare_servers配置數(shù)(表示請求比較多,worker處理不過來了)則會fork worker進(jìn)程,但總的worker數(shù)不能超過pm.max_children。

      如果master發(fā)現(xiàn)空閑worker數(shù)超過了pm.max_spare_servers(表示閑著的worker太多了)則會殺掉一些worker,避免占用過多資源,master通過這4個值來控制worker數(shù)。

      ondemand

      這種方式一般很少用,在啟動時不分配worker進(jìn)程,等到有請求了后再通知master進(jìn)程fork worker進(jìn)程,總的worker數(shù)不超過pm.max_children,處理完成后worker進(jìn)程不會立即退出,當(dāng)空閑時間超過pm.process_idle_timeout后再退出。

      pm.max_children:靜態(tài)方式下開啟的php-fpm進(jìn)程數(shù)量。

      pm.start_servers:動態(tài)方式下的起始php-fpm進(jìn)程數(shù)量。

      pm.min_spare_servers:動態(tài)方式下的最小php-fpm進(jìn)程數(shù)量。

      pm.max_spare_servers:動態(tài)方式下的最大php-fpm進(jìn)程數(shù)量。

      FPM對信號的處理

      php-fpm reload

      php-fpm stop

      kill SIGUSR1 php-fpm 重新使用新的文件,完成日志切割

      kill SIGUSR2 php-fpm 重新啟動work進(jìn)程,重新加載配置文件

      Q1:啟動php-fpm進(jìn)程之后,kill php-fpm master進(jìn)程號,還能繼續(xù)服務(wù)嗎? A: 不能 (所有php-fpm進(jìn)程都被關(guān)閉)

      Q2:啟動php-fpm進(jìn)程之后,kill -9 php-fpm master進(jìn)程號,還能繼續(xù)服務(wù)嗎? A: 能(只kill了 master進(jìn)程,work進(jìn)程還在工作)

      Q2:啟動php-fpm進(jìn)程之后,kill php-fpm work進(jìn)程號,還能繼續(xù)服務(wù)嗎?A: 能(work進(jìn)程被kill后,又新起一個work進(jìn)程)

      FPM的生命周期

      php_module_startup()

      fcgi_accept_request()

      php_request_startup()

      fmp_request_executing()

      php_execute_script()

      fpm_requset_end()

      php_request_shutdown()

      因為fpm是常駐進(jìn)程,所以在php_request_shutdown()之后又會從fcgi_accept_request()開始循環(huán)。

      推薦學(xué)習(xí):php視頻教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號