pid = php-pm,PHP failed to ptrace(PEEKDATA) pid 1918: Input/output error (5)或者 increase pm.start_ser...

今天网站出现负载很大,cpu占用率超高,网站延迟很大,前台出现此错误信息:[19-Sep-2016 23:30:38] WARNING: [pool www] child 31954, script '/var/www/html/casino.21pink.com/public/index.php' (request: "POST /index.php") executing too slow (2.407095 sec), logging

[19-Sep-2016 23:30:38] WARNING: [pool www] child 31943, script '/var/www/html/casino.21pink.com/public/index.php' (request: "POST /index.php") executing too slow (2.062648 sec), logging

[19-Sep-2016 23:30:38] WARNING: [pool www] child 31941, script '/var/www/html/casino.21pink.com/public/index.php' (request: "POST /index.php") executing too slow (2.666022 sec), logging

[19-Sep-2016 23:30:38] WARNING: [pool www] child 30382, script '/var/www/html/casino.21pink.com/public/index.php' (request: "POST /index.php") executing too slow (2.021010 sec), logging

[19-Sep-2016 23:30:38] WARNING: [pool www] child 29797, script '/var/www/html/casino.21pink.com/public/index.php' (request: "POST /index.php") executing too slow (2.554333 sec), logging

[19-Sep-2016 23:39:27] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 2 idle, and 68 total children

[19-Sep-2016 23:40:58] 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 81 total children

[19-Sep-2016 23:40:59] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 3 idle, and 86 total children

[19-Sep-2016 23:41:00] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 2 idle, and 88 total children

[19-Sep-2016 23:41:01] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 91 total children

从信息看,应该是php进程较少:

经过查看发现进程确实很少,解决如下:

修改配置文件增加进程

数值设置,参考自己的实际硬件配置,可以参考 内存/20M 来计算。

重新加载进程/etc/init.d/php-fpm reload

等待了一点时间发现又报错:[19-Sep-2016 23:30:20] WARNING: [pool www] child 7782, script '/var/www/html/casino.21pink.com/public/index.php' (request: "POST /index.php") executing too slow (2.224150 sec), logging

[19-Sep-2016 23:30:08] ERROR: failed to ptrace(PEEKDATA) pid 7663: Input/output error (5)

[19-Sep-2016 23:30:20] WARNING: [pool www] child 31952, script '/var/www/html/casino.21pink.com/public/index.php' (request: "POST /index.php") executing too slow (2.045803 sec), logging

[19-Sep-2016 23:30:20] ERROR: failed to ptrace(PEEKDATA) pid 31952: Input/output error (5)

查找资料如下:

It usrears you have request_slowlog_timeout enabled.

This normally takes any request longer than N seconds, logs that it was

taking a long time, then logs a stack trace of the script so you can see

what it was doing that was taking so long.

In your

case, the stack trace (to determine what the script is doing) is

failing. If you're running out of processes, it is because either:

After php-fpm stops the process to trace it, the process fails to resume because of the error tracing it

The process is resuming but continues to run forever.

My first guess would be to disable request_slowlog_timeout.

Since it's not working right, it may be doing more harm than good. If

this doesn't fix the issue of running out of processes, then set the

php.ini max_execution_time to something that will kill the script for sure.

大概说是设置了slowlog和php的最大执行时间。

解决:

禁止slowlog

修改最大执行时间:

重启进程:/etc/init.d/php-fpm reload

等待一段时间,发现一切正常。

查看TCP连接相关:[root@GreenZonewebapp2 php-fpm.d]# ss -s

Total: 323 (kernel 675)

TCP:   4538 (estab 12, closed 4518, orphaned 0, synrecv 0, timewait 4518/0), ports 0

Transport Total     IP        IPv6

*      675       -         -

RAW      0         0         0

UDP      5         4         1

TCP      20        19        1

INET      25        23        2

FRAG      0         0         0

同时发现系统TIMEWAIT 较多,所以优化了一些内核相关参数

过一阵再查看:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值