MarchFun 發表於 2008-8-22 00:53:55

解決 apache 2.x 佔用 CPU 100%

<P>網站伺服器採用 apache2,經常佔用 CPU 資源達到 100%,困擾了很久,最近終於找到解決的辦法:</P>
<P>&nbsp;</P>
<P>在 httpd.conf 文件中加入 Win32DisableAcceptEx <BR></P>
<P>&nbsp;</P>
<P>ThreadsPerChild 250 <BR>MaxRequestsPerChild&nbsp; 0 <BR>Win32DisableAcceptEx #在這行加上 Win32DisableAcceptEx 即可</P>
<P><BR>相關資訊:<A href="http://httpd.apache.org/docs-2.0/mod/mpm_winnt.html">http://httpd.apache.org/docs-2.0/mod/mpm_winnt.html</A></P>

tungwj 發表於 2008-8-22 08:36:48

<P>資訊收到</P>
<P>馬上更新</P>
<P>謝謝</P>

MarchFun 發表於 2008-8-22 09:05:36

<P>補充資訊:這個方法是專門針對將 apache 架在 Windows 系列上的伺服器。</P>
<P>&nbsp;</P>
<P>以下是轉貼來的資訊:</P>
<P>&nbsp;</P>
<P>所謂Apache出現CPU高佔用率就是指Apache在一段時間內持續佔用很高的CPU使用率,甚至達到CPU100%,這個時候造成網站無法訪問。解決的方法就是仔細觀察Apache的日誌檔案,查閱錯誤的資訊。</P>
<P>下面我們針對幾種錯誤資訊進行分析並給出解決的方法:</P>
<P><BR>Apache官方提供的手冊中提到,在Windows系統下Apache2.x為了提高性能而使用了Microsoft WinSock v2 API,但是一些常見的防火牆軟體會破壞他的正確性,從而使得Apache出現死循環操作造成CPU100%。</P>
<P>其錯誤提示如下所示:</P>
<P>&nbsp;</P>
<P> (730038)An operation was attempted on something that is not a socket.: winnt_accept: AcceptEx failed. Attempting to recover. </P>
<P> (OS 10038) : Child 3356: Encountered too many errors accepting client connections. Possible causes: dynamic address renewal, or incompatible VPN or firewall software. Try using the Win32DisableAcceptEx directive. </P>
<P> (OS 121)信號燈超時時間已到。 : winnt_accept: Asynchronous AcceptEx failed.</P>
<P> (OS 64)指定的網絡名不再可用。 : winnt_accept: Asynchronous AcceptEx failed.</P>
<P>&nbsp;</P>
<P>可以依次採用下面的方法來解決上面的問題,如果進行了一步還有問題就繼續下一步:</P>
<P>1) 在httpd.conf檔案中使用 Win32DisableAcceptEx 禁止Apache使用 Microsoft WinSock v2 API :</P>
<P>&lt;IfModule mpm_winnt.c&gt; <BR>Win32DisableAcceptEx # 禁止使用AcceptEx() <BR>&lt;/IfModule&gt;</P>
頁: [1]
檢視完整版本: 解決 apache 2.x 佔用 CPU 100%