Apache optimization on new server setup

sahithp

Member
Jun 13, 2011
15
1
53
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.
 

MilesWeb

Well-Known Member
PartnerNOC
May 23, 2012
173
2
68
India
cPanel Access Level
Root Administrator
Twitter
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.
 

sahithp

Member
Jun 13, 2011
15
1
53
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.
 

srpurdy

Well-Known Member
Jun 1, 2011
101
0
66
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.
 
Last edited: