php-fpm配置笔记



Posted on 2013 年 2 月 27 日 3,070 Views

不得不说,英文不好弄linux服务器有时是挺痛苦的,苦逼的博主没好好学习英文,导致被lnmp折腾的够呛.

 

php-fpm配置不当,导致服务器经常出现502错误,上个学期多次调整都没有解决,网上找来资料,大都是增加max_children,可是我都加到顶了,php-fpm log里面还是有大量的警告:

eems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 88 total children

不想看英文,一看就头晕,但是502更头晕,特别是昨天,刚重启了lnmp没多久,容不得松口气,就看到负载飙到20多,一开网站,又特么502了。

硬着头皮看默认配置里面的英文注释,才发现自己的三个参数配置貌似有相当大的问题:

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.

 

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 5
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3

 

注释上貌似是说,static模式时,只有pm.max_children生效,dynamic模式时,pm.max_children依然生效,另外:

pm.start_server #控制服务启动时创建的进程数,

pm.min_spare_servers #控制最小备用进程数

pm.max_spare_servers #最大备用进程数

spare_servers翻译成备用进程,不知道合适不适合,如果真这样,那我之前的配置就让人无奈了: pm.min_space_servers 20,pm.max_spare_servers 80,pm.max_children 80,会不会是因为备用的太多才导致502呢?

 

另外,下面的具体配置里面,注释中给出了计算pm.start_servers默认值的公式:

Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2

按这个公式,我之前的pm.start_servers应该是 20+(80-20)/2=50,可是我当时设置的是20…

重新规划如下:

pm = dynamic
pm.max_children =80
pm.start_servers = 12
pm.min_spare_servers = 4
pm.max_spare_servers = 20
rlimit_files = 65535
pm.max_requests = 102400

 

转载于:https://www.cnblogs.com/yangchunlong/p/8306148.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/267723.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

php xcat createadmin,php xcat update升级后出错,不知怎么弄

