Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2004
    Posts
    198

    Apache not using all slots

    I have a strang problem with apache on my server. Basically this:

    Code:
    Current Time: Thursday, 31-Mar-2011 16:16:00 GMT 
    Restart Time: Thursday, 31-Mar-2011 16:08:15 GMT 
    Parent Server Generation: 0 
    Server uptime: 7 minutes 45 seconds 
    Total accesses: 50819 - Total Traffic: 1.6 GB 
    CPU Usage: u534.53 s396.66 cu0 cs0 - 200% CPU load 
    109 requests/sec - 3.4 MB/second - 32.2 kB/request 
    611 requests currently being processed, 54 idle workers 
    WKKWWWKW_CWWWWWWW__WRKWWWKWWWWWWWWWRW_W_WWK_WC.WWKWWWWWWCWWWRWW_
    WWWKWKCRW_WRWCWKWKWKW_KCWWWKCK_KWKWKWWWWWK_KWWK_KWWWRRWWKWKCWK__
    W_WKWRWWKKWKWWWWKKRCKKWWWWWWWWKWW_WWRKRWKKWWWWWWWWWWWWWKWWWWWKWW
    RW_WWWRWKCCWWW__C_KWCWKRRW__WRWWWKWWWWWCWWWWWKKWKW_RKRWWRCCWWWCK
    WCKWWWWWWWRKWRWWWWWW_WWWKWRWKW__WKWWWWWKWWCRW__KCKRRKWWWRRWWR_WW
    WW_WWWWWWWCWKWWWWKWCWWCWKWWWWWKWWWWWWWWWKWWWC_KRWWWRWWWWRRKWW_WW
    WWRWRWC_RWCWWCC_WCK_WRKWKWKWWRW_W_WWWRWKKW__W_KWWW_WCWRWKWWCWKWW
    WWWWCRKKKKWWKWWWWWWWWWKWK_CWWK_CWWWRCWW_WWWKKKWWW_WWKKWWWCKWWWKW
    WWWWWWWWWW_WWCWKKCKRWKWWCCWWWWWWKWWWWCWWWWWWWWK_WWWWWWKRWWCKWWWC
    WKKR_W_RWWWWCWWWWWWKC_WKWKWWKWCKK_KWWWWWW_KWWWKCWWWWWRRWWRW_WWRW
    WWRWWKWWWWCCK_WWWCCWWKWCRC......................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ..................................
    Code:
    Current Time: Thursday, 31-Mar-2011 16:18:11 GMT 
    Restart Time: Thursday, 31-Mar-2011 16:08:15 GMT 
    Parent Server Generation: 0 
    Server uptime: 9 minutes 56 seconds 
    Total accesses: 65732 - Total Traffic: 2.1 GB 
    CPU Usage: u687.99 s514.22 cu0 cs0 - 202% CPU load 
    110 requests/sec - 3.6 MB/second - 33.3 kB/request 
    515 requests currently being processed, 64 idle workers 
    .KCWK..WWWWW.WKK.._W._C.W_KK.WW_WWWC.WW.WW.WW..W.WWWWWK_W_.WW.WW
    W.W_R_.WW.WC.WC_W.WKW.C.WWKWCWK.KWWRW.R.WKWW_WK.WWWWW.RCWWWWKW..
    C.CWWCWW_.WW_K._W._.RKKKWCWCW_.W_KWW.WWKWRWKWKWWW_WRWW.CWWWRWWKR
    .WWWWWCW.W.KRWWWWWK.W_CWWW.WWWWWCR.W_.WW.WWWR_WW...W.KRWR_KW_WWC
    W.CWWKWKKRWK_._._W.RCCW.KWWWWCKKWCWK.WW.WW..W.C.CK.CW_KWWWWKWKKR
    _W.KWWW.WW.WWKWCW_KRCW.WKWWWCWKRKWW.W.WWCWCWWWKWWK_.WK.WWWW.WWWW
    _WC_C_KW._KWWW_RW._WW_WW.KCWWW_CK.WWWWWWRKW._.K.WKWWWWWKW.CK.KWW
    W_WWWWWW.RCW_WWC_RRWKRCW.WKWWWWWW_W.WWW.WCWWW.W_WCK_RRWRWKW_CWWK
    W_WKWW_W_KKWWWW__R.RRCCRCWRKWWKWWKWWCKKWWCCWWCW_RWCWWKW_C_CWRCWW
    W_WKKC_K_WKWRWWCW_CWRWWWWWW_WWWKRCWWCWWRKRW__WWKWWCCWRWCWRRWWR_W
    _CWWWKWKWWW_C_WKWRWWKWRWKW......................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ..................................
    Code:
    Current Time: Thursday, 31-Mar-2011 16:18:29 GMT 
    Restart Time: Thursday, 31-Mar-2011 16:08:15 GMT 
    Parent Server Generation: 0 
    Server uptime: 10 minutes 14 seconds 
    Total accesses: 67824 - Total Traffic: 2.2 GB 
    CPU Usage: u702.31 s527.03 cu0 cs0 - 200% CPU load 
    110 requests/sec - 3.6 MB/second - 33.7 kB/request 
    545 requests currently being processed, 19 idle workers 
    WWWWCWW_WRKKKWCWKKWWWRRRKRWKWWW_WWR..C_.WW.KW..W.W_WWKWWWW.W_.WK
    W.W.WW..W.KW.WK.R.WK..W.WWWRKWR.KRW.W.W.WCWKR...WWRWW.WRCWWCWK..
    W.WWWWWKW._W.W..W.W.WRWCWWRKWW.WWWCK._WKKKKCW.WKWWWW_W.CWWKWWWKC
    .WWCWWKW.W.WWWWWWWR.CC.WWW.KWKWC._.RC.WW.WRWWKWK...K.KWWCWWRWWR.
    W.CWWWW.C.http://WWW.R.KW.WCCW.WWWKWWWWRKCR.WW....CWWWWKWWKWWKW
    WK.WWWW.WW.W.CWKWWWCRW.WR.WWRW.WCWW.W.CWWRWRW.WWWWK.WW.WWWW.CKWW
    KWW_KWKW.__WCWKWW.RWWWWW.WWWWKWWK.WW_CWKWWW.W.W.WWW_WWWW..WK.KWW
    KWWK_KWW.RWWKCWWKW.WWWCW.WWRRWWWKWW.WWW.WWWWW.WCWWKKWWWRWWKR_WWW
    WWWWWRWW.KWWWWWKKW.WCCWWCWRWWWWWW_WWWWKWKWWWWWKRWWWWWR.WWWWWWWWW
    WWWKRWWKWWWKWKWCRKKKRWRWRWWWKWCWKRWWWWWRK_WWWWWWWRCWWWWW_WWWWKKK
    RWCWRWWWWWWKWWWWWWWWWCCWKW......................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ..................................
    Basically its not using all the slots available to it. its using exactly 686 out of 1250 slots

    I have set my maxclients as follows:
    <IfModule mpm_prefork_module>
    ServerLimit 1250
    MaxClients 1250
    StartServers 200
    MinSpareServers 40
    MaxSpareServers 200
    MaxRequestsPerChild 100
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 3
    </IfModule>

    Apache config is:

    My server config is as follows:
    Server version: Apache/2.2.15 (Unix)
    Server built: Jul 16 2010 14:25:41
    Cpanel::Easy::Apache v3.2.0 rev5152
    Server's Module Magic Number: 20051115:24
    Server loaded: APR 1.4.2, APR-Util 1.3.9
    Compiled using: APR 1.4.2, APR-Util 1.3.9
    Architecture: 32-bit
    Server MPM: Prefork
    threaded: no
    forked: yes (variable process count)
    Server compiled with....
    -D APACHE_MPM_DIR="server/mpm/prefork"
    -D APR_HAS_SENDFILE
    -D APR_HAS_MMAP
    -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
    -D APR_USE_SYSVSEM_SERIALIZE
    -D APR_USE_PTHREAD_SERIALIZE
    -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    -D APR_HAS_OTHER_CHILD
    -D AP_HAVE_RELIABLE_PIPED_LOGS
    -D DYNAMIC_MODULE_LIMIT=128
    -D HTTPD_ROOT="/usr/local/apache"
    -D SUEXEC_BIN="/usr/local/apache/bin/suexec"
    -D DEFAULT_PIDLOG="logs/httpd.pid"
    -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
    -D DEFAULT_LOCKFILE="logs/accept.lock"
    -D DEFAULT_ERRORLOG="logs/error_log"
    -D AP_TYPES_CONFIG_FILE="conf/mime.types"
    -D SERVER_CONFIG_FILE="conf/httpd.conf"

    Does anyone have any idea what could be causing this?

  2. #2
    Join Date
    Aug 2002
    Location
    Milton Keynes
    Posts
    354
    Yes, you have MinSpareServers set to 40, as such Apache will always try to keep between 40 and 200 workers free for new requests.

    I don't see what you think is bad about this... if you *didn't* have any free workers that would be a cause for concern.

  3. #3
    Join Date
    Jun 2004
    Posts
    198
    Thanks for the reply.

    Apache is keeping about half my 1250 slots free though, so would the spareservers settings cause over 600 slots to not be used?

  4. #4
    Spareservers is simply a setting that keeps a minimum or maximum amount of slots available, eg if one person connects you have one less slot available for other clients.
    If that one less slot means the number of spare servers is then below the minimum then more spare servers are added/started to keep the number of available slots between the min and max.

    So at any point in time you may have up to 200 spare slots not used but are available for use. If you are not using your total 1250 slots then you simply do not have that much traffic or resources available to hit your 1250 limit, it could be that apache is efficient enough in processing data fast enough that you are only hitting 50% of your max clients. (you do not want to hit maxclients)

    I do not see what is wrong here...

  5. #5
    Join Date
    Aug 2002
    Location
    Milton Keynes
    Posts
    354
    Maybe he's ignoring the fact that even Apache is saying he has between 19 and 64 idle workers (which is quite reasonable), I concur with Kevin.

  6. #6
    Join Date
    Jun 2004
    Posts
    198
    Quote Originally Posted by IDediServer Kevin View Post
    Spareservers is simply a setting that keeps a minimum or maximum amount of slots available, eg if one person connects you have one less slot available for other clients.
    If that one less slot means the number of spare servers is then below the minimum then more spare servers are added/started to keep the number of available slots between the min and max.

    So at any point in time you may have up to 200 spare slots not used but are available for use. If you are not using your total 1250 slots then you simply do not have that much traffic or resources available to hit your 1250 limit, it could be that apache is efficient enough in processing data fast enough that you are only hitting 50% of your max clients. (you do not want to hit maxclients)

    I do not see what is wrong here...
    Yes, I have max servers set to 200, but apache is NOT using almost 600 slots. I have a lot of traffic which is bottlenecking at peak times now because of this problem

    It was fine a couple of weeks ago and I havn't changed my config.

  7. #7
    Join Date
    Oct 2004
    Location
    Kerala, India
    Posts
    4,771
    The apache tries to generate the MinSpareServers number of servers when the server starts up and will increase the spare server amount to MaxSpareServers when it reach close to the MaxClients value requests. Why apache is doing this is because, at less number of hits, it anticipates less future requests. In case of large number of requests, it anticipates more number of future requests, so more spare servers are needed. But there is a limit, and that is MaxSpareServers.
    David | www.cliffsupport.com
    Affordable Server Management Solutions sales AT cliffsupport DOT com
    CliffWebManager | Access WHM from iPhone and Android

  8. #8
    I would not jump the gun and simply blame apache because connections are not showing up as you would expect.

    Are you seeing any reached max clients in your error log or similar? If not then tune apache, & sysctl further. Do you have any graphing setup to monitor your Req/Sec vs Current Apache Connections ? I would suggest you do that...

    Also make sure their are no kernel logs (dmesg or messages or system pending your flavor of linux) regarding syn flood detected, sending cookies or etc.
    Do you actually have monitors setup to test connectivity to port 80? If so then when alerts happen do your number of TCP sessions spike and if so what state are they in? What is your CPU/MEM/IOwait ?

Similar Threads

  1. Replies: 6
    Last Post: 09-11-2010, 08:27 AM
  2. Replies: 21
    Last Post: 08-22-2010, 05:59 PM
  3. Heaps of 'open slots' on Apache Status...is this normal? Please help!
    By Hostex Australia in forum Hosting Security and Technology
    Replies: 5
    Last Post: 01-10-2006, 09:52 AM
  4. Apache Server Status showing 32,000 open slots
    By davidarenson in forum Hosting Security and Technology
    Replies: 8
    Last Post: 06-16-2005, 11:56 AM
  5. Cheap Advertising Slots on Traffic Site Limited Slots Hurry
    By mfk1868 in forum Other Offers & Requests
    Replies: 0
    Last Post: 03-12-2005, 10:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •