Wednesday, January 9, 2013
HTTP Compression (Or) Content Compression
What is HTTP Compression ?
Wikipedia Definition:
HTTP compression is a capability that can be built into web servers and web clients to make better use of available bandwidth, and provide greater transmission speeds between both.
What is the use of HTTP Compression? And how it’s achieved?
Server Side:
•Using compression the number of transmitted bytes is reduced and thus a higher performance is gained. HTTP Compression uses public domain compression algorithms like gzip , deflate to encode HTML, XML, JavaScript, CSS and other file formats at the server-side.
Client Side:
•This standards-based method of delivering compressed content is built into HTTP/1.1, and all modern Web browsers support the HTTP/1.1 protocol, i.e. they can decode compressed files automatically at the client-side. This means, in particular, that no additional software or user interaction on the client-side is required.
How the communication flow is happening between w-clients and w-server?
Request Headers by Web Browser:
•When an user opens a webpage in web browsers connection is established with the web server and HTTP request is initiated.
Response Header by Web Server:
•Browser informed to server that it can accept gzip and deflate content-coding. Server process the request header of web browser and perform compression in the desired format which is understandable by web browsers.
Request and Response Flow:
How to enable HTTP Compression in Apache Web Server ?
It’s a two step process.
Step 1: Check the Loading of Deflate Module:
LoadModule deflate_module /opt/apache/www/apache/modules/mod_deflate.so
Step 2: Use DEFLATE output filter provided by the mod_deflate module.
Compression is implemented by the DEFLATE
filter. The following directive will enable compression for documents in the container where it is placed:
<Location /WebServer>
SetOutputFilter DEFLATE
Header append Vary User-Agent env=!dont-vary
</Location>
<Location /AppServer>
SetOutputFilter DEFLATE
Header append Vary User-Agent env=!dont-vary
</Location>
<Location /DBServer>
SetOutputFilter DEFLATE
Header append Vary User-Agent env=!dont-vary
</Location>
•Shared Dictionary Compression over HTTP (SDCH) is a data compression method aimed to reduce redundancy across HTTP responses .This method is proposed by Google and implemented in their Google Chrome web browser.This is proposed modification to HTTP/1.1. SDCH is using VCDIFF (RFC 3284) for the compression.
References:
1] http://en.wikipedia.org/wiki/HTTP_compression
2] http://en.wikipedia.org/wiki/SDCH
3] http://www.ibm.com/developerworks/web/library/wa-httpcomp/
4] http://www.http-compression.com/
5] http://httpd.apache.org/docs/2.2/mod/mod_deflate.html
No comments:
Post a Comment