PHP-FPM をもっと理解しよう

98937658ef5be1bba2a9bff8d1026226?s=47 naoki85
December 15, 2018

PHP-FPM をもっと理解しよう

PHPアプリケーションが動いているサーバーがメモリ不足でアラートがあがる。どうやらphp-fpmがメモリを消費しているようだ。その時は付け焼き刃でphp-fpmの設定値を調整して対応したが、改めてちゃんと理解したいと思った。 そんな私とあなたに向けた内容(注:知識を整理したい方向けの予定です)

98937658ef5be1bba2a9bff8d1026226?s=128

naoki85

December 15, 2018
Tweet

Transcript

  1. 5.

    

  2. 11.

    PHP     WARNING: [pool www] seems busy

    (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 42 total children  
  3. 15.

    CGI _Common Gateway Interface` "#)&/(*-%,+IW03 PC B=8PV_$,! .'`ZJ A \[

     &/(*-%,+:3B= >9QOD $,! .'\5 1S4 &/(*-%,+2*-%,+ <7  6NTG$,! .'\5 FLUH  @M &/(*- %,+?^*-%,+]EL;K CGI  Wikipedia  PHP@XTGWeb&/(/[ $,! . 'YR 
  4. 16.

    Fast CGI CGI27'7bV J-5)(XLZRa"! FfbV!> -5)(XLZRHN !  +,$7.6(KB^ 

    FastCGI-5)(#0148U]YdA  dA[: Og# @W \Q -5%3/A<eJD8&7*c`;9C_ P?-5)( Ha !Th-5)(0148G] ]SbVI -5)(Ha  Wikipedia  -5)(#014=M SEHaeJ#
  5. 17.

    Web%%2ApacheNginx3 ❖Apache ❖Nginx l !"%#+  PHP,1 - */ 

    l Web%%)& $ PHP' 2CGI ,1(.3 l CGI  PHP $0' 
  6. 20.

    • docker • Zabbix Alpine Linux   • Nginx

    • PHP-FPM ϩʔΧϧͰ/HJOY 1)1'1. Λ;BCCJYͰ؂ࢹ͢Δαϯϓϧ
  7. 21.
  8. 25.

      ex) access.log = /var/log/php7/$pool.access.log   ex) php_admin_value[error_log]

    = /var/log/php7/$pool.error.log php_admin_flag[log_errors] = on   ex) slowlog = /var/log/php7/$pool.slow.log request_slowlog_timeout = 10s php_admin_value[error_l
  9. 39.

    dynamic WARNING: [pool www] server reached pm.max_children setting (5), consider

    raising it max_children     max_children 100  
  10. 40.

    dynamic WARNING: [pool www] seems busy (you may need to

    increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 5 total children ❖ 8 ❖ 0 ❖ active 5
  11. 41.

    dynamic ALERT: [pool www] pm.start_servers(10) must not be less than

    pm.min_spare_servers(1) and not greater than pm.max_spare_servers(3) ❖start_servers min_spare_servers  ❖start_servers max_spare_servers  min_spare_servers  max_spare_servers    
  12. 46.
  13. 47.

      ❖ $ (  $+&  ➢$ ➢"%$

    ➢$%$ ❖ %% !# * ,' ➢static ➢dynamic ➢ondemand ❖ )-