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.

The best apache2 configuration

Discussion in 'EasyApache' started by duranduran, Mar 29, 2008.

  1. duranduran

    duranduran Well-Known Member

    Joined:
    Apr 30, 2004
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Hi cpanel gurus,

    I am trying to improve the performance of the apache2, but i have a lot of difficulties/complains. I have a server with approximately 680 domains and with a lot of use from PHP scripts and httpd/www accesses.

    I verify that my apache configuration "holds " the performance of the Apache2.2. The load is not very loud, the load is approximately 2, 3 with picks of 7 some times (when backup and cpanellogd are running).

    Which the best configuration of the apache2?

    I am using this in my httpd.conf:

    Code:
    KeepAlive On
    MaxKeepAliveRequests 64
    KeepAliveTimeout 1
    UseCanonicalName Off
    HostnameLookups Off
    ServerTokens Prod
    ServerLimit 1000
    
    <IfModule worker.c>
        ThreadLimit 90
        StartServers 30
        MaxClients 600
        MinSpareThreads 50
        MaxSpareThreads 90
        ThreadsPerChild 60
        MaxRequestsPerChild 64
    </IfModule>
    My compiled modules:

    [root@node ~]# httpd -l
    Compiled in modules:
    core.c
    mod_authn_file.c
    mod_authn_default.c
    mod_authz_host.c
    mod_authz_groupfile.c
    mod_authz_user.c
    mod_authz_default.c
    mod_auth_basic.c
    mod_include.c
    mod_filter.c
    mod_log_config.c
    mod_logio.c
    mod_env.c
    mod_expires.c
    mod_headers.c
    mod_unique_id.c
    mod_setenvif.c
    mod_ssl.c
    worker.c
    http_core.c
    mod_mime.c
    mod_status.c
    mod_autoindex.c
    mod_asis.c
    mod_info.c
    mod_suexec.c
    mod_cgid.c
    mod_negotiation.c
    mod_dir.c
    mod_actions.c
    mod_userdir.c
    mod_alias.c
    mod_rewrite.c
    mod_so.c

    See my apache stats:

    Server Version: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
    Server Built: Mar 23 2008 02:35:19

    Current Time: Saturday, 29-Mar-2008 03:10:53 BRT
    Restart Time: Saturday, 29-Mar-2008 02:01:32 BRT
    Parent Server Generation: 29
    Server uptime: 1 hour 9 minutes 20 seconds
    Total accesses: 28567 - Total Traffic: 524.9 MB
    CPU Usage: u.71 s1.88 cu34.16 cs0 - .883% CPU load
    6.87 requests/sec - 129.2 kB/second - 18.8 kB/request
    20 requests currently being processed, 100 idle workers


    _______________________KCKK_CK_W_KKKKKKR____________________....
    ..........................KWWKKW________________________________
    ______________________...................................R......
    ................................................................
    ...................................................W............
    ................................................................
    ................................................................
    ......................................................W.........
    ..................................W.............................
    ................................................................
    .............................................W..................
    ................................................................
    .............................................C..................
    C.......W.......................................................


    Note: i have hundreds of this lines (open slots with no current process):

    ................................................................


    I am using suphp, WHM 11.15.0 cPanel 11.18.3-R21703 with REDHAT Enterprise 4 i686 on standard - WHM X v3.1.0

    Which is the best module: prefork or worker? Which is the best apache configuration?
     
  2. Fernis

    Fernis Well-Known Member

    Joined:
    Oct 28, 2006
    Messages:
    192
    Likes Received:
    1
    Trophy Points:
    18
    I have a similar setup on some of my servers and would be interested in knowing the opinion of the cpanel guru's as well.
     
  3. duranduran

    duranduran Well-Known Member

    Joined:
    Apr 30, 2004
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    I bealive that worker is the best module for my condition at this moment...
     
  4. duranduran

    duranduran Well-Known Member

    Joined:
    Apr 30, 2004
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Well, until this moment i am testing this:

    Code:
    KeepAlive On
    MaxKeepAliveRequests 64
    KeepAliveTimeout 2
    UseCanonicalName Off
    HostnameLookups Off
    ServerTokens Prod
    
    ServerLimit 700
    <IfModule worker.c>
        StartServers 30
        MaxClients 550
        MinSpareThreads 30
        MaxSpareThreads 100
        ThreadsPerChild 55
        MaxRequestsPerChild 64
    </IfModule>
    This is the best configuration at this moment.

    What do you think?
     
  5. extrahost

    extrahost Member

    Joined:
    May 17, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I didn't understand that explanation..

    in which files modify value go 'keepalive' and others goes Apache 2.2
    in the Apache 1.3 it is in httpd.conf in the Apache 2.2 didn't find..

    can the DURAN DURAN of help myself?
     
  6. duranduran

    duranduran Well-Known Member

    Joined:
    Apr 30, 2004
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Is the same file: /etc/httpd/conf/httpd.conf
     
  7. Silent Ninja

    Silent Ninja Well-Known Member

    Joined:
    Apr 18, 2006
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Buenos Aires, Argentina
    This is the settings file i'm using on our Apache2 webservers, it's almost the same as you've posted in here, with some small modifications and addons:

    Code:
    KeepAlive On
    Timeout 15
    MaxKeepAliveRequests 64
    KeepAliveTimeout 1
    MinSpareServers 5
    MaxSpareServers 15
    StartServers 15
    MaxClients 256
    MaxRequestsPerChild 64
    HostNameLookups Off
    ServerTokens Prod
    ServerSignature Off
    UseCanonicalName Off
    ServerLimit 1000
    Although as the httpd.conf gets overriten sometimes, I've putted these in the file:
    /usr/local/apache/conf/includes/pre_virtualhost_global.conf
     
  8. Zion Ahead

    Zion Ahead Well-Known Member

    Joined:
    Nov 10, 2006
    Messages:
    347
    Likes Received:
    0
    Trophy Points:
    16

    No it is not found there by default in Apache 2.2. How do you figure?
     
  9. duranduran

    duranduran Well-Known Member

    Joined:
    Apr 30, 2004
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Do you have root access ?
     
  10. Zion Ahead

    Zion Ahead Well-Known Member

    Joined:
    Nov 10, 2006
    Messages:
    347
    Likes Received:
    0
    Trophy Points:
    16
    I do , yes.
     
  11. djmerlyn

    djmerlyn Well-Known Member

    Joined:
    Aug 31, 2004
    Messages:
    203
    Likes Received:
    1
    Trophy Points:
    16
    This might seem a little redundant putting values that are already set as default in httpd.conf

    Also, why have keepalive on and keepalivetimeout 1? Why not turn it off and shave off that 1 extra second per process, or leave it on and at the default of 15 so atleast it has the potential of being used?

    The one that really gets me, is:

    maxclients 256
    ServerLimit 1000

    It would appear that you are allocating more memory to the cause then is necessary, I guess depending on your particular compilation of apache...

    http://httpd.apache.org/docs/2.0/mod/mpm_common.html#serverlimit

    I think the best route for this, is to know your server and your own compiled modules, refer to the docs for explainations, and tune as a part of daily admin duties. I'm pretty sure that 1 size indeed does not fit all.

    But this thread was motivation for a nice refresher of the apache 2 config. I am curious how folks are getting along using some of the optional modules (worker, leader, etc...)?
     
    #11 djmerlyn, May 13, 2008
    Last edited: May 13, 2008
  12. Zwer

    Zwer Registered

    Joined:
    May 25, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Server Version: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8b mod_bwlimited/1.4 PHP/5.2.6
    Server Built: Sep 23 2008 15:17:43

    Current Time: Sunday, 19-Oct-2008 11:50:10 MSD
    Restart Time: Tuesday, 14-Oct-2008 14:26:15 MSD
    Parent Server Generation: 3
    Server uptime: 4 days 21 hours 23 minutes 55 seconds
    Total accesses: 6971092 - Total Traffic: 9.7 GB
    CPU Usage: u3.35 s1.02 cu0 cs0 - .00103% CPU load
    16.5 requests/sec - 24.0 kB/second - 1489 B/request
    42 requests currently being processed, 5 idle workers

    .KKKKC...K.K..K.KKR.....CKC.CKW...K_KK.KK.WK..K..KCC...K...KCK.K
    K.K..KK.KK.K.K.____K............................................
    ................................................................
    ................................................................




    )))))))))

    I am use standart config ))
     
Loading...

Share This Page