我有一個非常繁忙的服務器:使用W3TotalCache APC的PHP(Wordpress),Apache和Cloudflare的Varnish來處理所有流量。 Ubuntu 14.04.4 LTSAH00161:服務器達到MaxRequestWorkers設置,考慮提高MaxRequestWorkers設置
只有一個網站的平均每天點擊量約爲60k。
我每時每刻都會收到此消息。與暫時的流量高峯無關,我們將時間與Google Analytics進行了比較。
Thu Apr 28 14:14:42.938075 2016] [mpm_prefork:error] [pid 19137] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
[Thu Apr 28 15:43:25.594147 2016] [core:notice] [pid 19137] AH00051: child pid 19866 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594313 2016] [core:notice] [pid 19137] AH00051: child pid 20386 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594407 2016] [core:notice] [pid 19137] AH00051: child pid 19143 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594498 2016] [core:notice] [pid 19137] AH00051: child pid 19144 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594572 2016] [core:notice] [pid 19137] AH00051: child pid 20597 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594642 2016] [core:notice] [pid 19137] AH00051: child pid 20395 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594704 2016] [core:notice] [pid 19137] AH00051: child pid 20424 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594785 2016] [core:notice] [pid 19137] AH00051: child pid 20598 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594870 2016] [core:notice] [pid 19137] AH00051: child pid 19861 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594957 2016] [core:notice] [pid 19137] AH00051: child pid 19782 exit signal Segmentation fault (11), possible coredump in /etc/apache2
....
....
所以我增加MaxRequestWorkers第一個100,然後500,目前其在1024但還是發生了。
這是我目前的apache2.conf。 代碼:
<IfModule mpm_worker_module>
StartServers 256
MinSpareThreads 256
MaxSpareThreads 256
MaxClients 256
ServerLimit 256
ThreadLimit 256
ThreadsPerChild 256
MaxRequestWorkers 1024
MaxConnectionsPerChild 0
MaxRequestPerChild 1000
</IfModule>
有很多免費的RAM和負荷平均在0.5左右,有時超過1,但從來沒有見過它高於2.因此,服務器似乎健康的處理流量。
top - 16:07:47 up 3 days, 18:18, 2 users, load average: 0.57, 0.46, 0.55
Tasks: 113 total, 1 running, 112 sleeping, 0 stopped, 0 zombie
%Cpu(s): 10.5 us, 2.0 sy, 0.0 ni, 87.4 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 8176816 total, 2372560 used, 5804256 free, 189684 buffers
KiB Swap: 0 total, 0 used, 0 free. 1286692 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21930 www-data 20 0 337212 83308 60072 S 24.9 1.0 0:52.89 apache2
21945 www-data 20 0 327640 72684 58816 S 24.3 0.9 0:48.37 apache2
1182 nobody 20 0 702868 442268 83496 S 0.7 5.4 42:41.32 varnishd
任何想法爲什麼Apache中斷?
∥焦
我增加MaxRequestWorkers 5000,服務器現在已經超過24小時穩定。最近幾周最長的時間,而不必重新啓動Apache。 –
流量已經增加到每天約200萬次點擊,我們也遇到同樣的問題。 StartServers的1024 MinSpareThreads 1024 MaxSpareThreads 1024 的MaxClients 1024 了ServerLimit 1024 將ThreadLimit 1024 ThreadsPerChild是1024個 MaxRequestWorkers 8192 MaxConnectionsPerChild 0 MaxRequestPerChild 4096 有什麼你可以做更多,而不增加更多服務器? –
Stack Overflow是編程和開發問題的網站。這個問題似乎與題目無關,因爲它不涉及編程或開發。請參閱幫助中心的[我可以詢問哪些主題](http://stackoverflow.com/help/on-topic)。也許[超級用戶](http://superuser.com/)或[Unix&Linux堆棧交換](http://unix.stackexchange.com/)會是一個更好的地方。另請參閱[我在哪裏發佈關於Dev Ops的問題?](http://meta.stackexchange.com/q/134306) – jww