亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1279 | 回復(fù): 0
打印 上一主題 下一主題

Apache MPM worker中的幾個參數(shù) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-12-21 08:44 |只看該作者 |倒序?yàn)g覽
      最近發(fā)現(xiàn)自己是個干雜活兒的人,因此把本博的名字都改成了“不求甚解”,純粹都為了解決眼前的問題,這樣的工作方式已經(jīng)完完全全背離了自己的習(xí)慣。廢話少說,切入正題,最近對Apache中的一些參數(shù)做了些了解,下面就記錄一下我的理解。

  1. # worker MPM
  2. # ThreadLimit: maximum setting of ThreadsPerChild
  3. # ServerLimit: maximum setting of StartServers
  4. # StartServers: initial number of server processes to start
  5. # MaxClients: maximum number of simultaneous client connections
  6. # MinSpareThreads: minimum number of worker threads which are kept spare
  7. # MaxSpareThreads: maximum number of worker threads which are kept spare
  8. # ThreadsPerChild: constant number of worker threads in each server process
  9. # MaxRequestsPerChild: maximum number of requests a server process serves
  10. <IfModule worker.c>
  11. ThreadLimit 125
  12. ServerLimit 320
  13. StartServers 5
  14. MaxClients 8000
  15. MinSpareThreads 125
  16. MaxSpareThreads 1250
  17. ThreadsPerChild 125
  18. MaxRequestsPerChild 1000
  19. </IfModule>
其中最重要的參數(shù)是 ThreadsPerChild和 MaxClients:
  1. ##ThreadsPerChild 每個子進(jìn)程建立的線程數(shù),子進(jìn)程在啟動時建立這些線程后就不再建立新的線程了
  2. ##MaxClients 允許同時伺服的最大接入請求數(shù)量(在worker下就是最大線程數(shù)量)
    1. ##ServerLimit:對最大子進(jìn)程數(shù)的上限,該值必須大于等于MaxClients/ThreadsPerChild
    2. ##ThreadLimit:對ThreadsPerChild的上限,該值必須大于等于 ThreadsPerChild,如果將ThreadLimit設(shè)置成一個高出實(shí)際需要很多的ThreadsPerChild值,將會有過多的共享內(nèi)存被 分配,應(yīng)當(dāng)和ThreadsPerChild可能達(dá)到的最大值保持一致.
    3. ##StartServers:服務(wù)器啟動時的服務(wù)進(jìn)程數(shù)目,該值肯定小于等于ServerLimit
    4. ##MinSpareThreads和MaxSpareThreads:通過新建或結(jié)束子進(jìn)程的方式,將空閑線程的總數(shù)維持在這個范圍內(nèi)
    5. ##MaxRequestsPerChild:用于控制服務(wù)器建立新進(jìn)程和結(jié)束舊進(jìn)程的頻 率,其實(shí)是一個為了防止內(nèi)存溢出的參數(shù),每個子進(jìn)程在其生存期內(nèi)允許伺服的最大請求數(shù)量。到達(dá)MaxRequestsPerChild的限制后,子進(jìn)程將 會結(jié)束。對于KeepAlive鏈接,只有第一個請求會被計數(shù)。事實(shí)上,它改變了每個子進(jìn)程限制最大鏈接數(shù)量的行為。
    可以通過檢查HTTPServer/logs/error_log日志,判斷MaxClients是否需要增加,如果有下面的報錯,就說明apache自上次重啟至今,曾經(jīng)發(fā)生過達(dá)到MaxClients的情況:

    1. Tue Jun 07 16:36:03 2011] [error] server reached MaxClients setting, consider raising the MaxClients setting
需要注意的是,這樣的報錯并不會出現(xiàn)多次,當(dāng)?shù)诙芜_(dá)到MaxClients時,error_log不會記錄。
還有一種可以實(shí)時看到連接數(shù)的方法,就是打開 server-status頁面,設(shè)置方法如下:
1. 去掉以下部分的注釋
  1. LoadModule status_module modules/mod_status.so
  2. <IfModule mod_status.c>
  3. ExtendedStatus On
  4. </IfModule>
2.修改以下部分
  1. <Location /server-status>
  2.     SetHandler server-status
  3.   # Order deny,allow
  4.   # Deny from all
  5.     Allow from all
  6. </Location>
重啟ihs
使用:http://yourhost/server-status 可以進(jìn)入監(jiān)控頁面
如果瀏覽器支持刷新,可以http://your_host/server-status?refresh=5 以便每 5 秒鐘刷新一次

在打開的監(jiān)控頁面中:"." Open slot with no current process,這里面的單個進(jìn)程的“.”的數(shù)量其實(shí)對應(yīng)與ThreadLimit這個值。
  1. <IfModule worker.c>
  2. ThreadLimit 10
  3. ServerLimit 2
  4. StartServers 1
  5. MaxClients 2
  6. MinSpareThreads 1
  7. MaxSpareThreads 2
  8. ThreadsPerChild 1
  9. MaxRequestsPerChild 1
  10. </IfModule>
httpd.conf的MPM配置如上例,在監(jiān)控頁面中的輸出如下,其中有2個進(jìn)程,各10個ThreadLimit,但由于ThreadsPerChild的限制,其實(shí)很多.是沒有用的。
  1. W........._.........
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP