因為日志文件老是有這種提示:
[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 "^$"