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 optimization on new server setup

Discussion in 'Workarounds and Optimization' started by sahithp, Nov 7, 2012.

  1. sahithp

    sahithp Member

    Joined:
    Jun 13, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I just got new server from iweb with following configuration

    Dual Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz (24 cpus)
    16GB RAM
    2x SAS2 15K RPM 300GB on RAID1

    I think this server can handle 3000+ concurrent online visitors at a time. But dont know what went wrong. Whenever i get around 1000 visitors online, APACHE seems to be unresponsive and will take 4-5minutes to get recovered.

    Here are the Apache config file (httpd.conf) where i have changed some parameters

    Code:
    Timeout 300
    TraceEnable On
    ServerSignature Off
    ServerTokens Full
    FileETag All
    StartServers 5
    <IfModule prefork.c>
    MinSpareServers 5
    MaxSpareServers 10
    </IfModule>
    MaxRequestsPerChild 10000
    KeepAlive On
    KeepAliveTimeout 5
    MaxKeepAliveRequests 100
    And added following lines to Service Configuration » Apache Configuration » Include Editor » Pre VirtualHost Include


    Code:
    <IfModule prefork.c>
    ServerLimit 2048
    MaxClients 2048
    </IfModule>
    
    Following is the Mysql config file (/etc/my.cnf)...

    Code:
    [mysqld]
    thread_cache_size = 2
    query_cache_size = 32M
    table_cache = 512
    max_connections = 1500
    Do any one here can suggest me some good values to match server capacity.

    I desperately need help from someone.

    THANK YOU.
     
  2. MilesWeb

    MilesWeb Well-Known Member
    PartnerNOC

    Joined:
    May 23, 2012
    Messages:
    174
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Re: NEED HELP over new server setup

    Looks Ok for me. Why don't you also consider nginx with apache on the server ? It will boost the performance as well.
     
  3. sahithp

    sahithp Member

    Joined:
    Jun 13, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Re: NEED HELP over new server setup

    Just figured one more thing.. Apache become unresponsive and getting restart at 998

    ps aux|grep -i httpd|wc -l ----> 998

    But can't figured why it is hanging there ans restarting by itself.
     
  4. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Friendly Moderator Note

    I have moved this thread to our Optimization section and adjusted its title for better visibility.
     
  5. srpurdy

    srpurdy Well-Known Member

    Joined:
    Jun 1, 2011
    Messages:
    101
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    You should turn ETag's off. This will only degrade performance in 95% of cases.

    After that compile in mod_headers, mod_expires into Apache as these are useful to set caching.

    you can set some options with .htaccess like this

    Code:
    # 1 YEAR
    ExpiresActive On
    <FilesMatch "\.(otf|ico|pdf|flv)$">
    Header set Cache-Control "max-age=29030400, public"
    ExpiresDefault "access plus 1 years"
    Header unset Last-Modified
    Header unset ETag
    SetOutputFilter DEFLATE
    </FilesMatch>
    
    # 1 MONTHS
    <FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
    Header set Cache-Control "max-age=2419200, public"
    ExpiresDefault "access plus 1 month"
    SetOutputFilter DEFLATE
    </FilesMatch>
    
    <FilesMatch "\.(xml|txt|css|js)$">
    Header set Cache-Control "max-age=604800, public"
    ExpiresDefault "access plus 1 week"
    SetOutputFilter DEFLATE
    </FilesMatch>
    
    # 30 MIN
    <FilesMatch "\.(html|htm|php)$">
    SetOutputFilter DEFLATE
    </FilesMatch>
    
    Basically if you have multiple address for content the ETag's may return different which means your server has to fork a live copy instead of loading it from cache. So you end up with more requests than are needed.
     
    #5 srpurdy, Nov 14, 2012
    Last edited: Nov 14, 2012
Loading...

Share This Page