SpeedUp Webpages Using gzip compression
It is one of the important point to attract web traffic and maintain the level of the website by its speed.Google is gold medalist in this.Dont want to know why ? .Yeah ! But not only due to there bursty servers but also very minute changes and proper arrangements of HTML and proper compression used while transfer of data from server to user.
Google uses a gzip compression for transfer of web pages.That means the data which is to be transferred is compressed by gzip compression and then sent to the user.The browser decompress the gzip data and show to the user as usual data.But if the browser dont support gzip ? Yeah , Google Verify before the gzip compression that the browser supports gzip compression or not else it will send data or html in normal way.
How much is the efficiency of this system ?
I have done some experiments on gzip compression.I made two php files one supporting gzip and other not.The duration of loading of php file without gzip compression was ~128 ms [It was hosted on local host] and when I clicked on php file with gzip compression , I was amazed to see the results it was about ~ 56 ms .So this really worth.
How is this technically possible ?
It is very easy with PHP , I will post the code which is to be pasted above the php file you want to compress.
<?php
ob_start(“ob_gzhandler”);
?>
This will speed up your loading speed of a web page.But this code is incomplete without validation that the browser supports gzip or not .
Browser sends the header to the server named “Accept-Encoding” , If the gzip is listed in that means you can use it else normal encoding will used which is by default.
<?php
if(preg_match(‘/gzip/’,$_SERVER['Accept-Encoding']))
{
ob_start(‘ob_gzhandler’);
}
?>
So this way you will able to add this system to your PHP pages , But what about others like asp , cgi etc.Using same logic you can add in other programming language also as the gzip and Accept-Encoding will be the common terms throughout the web .
Cheer
Read Full Post | Make a Comment ( 5 so far )



