国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Apache MPM worker中的幾個參數(shù)

     最近發(fā)現(xiàn)自己是個干雜活兒的人,因此把本博的名字都改成了“不求甚解”,純粹都為了解決眼前的問題,這樣的工作方式已經(jīng)完完全全背離了自己的習慣。廢話少說,切入正題,最近對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 每個子進程建立的線程數(shù),子進程在啟動時建立這些線程后就不再建立新的線程了
  2. ##MaxClients 允許同時伺服的最大接入請求數(shù)量(在worker下就是最大線程數(shù)量)
    1. ##ServerLimit:對最大子進程數(shù)的上限,該值必須大于等于MaxClients/ThreadsPerChild
    2. ##ThreadLimit:對ThreadsPerChild的上限,該值必須大于等于 ThreadsPerChild,如果將ThreadLimit設(shè)置成一個高出實際需要很多的ThreadsPerChild值,將會有過多的共享內(nèi)存被 分配,應(yīng)當和ThreadsPerChild可能達到的最大值保持一致.
    3. ##StartServers:服務(wù)器啟動時的服務(wù)進程數(shù)目,該值肯定小于等于ServerLimit
    4. ##MinSpareThreads和MaxSpareThreads:通過新建或結(jié)束子進程的方式,將空閑線程的總數(shù)維持在這個范圍內(nèi)
    5. ##MaxRequestsPerChild:用于控制服務(wù)器建立新進程和結(jié)束舊進程的頻 率,其實是一個為了防止內(nèi)存溢出的參數(shù),每個子進程在其生存期內(nèi)允許伺服的最大請求數(shù)量。到達MaxRequestsPerChild的限制后,子進程將 會結(jié)束。對于KeepAlive鏈接,只有第一個請求會被計數(shù)。事實上,它改變了每個子進程限制最大鏈接數(shù)量的行為。
    可以通過檢查HTTPServer/logs/error_log日志,判斷MaxClients是否需要增加,如果有下面的報錯,就說明apache自上次重啟至今,曾經(jīng)發(fā)生過達到MaxClients的情況:

    1. Tue Jun 07 16:36:03 2011] [error] server reached MaxClients setting, consider raising the MaxClients setting
需要注意的是,這樣的報錯并不會出現(xiàn)多次,當?shù)诙芜_到MaxClients時,error_log不會記錄。
還有一種可以實時看到連接數(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 可以進入監(jiān)控頁面
如果瀏覽器支持刷新,可以http://your_host/server-status?refresh=5 以便每 5 秒鐘刷新一次

在打開的監(jiān)控頁面中:"." Open slot with no current process,這里面的單個進程的“.”的數(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個進程,各10個ThreadLimit,但由于ThreadsPerChild的限制,其實很多.是沒有用的。
  1. W........._.........
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Apache Prefork和Worker模式的性能比較測試
Windows 系統(tǒng)下的Apache性能優(yōu)化 - 火魔網(wǎng)
apache 性能 調(diào)優(yōu)
apache調(diào)優(yōu)
Apache服務(wù)器訪問過慢分析及解決
修改最大并發(fā)連接數(shù)
更多類似文章 >>
生活服務(wù)
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服