Wednesday, August 6, 2008

Web Performance Techniques

1. Zipping the static content(images,css,javascript) and page response.

This can be achived by using the following configuration on the apache vhost configuration

For static content

<FilesMatch "\.(html|htm|js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>

For page response ending with .do requests

<LocationMatch "\.(do)$">
SetOutputFilter DEFLATE
</LocationMatch>


2. Adding expires header

<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Expires "Wed, 31 Dec 2008 23:59:59 GMT"
</FilesMatch>

Expires also can be set as access plus x days

By adding this all images with the above extensions will not be requested.

If the above is missing all requests are made and images are downloaded for every requests.

if the browser cache is enabled , still Get requests are made and if the response is 304 meaning file has not changed the image will not be downloaded else
will download the image.

3. KeepAlive On

KeepAliveTimeout 15

MaxKeepAliveRequests 100

By setting this on httpd.conf the connection once obtained will not be disconnected until 15 seconds. Hence the multiple requests on a page will be faster.
The disadvantage could be , if the requests are very high the latter once will not get a connection until these are closed.


The cache setting will override the expires header setting, if it is less than the time interval for expires header.

Must use Addons With FireFox

FireBug - Shows request basis data along with headers and allows easy debugging of html content.

Web developer - Comes with lot of web development features like enable/disable cache/image/css/form data/proxy etc.

Live HTTP headers - Gives all trhe details required with headers.

Tamper Data -gives header data and also allows to tamper the data.

 
Free Domain Names @ .co.nr!