IntraWeb Archive

New Intraweb HTTP compression

New Intraweb HTTP compression

Starting with version 12.2.1, Intraweb now uses Delphi and C++ Builder built-in ZLib for HTTP compression when deployed as Stand Alone Server. The main advantage is that you don’t have to deploy external zlib.dll anymore, no external dependencies. Another important point to note is: the Delphi built-in ZLib works also for x64, so you can have ZLib HTTP compression even for your x64 Intraweb Stand Alone Servers.

All modern browsers support HTTP compression and there are many benefits to using compression in your Intraweb applications: HTTP compression can save up to 70-80% of bandwidth, and the browser will load your page faster. You can read more about HTTP compression here.

New compression options are now available in Intraweb ServerController.Compression:

  • AllowDeflate: Tells the compressor if zlib standard deflate algorithm may be used. The default value is TRUE.The deflate algorithm is a combination of the LZ77 algorithm and Huffman coding. You can read more about Deflate algorithm here.
  • AllowGZip: Tells the compressor if GZip algorithm may be used. The default value is TRUE. GZip uses the deflate algorithm to compress data and add extra header and CRC information on top of it. You can read more about GZip algorithm here.

When both GZip and Deflate are allowed and the browser supports both algorithms, then GZip will be used by the internal compressor.

  • MinSize: This is the minimum size in bytes that the file must have to be compressed. The overhead of compressing very small files (for instance, a 100 bytes file) in general will make your application slower, not faster. The default value is 1000 bytes.
  • Enabled: If TRUE, the HTTP compression will be used
  • Level: This is the same compression level property – present in older Intraweb versions – with one difference: The built-in Delphi zlib expects only 3 different levels of compression:
    • Faster: bigger file size but the file will be compressed faster
    • Default: normal or default compression level of zlib will be used
    • Max: smaller file size but it will take longer to compress it

When setting ServerController.Compression.Level you should have in mind that:

    • Level 1: Faster compression will be used
    • Level 9: Max compression will be used
    • Levels from 2 to 8:  Default compression will be used

    If  bandwidth usage is critical for your application you may use Level 9. If processor time is critical and bandwidth not so critical, you may try level 1.

    Besides that, the Intraweb compression architecture allows you to plug your own compression implementation.

The new built-in compression is available for all Delphi and C++Builder compilers supported by Intraweb XII: 2009, 2010, XE and XE2(x86 and x64). Delphi 2009, 2010 and XE use the zlib 1.2.3 implementation, while Delphi XE2 uses zlib 1.2.5 implementation.

Further readings: HTTP Compression
Deflate data format specification
GZip file format specification
zlib web site