Server limit and max clients

Discussion in 'Apache' started by ASTRAPI, Mar 1, 2011.

  1. #1
    Hello

    I need some help please to set the values for server limit and max clients so my server can accept more users/connections.

    My server:

    2x Intel Xeon Quad 5405
    16 GB DDR2 RAM

    And i use apache and prefork - (default prefork settings)

    apache settings:

    StartServers 15
    MinSpareServers 15
    MaxSpareServers 25
    ServerLimit 512
    MaxClients 384
    MaxRequestsPerChild 1000
    KeepAlive on
    KeepAliveTimeout 3
    MaxKeepAliveRequests 100
    TimeOut 100


    and i test it also with keep alive off.

    I use only one account on my cpanel server (one forum only inside) and i use nginx in front of apache as proxy.

    From the top i have about 6gb ram free.

    Can you please help me to adjust it a bit so i will be able to handle more users/connections?

    Thank you
     
    ASTRAPI, Mar 1, 2011 IP
  2. MCpap

    MCpap Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You should be golden with:

     
    MCpap, Mar 6, 2011 IP
  3. ASTRAPI

    ASTRAPI Guest

    Messages:
    500
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This is what i can see for apache status when i have many users online:



    Current Time: Sunday, 06-Mar-2011 22:17:01 EET
    Restart Time: Wednesday, 02-Mar-2011 00:41:16 EET
    Parent Server Generation: 14
    Server uptime: 4 days 21 hours 35 minutes 45 seconds
    Total accesses: 4720738 - Total Traffic: 422.0 GB
    CPU Usage: u622.74 s40.01 cu0 cs0 - .157% CPU load
    11.2 requests/sec - 1.0 MB/second - 93.7 kB/request
    6 requests currently being processed, 226 idle workers

    ____..__._._.______________._____...__.____.__.__.___...__..C_._
    ____W_..__.____.._.._..____._______...__.___.___.._W._..___.____
    ._..._.__._____W___.___.__..__.___.____..._.__._.___._.______.__
    __.._._._.___.___.__._..___.___._____W_W_.._..____.._____.______
    ._____...__.__.___.____.._______.___.____________._.__._.__.____
    _____.._...__...................................................
    ................................................................
    ................................................................

    Scoreboard Key:
    "_" Waiting for Connection, "S" Starting up, "R" Reading Request,
    "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
    "C" Closing connection, "L" Logging, "G" Gracefully finishing,
    "I" Idle cleanup of worker, "." Open slot with no current process

    Keep alive off


    I have many waiting and many idle and i don't know if it is normal as with this stats i got a spike on the server load for a few seconds and then is ok.

    226 idle workers i think are a lot.

    I can see also x3 of these compared with the normal usage after or before a few seconds.


    /usr/local/apache/bin/httpd -k start -DSSL


    ?
     
    ASTRAPI, Mar 6, 2011 IP
  4. Natcoweb

    Natcoweb Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Do you have problems with site responsiveness and load time?
    It seems that 226 idle is a lot.

    To calculate the optimal MaxClients value, look how match httpd processes now and what value size means there (column RSS in ps output):
    ps -ylC httpd --sort:rss

    Then look at the current free memory. Part of free memory should be saved for other services.
    MaxClients = The remainder of the free memory is divided by mean value http proccess size

    Also check monitoring system parameters like CPU and disks on the server load moment, for example with top, vmstat, iotop utility to find possible bottlenecks.
     
    Natcoweb, Mar 9, 2011 IP
  5. ASTRAPI

    ASTRAPI Guest

    Messages:
    500
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Not at all.

    And this is why i am looking for 356 idle workers why the server start so many for a few seconds.

    Also i notice at this time that my firewall csf is using a lot of cpu to check all ip's for more than 300 connections to ban them.
     
    ASTRAPI, Mar 9, 2011 IP
  6. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #6
    KeepAlive On
    MaxKeepAliveRequests 150
    KeepAliveTimeout 5
    <IfModule prefork.c>
      StartServers 20
      MinSpareServers 20
      MaxSpareServers 40
      ServerLimit 450
      MaxClients 450
      MaxRequestsPerChild 1000
    </IfModule>
    <IfModule worker.c>
      ServerLimit 18
      StartServers 8
      MinSpareThreads 25
      MaxSpareThreads 75
      ThreadsPerChild 25
      MaxClients 450
      MaxRequestsPerChild 1000
    </IfModule>
    Timeout 300
    
    Code (markup):
     
    zacharooni, Mar 10, 2011 IP
  7. Natcoweb

    Natcoweb Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You may to watch the server in top utility to see what process is up to when you believe performance is being affected. IF it is, then you'll need to tweak csf.conf appropriately to check ip-address's less and/or frequently. Or you may write iptables+ipset rules for this task.
     
    Natcoweb, Mar 11, 2011 IP