Mod_deflate is an Apache module which can be used to compress files before sending them to clients. If configured correctly, mod_deflate can offer substantial bandwidth savings.
Mod_deflate can be used to compress HTML, CSS, XML and other text files, reducing page loading times for users and reducing your server’s bandwidth consumption. There is some small performance overhead for compressing files, but on modern servers the overhead should be negligible compared to the reduction in loading time from the file size reduction.
Setting Up Mod_Deflate
In most cases, mod_deflate comes with Apache2 platform, so all you have to do is enable it, and then restart Apace2 by entering the following in the command line:
The above instructions are for Debian and related distributions (e.g. Ubuntu). If you are running a RHEL distribution you may need to edit Apache’s configuration files manually and add deflate_module to the LoadModule section of the file.
The next step is to configure mod_Deflate. In most cases, you should only compress text and HTML files. Add the following to your config file to do this:
AddOutputFilterByType DEFLATE text/html text/plain
Another option is to set up mod_deflate to compress all files, except for files which are explicitly excluded, such as already compressed ZIP files. There is no point attempting to compress a ZIP or TAR.GZ file because these files have already been compressed once and it is unlikely that you would save much (or any) bandwidth by compressing them again.
Once you have finished configuring mod_deflate, you should restart Apache again. The compression occurs silently. If you want to see how well it is working, you can enable logging on mod_deflate, request a few files, and then open the log file to see a report of how well each requested file was compressed.
Enhanced Deflate is also the other definition of the Deflate64™.
The Deflate64 is algorithm for compression and actually is a version of the same Deflate algorithm which uses sliding window 64K in opposite to the 32K window. The difference serves to compress sub-sequence of bits.
Deflate64, or “expanded deflate”, or “enhanced deflate”, is an improved version of the Deflate compression algorithm. The original Deflate algorithm was introduced by PKWare almost 30 years ago, with the release of PKZip 2.04g. This algorithm was quite groundbreaking – it was fast and still achieved moderately good compression. It was a lossless algorithm, and was patented in the USA under patent number 5051745.
Deflate was the most widely used compression algorithm for many years, but the compression it offered was insufficient for very large files. In 2001, PKWare released PKZip 4.5, and with it they introduced Deflate64. This compression algorithm is almost as fast as Deflate, but offers much better compression.
How Does Deflate64 Work?
The main difference between Deflate and Deflate64 is that Deflate53 uses a 64K sliding window, rather than a 32K sliding window, when performing Lempel-Ziv compression. This means that it is not backwards compatible with Deflate, however on supported machines it offers much better compression.
The final length code has been expanded by 16 extra bits, and the distance codes have also been expanded to address a 64K range. These codes were unused in Standard Deflate. Compression is achieved in a two-step process of duplicate string elimination followed by bit reduction.
Availability in Programming Libraries
Implementations of Deflate are available in several languages through the zlib and gzip libraries. Most C programs use zlib, while Pascal developers can use paszlib. In Java, developers (I know Magento programmers who know that too) can make use of the implementation found in Java.Lib.Zip.
PKWare has trademarked Deflate64, and it is considered to be a proprietary implementation. Deflate64 is not supported in zlib because of its proprietary nature, and the marginal performance difference when compared to Deflate. Deflate is also used in several hardware encoders. Comtech has produced a PCI-X card which can compress streams at a rate of 3Gbit/Sec, however this uses standard Deflate rather than Deflate64.