Compressing your content saves bandwidth and improves render time,
particular on devices with slow internet connections. But it also
reduces load on your server. While it does take some amount of
computer power to compress files on the fly, you save much more power
by having your server doing fewer things at once. It takes a lot less
time to transfer files that are smaller. Your server is therefor, at
any given time, maintaining far fewer open connections. There really
is no down-side to enabling some form of HTTP compression.
The best way to enable this compression, is by using mod_deflate or
modgzip. You can use them to automatically compress all HTML, CSS,
xml. If your server is not configured to compress content, and you are
unable to change that, there is an alternative. It only applies to
HTML, but you can add one simple line of PHP to the top of your
documents, to let PHP gzip the HTML on the fly.
GZIP is a generic compressor that can be applied to any stream of
bytes: under the hood it remembers some of the previously seen content
and attempts to find and replace duplicate data fragments in an
efficient way - for the curious, great low-level explanation of GZIP.
However, in practice, GZIP performs best on text-based content, often
achieving compression rates of as high as 70-90% for larger files,
whereas running GZIP on assets that are already compressed via
alternative algorithms (e.g. most image formats) yields little to no
All modern browsers support and automatically negotiate GZIP
compression for all HTTP requests: our job is to ensure that the
server is properly configured to serve the compressed resource when
requested by the client.
I hope the above explanation is enough if you need further explanation let me know…!!!