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.

Apache Slow

Discussion in 'EasyApache' started by RomainB, May 4, 2008.

  1. RomainB

    RomainB Member

    Joined:
    Dec 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    Hello,

    I have bit problems with Apache on my server. It's a bit slow sometimes. But the rest of the server (Cpanel, Mysql, Mail...) works perfectly... I think that I must make Adjustements for Apache... But I don't know how, so can you help me ?
    I have around 250-290 users connecting in the same time.

    I hope that you will can help me.

    Regards
     
  2. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    How much memory is on the system? Make sure you have built apache with prefork, then check your values for the below:

    StartServers
    MinSpareServers
    MaxSpareServers
    ServerLimit
    MaxClients
    MaxRequestsPerChild
     
  3. RomainB

    RomainB Member

    Joined:
    Dec 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    RAM : 4 GB

    I have this :

    StartServers : 5
    MinSpareServers : 5
    MaxSpareServers : 10
    MaxClients : 150
    MaxRequestsperChild : 0

    I must change MaxClients ?
     
  4. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    Yes, start increasing your max clients, let it run for a couple of days, then make more changes as needed. Do you run mysql with this site as well, if so, that would need some tweaking.
     
  5. RomainB

    RomainB Member

    Joined:
    Dec 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    I have this message when I try to restart Apache :

    MaxClients of 400 exceeds ServerLimit value of 256 servers,
    lowering MaxClients to 256. To increase, please see the ServerLimit
    directive.

    Can you help me ?

    EDIT : I increased to 256, it's more faster but it's possible to increase more ?
     
    #5 RomainB, May 4, 2008
    Last edited: May 4, 2008
  6. RomainB

    RomainB Member

    Joined:
    Dec 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    Can you help me ?
     
  7. freedog96150

    freedog96150 Well-Known Member

    Joined:
    Mar 25, 2005
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Nevada, USA
    if you are running Apache 2.x make sure that after every change to your httpd.conf file you run the following commands:

    Code:
    /usr/local/cpanel/bin/apache_conf_distiller --update --main
    /usr/local/cpanel/bin/build_apache_conf
    
    otherwise your changes may get blown away with the next cpanel update. If you are running Apache 1.x then do not worry about this. Just trying to save some of your blood, sweat and tears when you finally find the magic combination.

    I run Apache at default settings. My bottle necks are always Mysql and poorly written PHP scripts that users insist on running.
     
  8. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36

    Increase your server limit value to slightly above the value of MaxClients and you will be fine. You may want to add these values to try:

    <IfModule worker.c>
    StartServers 14
    ServerLimit 448
    MaxClients 400
    MinSpareThreads 10
    MaxSpareThreads 20
    ThreadsPerChild 64
    MaxRequestsPerChild 4000
    </IfModule>

    into
    /usr/local/apache/conf/pre_virtualhost_global.conf

    This way they overwrite the original values of httpd.conf and you don't have to worry about them being changed.
     
  9. RomainB

    RomainB Member

    Joined:
    Dec 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Ok thank you and I can write this in httpd.conf ?

    If I want to increase to 600, I must write what ?
     
  10. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36

    Just add this:

    <IfModule worker.c>
    StartServers 14
    ServerLimit 650
    MaxClients 600
    MinSpareThreads 10
    MaxSpareThreads 20
    ThreadsPerChild 64
    MaxRequestsPerChild 4000
    </IfModule>

    INTO this file:
    /usr/local/apache/conf/includes/pre_virtualhost_global.conf

    Do not edit httpd.conf, theres no need to. Thats what these include files are for. I see I did not provide you the full file location so that may have been confusing. ANyway, just use the include files and then restart apache.
     
  11. RomainB

    RomainB Member

    Joined:
    Dec 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    Thank you for your help :)

    It's working but my server is very slow sometimes... I think that I want to do adjustements on Apache and Mysql Server but I don't know know... (My website is a Paid To click website).

    Do you know what configurations I can do ?

    Thank advance for your answer.

    Regards

    EDIT : I think that it's Mysql Server which is slowly... mysql CPU : 164.67%...
     
    #11 RomainB, May 7, 2008
    Last edited: May 7, 2008
  12. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    Yep, it seems you could use a bit more horse power to serve up mysql more efficiently. The next step up would be remote mysql and then perhaps a mysql cluster and linux cluster which would require several servers to work in unison.

    Tweaking my.cnf may or may not help. You first need to find out why querys are being backed up. Is it from being overloaded or perhaps just some heavy querys. Slow-query logging would help show the querys taking a long time to process etc..

    There are too many variables to consider without a proper audit.
     
  13. kris1351

    kris1351 Well-Known Member

    Joined:
    Apr 18, 2003
    Messages:
    963
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Lewisville, Tx
    Optimizing your MySQL will help more than anything. There are some guides on baseline my.cnf configs here on the forums that will be a good start for you. More horsepower isn't always the answer, good code is usually a better option.
     
  14. MMarko

    MMarko Well-Known Member

    Joined:
    Apr 18, 2005
    Messages:
    316
    Likes Received:
    0
    Trophy Points:
    16
    I have noticed that to get new ServerLimit you need to stop and start apache not just restart it (prefork module, apache 2.2.8). Hope this will be useful for someone.
     
Loading...

Share This Page