PHP FastCGI 进程管理器: PHP-FPM

最近 PHP-FPM (PHP FastCGI Process Manager) 这个话题在讨论组里很受关注。使用 PHP 的朋友对于 FastCGI 进程的管理估计都很头疼,比如 Nginx 下的 FastCGI 就有不少人用的 Lighttpd 的 spawn-fcgi 来对进程进行管理。但这样存在不少缺点(中文版本)。

PHP-FPM 配置起来很简单,但有一点比较有意思的是如何确定 Worker 的数量。PHP-FPM 作者 Andrei Nigmatulin 在新闻组里提到的小技巧如下:

1) 用 Linux top 命令观察 (这个方式比较土)
2) 用 'netstat -np | grep 127.0.0.1:9000' 收集数据。
设置 php-fpm.conf 中的 max_children 的数值使 等待的数量变为最小。

目前使用 PHP-FPM 还只是通过 Patch 方式,然后编译,期待能够早点并入正式的 PHP 代码中。当然,PHP 核心开发的那些大爷们也不知都在忙什么呢,莫非还在为 Unicode 较劲呢?

–EOF–

Tips : PHP-FPM on highload tips


17 thoughts on “PHP FastCGI 进程管理器: PHP-FPM”

  1. Leechael

    This is temporary restriction to let php-fpm become mature in his cradle
    before it hit the streets.
    I’d like to see all main features implemented first. Then the licence most
    probably will be changed to php-compatible one in order to be accepted by php
    developers.
    BTW, current licence does not restrict you from use of the product, only from
    distribution in particular cases.
    这是作者的原话。

    Reply ↓
  2. Noble

    估计还是稳定性的问题吧
    好像开源的产品,开始的时候功能加的都很快,而后就越来越慢的,稳定性就排到第一位了
    不过,只要不是每次重写的就好
    稳定第一

    Reply ↓
  3. yihua2000

    php+mysql+GD
    没有问题
    ./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql –with-j
    peg-dir=/usr/local –with-zlib-dir=/usr/local –with-freetype-dir=/usr/local –with-png-dir=/usr/local –with-gd=/usr/local/GD –with-libxml-dir=/usr/local –enable-mbstring –enable-xml –enable-sockets –enable-ipv6 –enable-fastcgi –enable-fpm
    但是加入fpm后编译出fpm_php.c: In function `zend_ini_alter_master’:
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c:27: error: `tsrm_ls’ undeclared (first use in this function)
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c:27: error: (Each undeclared identifier is reported only once
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c:27: error: for each function it appears in.)
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c:27: warning: dereferencing type-punned pointer will break strict-aliasing rules
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c: In function `fpm_php_apply_defines’:
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c:87: error: too few arguments to function `php_dl’
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c:99: error: `tsrm_ls’ undeclared (first use in this function)
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c:101: warning: passing arg 2 of `fpm_php_disable’ from incompatible pointer type
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c:108: warning: passing arg 2 of `fpm_php_disable’ from incompatible pointer type
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c: In function `fpm_php_cleanup’:
    /php-5.2.6/sapi/cgi/fpm/fpm_php.c:126: error: `tsrm_ls’ undeclared (first use in this function)
    make: *** [sapi/cgi/fpm/fpm_php.lo] 错误 1
    错

    Reply ↓
  4. 在线代理

    好文。
    但是下面这句链接视乎有问题,中文的链接不对。
    —————————–
    但这样存在不少缺点(中文版本)。
    —————————–

    Reply ↓
  5. myfreeke

    我现在使用nginx+php fpm
    现在nginx七个并发左右,数据库基本空闲,但在打开BBS时感觉有时比较慢.看Nginx服务器有时CPU会达到30%,PHP FPM进程现在调整到100个.PHP日志也没有报错.
    不知道什么原因.

    Reply ↓
  6. php经典论坛

    出现499错误:
    [WARNING] fpm_stdio_child_said(), line 167: child 3506 (pool default) said into stderr: “Feb 05 09:26:39.902098 [ERROR] fpm_unix_init_child(), line 168: setrlimit(RLIMIT_NOFILE) failed: Invalid argument (22)” 是什么原因?

    Reply ↓

Leave a Reply

Your email address will not be published. Required fields are marked *