国产欧美日韩第一页|日本一二三不卡视频|在线精品小视频,亚洲第一免费播放区,metcn人体亚洲一区,亚洲精品午夜视频

幫助中心 >  技術(shù)知識庫 >  云服務(wù)器 >  服務(wù)器教程 >  APACHE服務(wù)器httpd.exe進(jìn)程占用cpu100%的解決方法

APACHE服務(wù)器httpd.exe進(jìn)程占用cpu100%的解決方法

2016-08-30 02:12:10 11974

httpd.exe進(jìn)程占用cpu%100,關(guān)閉掉AppServ服務(wù),cpu應(yīng)用率立刻下降到0。
  重新啟動(dòng)AppServ又出現(xiàn)占用cpu高的情況。
  原因,httpd.exe和防火墻配置有沖突。
  解決方法如下:
  1.網(wǎng)上鄰居->本地鏈接->屬性->internet協(xié)議(TCP/IP)->屬性->高級->wins標(biāo)簽->去掉起用LMhosts查詢前的勾。
  2.控制面版->windows防火墻->高級標(biāo)簽->本地鏈接設(shè)置->服務(wù)的標(biāo)簽里勾選安全Web服務(wù)器(HTTPS)即可。
  另外在網(wǎng)上有另外一種解決辦法。
  找到httpd.conf配置文件
  修改ThreadsPerChild 的值為150 默認(rèn)是250 萬一你的服?器或vps內(nèi)存超過2G 那么就不用設(shè)置
  經(jīng)過修改防火墻設(shè)置http.exe占用cpu100%的問題解決!

# worker MPM

# ThreadLimit: maximum setting of ThreadsPerChild

# ServerLimit: maximum setting of StartServers

# StartServers: initial number of server processes to start

# MaxClients: maximum number of simultaneous client connections

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# ThreadsPerChild: constant number of worker threads in each server process

# MaxRequestsPerChild: maximum number of requests a server process serves


ThreadLimit 125

ServerLimit 320

StartServers 5

MaxClients 8000

MinSpareThreads 125

MaxSpareThreads 1250

ThreadsPerChild 125

MaxRequestsPerChild 1000


其中最重要的參數(shù)是 ThreadsPerChild和 MaxClients:

##ThreadsPerChild 每個(gè)子進(jìn)程?立的線程數(shù),子進(jìn)程在啟動(dòng)時(shí)建立這些線程后就不再建立新的線程了

##MaxClients 允許同時(shí)伺服的最大接入請求數(shù)量(在worker下就是最大線程數(shù)量)

##ServerLimit:對最大子進(jìn)程數(shù)的上限,該值必須大于等于MaxClients/ThreadsPerChild

##ThreadLimit:對ThreadsPerChild的上限,該值必須大于等于 ThreadsPerChild,如果將ThreadLimit設(shè)置成一個(gè)高出實(shí)際需要很多的ThreadsPerChild值,將會(huì)有過多的共享內(nèi)存被 分配,應(yīng)當(dāng)和ThreadsPerChild可能達(dá)到的最大值保持一致.

##StartServers:服務(wù)器啟動(dòng)時(shí)的服務(wù)進(jìn)程數(shù)目,該值肯定小于等于ServerLimit

##MinSpareThreads和MaxSpareThreads:通過新建或結(jié)束子進(jìn)程的方式,將空閑線程的總數(shù)維持在這個(gè)范圍內(nèi)

##MaxRequestsPerChild:用于控制服務(wù)器建立新進(jìn)程和結(jié)束舊進(jìn)程的頻 率,其實(shí)是一個(gè)為了防止內(nèi)存溢出的參數(shù),每個(gè)子進(jìn)程在其生存期內(nèi)允許伺服的最大請求數(shù)量。到達(dá)MaxRequestsPerChild的限制后,子進(jìn)程將 會(huì)結(jié)束。對于KeepAlive鏈接,只有第一個(gè)請求會(huì)被計(jì)數(shù)。事實(shí)上,它改變了每個(gè)子進(jìn)程限制最大鏈接數(shù)量的行為。

可以通過檢查HTTPServer/logs/error_log日志,判斷MaxClients是否需要增加,如果有下面的報(bào)錯(cuò),就說明apache自上次重啟至今,曾經(jīng)發(fā)生過達(dá)到MaxClients的情況:

Tue Jun 07 16:36:03 2011] [error] server reached MaxClients setting, consider raising the MaxClients setting

需要注意的是,這樣的報(bào)錯(cuò)并不會(huì)出現(xiàn)多次,當(dāng)?shù)诙芜_(dá)到MaxClients時(shí),error_log不會(huì)記錄。
還有一種可以實(shí)時(shí)看到連接數(shù)的方法,就是打開 server-status頁面,設(shè)置方法如下:
1. ?掉以下部分的注釋

LoadModule status_module modules/mod_status.so


ExtendedStatus On


2.修改以下部分


SetHandler server-status

# Order deny,allow

# Deny from all

Allow from all


重啟ihs
使用:http://www.tjdsmy.cn/server-status 可以進(jìn)入監(jiān)控頁面
如果瀏覽器支持刷新,可以http://www.tjdsmy.cn_host/server-status?refresh=5 以便每 5 秒鐘刷新一次

在打開的監(jiān)控頁面中:”.” Open slot with no current process,這里面的單個(gè)進(jìn)程的“.”的數(shù)量其實(shí)對應(yīng)與ThreadLimit這個(gè)值。


ThreadLimit 10

ServerLimit 2

StartServers 1

MaxClients 2

MinSpareThreads 1

MaxSpareThreads 2

ThreadsPerChild 1

MaxRequestsPerChild 1


httpd.conf的MPM配置如上例,在監(jiān)控頁面中的輸出如下,其中有2個(gè)進(jìn)程,各10個(gè)ThreadLimit,但由于ThreadsPerChild的限制,其實(shí)很多.是沒有用的。


提交成功!非常感謝您的反饋,我們會(huì)繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問題: