The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MaxClients adjustment and other tweaks

Discussion in 'General Discussion' started by djblamire, Sep 20, 2008.

  1. djblamire

    djblamire Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    16
    Optimization Assistance Required (MaxClients??) and other tweaks

    I'm looking to adjust the apache settings on my server to try and optimize as much as possible.

    I am running a server with the following spec:

    Intel(R) Pentium(R) D CPU 2.80GHz
    1 GB RAM

    Running primarily a fairly large website running Apache and MySQL.

    I vaguely remember making changes to MaxClients and other settings, which helped previously, but recently had a new hard drive and have had to set up again.

    What's the best way to work out what the settings should ideally be for my hardware, etc ??

    Thanks in advance,

    Daniel
     
    #1 djblamire, Sep 20, 2008
    Last edited: Sep 20, 2008
  2. djblamire

    djblamire Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    16
    Thought it would probably best to give you some more details on what everything looks like when overloaded:

    Code:
    Output from vmstat:
    procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
     r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
    30  0   4852  64532  66444 282732    0    0    13    36   46    31 26  3 69  1
    
    
    The header information from the Apache Server Status at the time:

    Code:
    Apache Server Status for 127.0.0.1
    
    Server Version: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7f mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.6
    Server Built: Jul 5 2008 16:59:37
    Current Time: Friday, 19-Sep-2008 10:44:35 BST
    Restart Time: Monday, 15-Sep-2008 05:25:03 BST
    Parent Server Generation: 4
    Server uptime: 4 days 5 hours 19 minutes 32 seconds
    Total accesses: 5579691 - Total Traffic: 20.2 GB
    CPU Usage: u116.97 s15.81 cu8.97 cs0 - .0389% CPU load
    15.3 requests/sec - 58.0 kB/second - 3885 B/request
    170 requests currently being processed, 32 idle workers
    CWW.KWWKWWWK_KWWW_C_WWWKW.W.W.WKK_KWKK_KKW..WKKW_WKW_WW..WWWWKKK
    K.KWWW..C.WC.WKWW._CK.CKKWW.K_CKKKWW..__WKKKK_KWK_.WK._WW_.KW..K
    .CKKWKW.K.K.W_WW.WKKK.WKCKK.._K.W_K_.WKWW.KWK.C.._K.KWW__._K.KKC
    WCK..WK__.C.._W.CWK._WWKKKWW.W.KW.__CW._KWWCKK._WC.WCWWW.K_WKWKK
    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
    
    I've had to attach the output from ps (due to the size)

    Any help appreciated,

    Thanks
    Daniel
     

    Attached Files:

    • ps.txt
      File size:
      34 KB
      Views:
      28
  3. djblamire

    djblamire Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    16
    Anyone any ideas ?

    Thanks in advance,

    Daniel
     
  4. djblamire

    djblamire Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    16
    Is anyone able to help ?? :confused:

    Thanks in advance,

    Daniel
     
  5. mhkstr

    mhkstr Member

    Joined:
    Feb 29, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    waiting for replay

    i have same problem as you.

    can some one please reply to this post.
     
  6. rrwh

    rrwh Well-Known Member

    Joined:
    Oct 2, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    With only 1 Gig of RAM I would start by making sure MySQL is set up exactly as required by your current server/load.

    google "tuning-primer.sh" install and run this script and follow the recommendations - it will typically take 2 weeks to properly tune a MySQL server for optimum performance.

    Tuning the MySQL config is something that will take you quite some time if you have never done it before - you need to be extra careful in order not to break things.

    Get this right, then additionally monitor your apache server-status output to determine how many threads you use over time. from the info shown you are processing 177 requests - so max-clients needs to be at least 200, probably more like 250.

    Are you using a lot of swap?

    ssh in and run "free" to see how the memory is being used.

    With a site this busy, I would suggest that it is worthwhile to add more RAM to your server - if you are running a 32Bit OS put in another 2 Gig to bring it up to 3, if you are running a 64 Bit OS start by bringing it up to 4Gig and add more if required.
     
  7. smartads

    smartads Member

    Joined:
    Dec 19, 2008
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    I had the same problem as you before...

    1) you need to make sure to use proper indexes with all of your tables and see if your open tables in SHOW VARIABLES in MySQL is not too large.

    If your visitor usage is opening too many tables, and your system can't handle the load, you MUST atleast add another 1GB-5GB of RAM to your 1GB memory. I recommend having around 6GM RAM for over usage and ensuring any heavy-intense scripts are not overloading your memory while being processed.

    2) Make sure to fine tune my.cnf to better handle traffic load.

    3) Disable any unwanted services from your server which take up memory while loading.

    4) Here are a couple of great tutorials I found while dealing with this issue:

    CPU Overload:
    http://proxy.org/forum/1157064276.all.html

    Fine Tune Apache/MySql:
    http://shabuz.wordpress.com/2008/06/15/how-to-tune-apache/

    Optimizing MySql Hardware:
    http://www.databasejournal.com/feat...g-MySQL-Hardware-and-the-Mysqld-Variables.htm

    http://www.databasejournal.com/feat...g-MySQL-Hardware-and-the-Mysqld-Variables.htm


    ^^ Those topics should keep you busy in fine-tunning your machine for better performance with large traffic & large databases.

    My initial recommendation of increasing your RAM along with the same recommendation from "rrwh" is exactly what you need to keep in the game.

    Cheers!

    Martin Lemieux
     

Share This Page