我有几个低stream量的虚拟主机应用程序,我想运行在同一个盒子,使用类似这样的configuration:
[example.com] listen = /tmp/example.com.socket listen.owner = www-data listen.group = www-data listen.mode = 0666 user = www-data group = www-data pm = dynamic ; scale children according to this rule pm.max_requests = 1000 ; respawn child after so many requests pm.max_children = 12 ; cap the total number of children thus pm.start_servers = 6 ; children created at daemon boot pm.max_spare_servers = 2 ; maximum number of idling children pm.min_spare_servers = 1 ; minimum number of idling children pm.status_path = /php_pool_example.com_status request_terminate_timeout = 30s request_slowlog_timeout = 20s slowlog = /var/www/com/example/logs/php-slow.log catch_workers_output = yes env[HOSTNAME] = $HOSTNAME env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp php_flag[display_errors] = off php_admin_value[error_log] = /logs/php_err.log php_admin_flag[log_errors] = on
工作好,除了我不知道如何“闲置”一个孩子,以便PHP-FPM将杀死它。 我看到的问题是,当我添加更多的应用程序时,每个应用程序都存在〜6个空闲的php-fpm子项,无缘无故地耗尽了内存。 现在, request_terminate_timeout会因为请求过长而杀死一个孩子,但是由于过多的请求而没有孩子。 该手册定义了如何说有太多或太less的闲置的孩子,但在指定上是安静的。 如果我测量到一个没有提供30分钟请求的php-fpm子应该被认为是“空闲”并且被杀死了,那我该如何通知php-fpm呢?
下一个稳定版本的php-fpm应该支持一个ondemand调度程序,它可以扩展和缩小儿童。 迄今为止,没有追索权。
我只是想报告,至今ondemand完美的作品。 有了ondemand,你可以设置pm.start_servers = 0来停止空闲进程:
pm = ondemand pm.start_servers = 0