Main menu

Apache Performance Enhancement Trick

Apache is most widely used web server in market. It’s default configuration can be tricky for optimization. Apache performance enhancement trick is a quick way to understand what are the available options you can use to make the faster 4x.

KeepAlive: When a request comes to Apache it create a child process for it and terminate it  when it’s get completed. KeepAlive directive defines that child process should be terminated or not, KeepAliveTimeout  defines how long child process will leave if request is not coming from the same client and MaxKeepAliveRequests  defines how many numbers of KeepAlive request can be simultaneously runs.

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 10

Apache status : Apache status is a web frontend of Apache which provide information about which worker we are using, which request Apache currently serving etc.

ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Allow from all

After enabling this directive in your configuration file you can visit http://your_ip_address/server-status url and check for the information.

Apache browser cache : Apache mod_expire provide a way to cache information on client browser so for this static content, browser won’t request for the same content twice.

AddType application/ .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/css "access 6 hours"
ExpiresByType text/html "access 6 hours"
ExpiresByType text/x-javascript "access 1 hours"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 month"
ExpiresByType application/ "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType application/x-font-opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresDefault "access 1 hours"

Compression of contents : Apache mod_deflate compress the content on server and browser automatically extract the content. This way you can reduce the bandwidth and loading time.

LoadModule deflate_module modules/
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript

You can vist below link and can check if your content is compressed or not.