FPM的三种模式分别是什么,怎么理解
Admin 2022-08-01 群英技术资讯 1569 次浏览
很多朋友都对“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
这种方式比较简单,在启动时master按照pm.max_children配置fork出相应数量的worker进程,即worker进程数是固定不变的。
动态进程管理,首先在fpm启动时按照pm.start_servers初始化一定数量的worker。
运行期间如果master发现空闲worker数低于pm.min_spare_servers配置数(表示请求比较多,worker处理不过来了)则会fork worker进程,但总的worker数不能超过pm.max_children。
如果master发现空闲worker数超过了pm.max_spare_servers(表示闲着的worker太多了)则会杀掉一些worker,避免占用过多资源,master通过这4个值来控制worker数。
这种方式一般很少用,在启动时不分配worker进程,等到有请求了后再通知master进程fork worker进程,总的worker数不超过pm.max_children,处理完成后worker进程不会立即退出,当空闲时间超过pm.process_idle_timeout后再退出。
pm.max_children:静态方式下开启的php-fpm进程数量。
pm.start_servers:动态方式下的起始php-fpm进程数量。
pm.min_spare_servers:动态方式下的最小php-fpm进程数量。
pm.max_spare_servers:动态方式下的最大php-fpm进程数量。
php-fpm reload
php-fpm stop
kill SIGUSR1 php-fpm 重新使用新的文件,完成日志切割
kill SIGUSR2 php-fpm 重新启动work进程,重新加载配置文件
Q1:启动php-fpm进程之后,kill php-fpm master进程号,还能继续服务吗? A: 不能 (所有php-fpm进程都被关闭)
Q2:启动php-fpm进程之后,kill -9 php-fpm master进程号,还能继续服务吗? A: 能(只kill了 master进程,work进程还在工作)
Q2:启动php-fpm进程之后,kill php-fpm work进程号,还能继续服务吗?A: 能(work进程被kill后,又新起一个work进程)
php_module_startup()
fcgi_accept_request()
php_request_startup()
fmp_request_executing()
php_execute_script()
fpm_requset_end()
php_request_shutdown()因为fpm是常驻进程,所以在
php_request_shutdown()之后又会从fcgi_accept_request()开始循环。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
在laravel中,“DB::raw()”方法用于复杂的sql查询,该方法能够将查询到的结果集当成一个临时表,然后使用laravel的查询构造器语法进行分页处理,语法为“DB::raw('函数或者字段');”。
在laravel中,lts是长期技术支持的意思,是“Long-Term Support”的缩写;lts版本会在较长的时间内获得安全、维护功能的更新,支持两年的bug修复和三年的安全更新支持,也即lts版本是最稳定的版本。
PHP7栏目讲解php7和PHP5对比的新特性和性能优化,有需要的朋友可以看看,了解了解,一起讨论讨论。
php怎样实现格式化时间?我们有时候会遇到需要格式化时间的需求,那么要怎么操作呢?下面就给大家分享关于php实现格式化时间操作的实例,感兴趣的朋友可以了解看看。
关于php中的信号处理器和信号处理操作,很多新手不是很清楚,这篇文章小编就给大家介绍一些关于php的信号说明以及信号处理操作,感兴趣的朋友可以看一看。
成为群英会员,开启智能安全云计算之旅
立即注册关注或联系群英网络
7x24小时售前:400-678-4567
7x24小时售后:0668-2555666
24小时QQ客服
群英微信公众号
CNNIC域名投诉举报处理平台
服务电话:010-58813000
服务邮箱:service@cnnic.cn
投诉与建议:0668-2555555
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 ICP核准(ICP备案)粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008