恢复再次升级,同样的错误,没法升级了吗Fetching originremote: Enumerating objects: 353, done.remote: Counting objects: 100% (353/353), done.remote: Compressing objects: 100% (3/3), done.remote: Total 802 (delta 350), reused 350 (delta 35…

JNDI(datasource)在tomcat,JBOSS下的spring+quartz配置

由于项目中多个小应用(类似插件)需要使用数据库连接池,不能为每一个应用中配置连接池。故采用JNDI的模式进行配置。 我们使用的web服务器有tomcat和jboss两种。分别介绍其在这两种服务器下并且在两种应用模式springhebernat与quartz下的配置。…

UVA10561 Treblecross

Treblecross 题目大意:给定一个带有.和X的字符串作为初始局面,两人轮流游戏,将.修改为X,当一个人放下X后,出现三个连续的X,游戏接触,放下X的人获胜。判断先手必胜还是必败,并给出第一…

解决VS2005 远程工具无法通过同步软件连接S5pv210 样机的问题

居然无法连接,记得以前遇到过的 1 分钟前 上传下载附件 (58.21 KB)后来还是看MSDN解决了MSDN连接如下http://msdn.microsoft.com/en-us/library/ee480836.aspx——Troubleshooting a Connection to a Target Device That Uses Platform Manager 转载一下sunrain_hjb…

matlab画曲面二次,如何用matlab绘制二次B样条三维曲面(已知控制点和节点矢量)?...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼小弟初来乍到,现在需要用matlaB绘制二次B样条曲面,现在已知信息:小弟做这个已经一个星期了,现在无任何进展,现在是万分着急,希望高手们给小弟指点一二&#xf…

一些应该记住的东西(持续更新?再也不会更新了)

没什么用的目录 1.积性函数与杜教筛 2.搜索的几种优化与考试期望得分 3.乱讲 4.模拟退火系列 5.生成函数系列 2018.1.18 首先写写数学方面的吧(因为现在在学)……毕竟这里面的公式浩如烟海…… 对着表推了十分钟愣是没发现……明明上午还证明过…… 还有就是通过算贡献化简一些…

传说中的window8 的种子

2019独角兽企业重金招聘Python工程师标准>>> 趁着更新服务器最后时刻 发个种子 有兴趣的可以去看看 http://dl.dbank.com/c03a8fck07 转载于:https://my.oschina.net/qutterrtl/blog/28368

oracle 触发器 merge,[OT]函数|过程|触发器|插入(insert)|修改(Merge)

CREATE TABLE errlog(Errcode NUMBER,Errtext CHAR(40));--1,创建函数:CREATE OR REPLACEFUNCTION get_salary (p_deptno NUMBER ) RETURN NUMBER AS v_sal NUMBER;BEGINIF p_deptno IS NULL THENRAISE_APPLICATION_ERROR(-20991,Department number is null);ELSIF …

苏州飘“彩云” 五年规模破百亿元

7月12日在苏州举行的国际云计算与移动互联网应用研讨会的重头戏之一,是苏州科技城 “彩云计划”的发布。由硅谷云计算卓越中心(CoE)与苏州科技城联合设立的苏州科技城云计算卓越中心同时成立。苏州科技城云计算卓越中心的建立是“彩云计划”落…

php 生成导出excel,PHP导出生成EXCEL文件

PHP导出生成EXCEL文件// 解决中文乱码所做的编码转换function xecho($content){echo mb_convert_encoding($content,"gbk","auto");}// 必须要的基本headerheader("Content-Type: application/vnd.ms-excel; charsetutf-8");header("Conten…

linux 内核 内存管理 slub算法 (一) 原理

http://blog.csdn.net/lukuen/article/details/6935068转载于:https://www.cnblogs.com/zengkefu/p/8320429.html

用户配置文件

问:什么是用户配置文件? 答:用户配置文件就是在用户登录时定义系统加载所需环境的设置和文件的集合。它包括所有用户专用的配置设置,如程序项目、屏幕颜色、网络连接、打印机连接、鼠标设置及窗口的大小和位置。 当你第一次登录到一台基于…

oracle00109,ORA-01034: 、ORA-01078: 和 LRM-00109: 的解决方法,ora-01034ora-01078

ORA-01034: 、ORA-01078: 和 LRM-00109: 的解决方法,ora-01034ora-01078环境:Linux 5.4 Oracle 11.2.0.3在Linux上连接Oracle时遇到报错:SQL> show parameter sgaORA-01034: ORACLE not availableProcess ID: 0Session ID: 0 Serial numbe…

listView 多布局

最近在开发项目中遇到了实现类似淘宝首页的需求,使用listView可以解决,在此记录一下。 实现步骤: 重写 getViewTypeCount() – 返回你有多少个不同的布局重写 getItemViewType(int) – 由position返回view type id根据view item的类型&#x…

数据查询

command命令的方法:ExecuteNonQuery(受影响行数),ExecuteReader(返回的是Datatable),ExecuteScalar(第一行第列) SqlDataAdapter是和DataSet配和工作的,不能分开。 using(SqlConnection connnew SqlConnection(connectionString)) { conn.Open(); SqlCom…

Php面试题之背人过桥,梦见背人过桥好不好?

吉凶指数:99(由佛滔居士根据数理文化得出,仅供参考)老年人梦见桥,意味着将不久于人世。谈判人员梦见桥,意味着与对手实现双赢。梦见走过土桥的梦,也表示谈生意、婚姻等拖延不决。梦见过桥,表示有能力解决遇…

第00章—IDEA

spring boot 系列学习记录:http://www.cnblogs.com/jinxiaohang/p/8111057.html 码云源码地址:https://gitee.com/jinxiaohang/springboot 来自网络搜索整理 IntelliJ IDEA安装 IntelliJ IDEA破解 IntelliJ IDEA 注册码 IntelliJ IDEA安装主题 IntelliJ …

软件测试5未来大发展路线,测试工程师发展偏向

目录:导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结(尾部小惊喜) 前言 1、软件测试的五大…

SQL里的SWITCH分支语句

declareiintdeclarejvarchar(10)seti1selectjcaseiwhen1then11when2then22when3then33elseotherendprintj

linux 文件夹换所属用户,linux普通用户su root切换提示没有文件或目录的解决方法...

1. 首先进入单用户模式:1). ubuntu :上述情况可以在grub界面选择第二项修复,但没有grub可以参考:1、重启ubuntu,随即长按shirft进入grub菜单;2、选择recovery mode,按"e"键进入编辑页面&#xff…