php日誌報錯child exited with code 0 after seconds from start

來源:互聯網
上載者:User
因為之前發生502了,日誌提示

[27-May-2015 13:54:34] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 16 idle, and 602 total children

然後我就自己隨意增加了pm.start_servers參數,一段時間後,php日誌/usr/local/php/var/log/php-fpm.log部分資訊如下:


[27-May-2015 15:13:48] NOTICE: [pool www] child 3998 started

[27-May-2015 15:13:59] NOTICE: [pool www] child 9242 exited with code 0 after 47575.960999 seconds from start

[27-May-2015 15:13:59] NOTICE: [pool www] child 4210 started

[27-May-2015 15:14:42] NOTICE: [pool www] child 9217 exited with code 0 after 47619.884065 seconds from start

[27-May-2015 15:14:42] NOTICE: [pool www] child 5621 started

[27-May-2015 15:14:43] NOTICE: [pool www] child 9561 exited with code 0 after 47620.024499 seconds from start


原因就是沒有pm.start_servers這個參數沒有按照下面的這個公式來:

pm.start_servers= min_spare_servers + (max_spare_servers - min_spare_servers) / 2

一般min_spare_servers設定為20

max_spare_servers是根據伺服器本身的記憶體來計算的,標準演算法就是記憶體大小除以30M

當然,有的php程式可能佔用比較小,不到30M,這就看情況來計算了。

我設定的是這樣的

過濾注釋部分:

cat /usr/local/php/etc/php-fpm.conf | grep -v "^;" | grep -v "^$"


[global]

pid = run/php-fpm.pid

error_log = log/php-fpm.log

emergency_restart_threshold = 10

emergency_restart_interval = 1m

process_control_timeout = 10s

rlimit_files = 65535

events.mechanism = epoll

[www]

user = www

group = www

listen = 127.0.0.1:9000

pm = dynamic

pm.max_children = 1400

pm.start_servers = 710

pm.min_spare_servers = 20

pm.max_spare_servers = 1400

pm.max_requests = 10000

slowlog = log/$pool.log.slow


然後重新載入下
/usr/local/nginx/sbin/nginx -s reload

之後幾天日誌沒有出現資訊了。

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.