apache運行過程中報MaxClients setting錯誤問題處理

來源:互聯網
上載者:User

標籤:apache prefork maxclient

    apache在啟動並執行過程中,錯誤記錄檔中出現如下一段報錯資訊

[error] server reached MaxClients setting, consider raising the MaxClients setting

檢查apache的版本

[[email protected] logs]# httpd -vServer version: Apache/2.2.31 (Unix)Server built:   May 26 2016 01:33:18

查看apache工作模型,可以看以prefork.c

[[email protected] logs]# apachectl -lCompiled in modules:  core.c  mod_authn_file.c  mod_authn_dbm.c  mod_authn_anon.c  mod_authn_dbd.c  mod_authn_default.c  mod_authz_host.c  mod_authz_groupfile.c  mod_authz_user.c  mod_authz_dbm.c  mod_authz_owner.c  mod_authz_default.c  mod_auth_basic.c  mod_auth_digest.c  mod_dbd.c  mod_dumpio.c  mod_reqtimeout.c  mod_ext_filter.c  mod_include.c  mod_filter.c  mod_substitute.c  mod_deflate.c  mod_log_config.c  mod_logio.c  mod_env.c  mod_expires.c  mod_headers.c  mod_ident.c  mod_setenvif.c  mod_version.c  prefork.c  http_core.c  mod_mime.c  mod_dav.c  mod_status.c  mod_autoindex.c  mod_asis.c  mod_info.c  mod_cgi.c  mod_dav_fs.c  mod_vhost_alias.c  mod_negotiation.c  mod_dir.c  mod_imagemap.c  mod_actions.c  mod_speling.c  mod_userdir.c  mod_alias.c  mod_rewrite.c  mod_so.c

apache中MaxClient設定是在apache工作目錄下的conf/extra/httpd-mpm.conf

prefork模型的預設設定如下,最在串連數只 150,遠遠無法滿足生產需求

<IfModule mpm_prefork_module>    StartServers          5    MinSpareServers       5    MaxSpareServers      10    MaxClients          150    MaxRequestsPerChild   0</IfModule>

     StartServers:初始啟動進程數

     MinSpareServers:最小閑置進程數

     MaxSpareServers:最大閑置進程數

     MaxClients:最大用戶端串連數

     MaxRequestsPerChild:每個子進程可處理的請求數,0為不限制

修改為如下:

<IfModule mpm_prefork_module>    StartServers          10    MinSpareServers       10    MaxSpareServers      15    ServerLimit         2000    MaxClients          1000    MaxRequestsPerChild   10000</IfModule>

如果是worker模型,初始設定為:

<IfModule mpm_worker_module>    StartServers          2    MaxClients          150    MinSpareThreads      25    MaxSpareThreads      75    ThreadsPerChild      25    MaxRequestsPerChild   0</IfModule>

可修改為如下:

<IfModule mpm_worker_module>    ThreadLimit        200    ServerLimit        25    StartServers        3    MaxClients         2000    MinSpareThreads      50    MaxSpareThreads      200    ThreadsPerChild      100    MaxRequestsPerChild     0</IfModule>

MaxClients必須是ThreadsPerChild的整數倍,ThreadsPerChild*ServerLimit必須大於MaxClients

修改完成後重啟apache服務

本文出自 “sunny” 部落格,請務必保留此出處http://francis198.blog.51cto.com/720670/1852562

apache運行過程中報MaxClients setting錯誤問題處理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.