Monday, October 1, 2012

How To Optimize Your Site With GZIP Compression



Compression is a simple, effective way to save bandwidth and speed up your site.
Compression reduces the size (bytes) of the web page that is required to be sent across the Internet, and can reduce response time as the size of HTTP response shrinks, as lesser information is transferred over the same network. Each HTTP requests can be served and completed faster by the web server, which in turn free up the process to serve other requests. Compression, which results in reduced web page size, also has added benefit of saving bandwidth. With all the benefits of GZIP compression, it effectively offsets the performance penalty on server load caused by the compression activity.
The focus of HTTP compression is to enable the Web site to serve fewer bytes of data. For this to work effectively, a couple of things are required:
·         The Web server should compress the data
·         The browser should decompress the data and display the pages in the usual manner

Gzip is a lossless compressed-data format. The deflation algorithm used by gzip is an open-source, patent-free variation of the LZ77 (Lempel-Ziv 1977) algorithm.

Below are the steps to setup the HTTP server for gzip compression.
1)      Go to “<HTTP-Server>\conf\httpd.conf”
2)      Add below lines in last of “ httpd.conf ” file.

## Entry for gzip configuration
LoadModule deflate_module modules/mod_deflate.so
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio

# log some info
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate_log deflate

# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatchNoCase Robot is_a_robot
SetEnvIfNoCase User-Agent Robot is_a_robot

3)      Restart the HTTP server.


No comments:

Post a Comment