Message compression is a function that allows messages sent through FioranoMQ to be compressed when sending and decompressed, to their original size, prior to delivery to consumers.
Compression has the advantage of improving performance. Less bandwidth is used during message transfer. Memory and storage requirements on the server are reduced as well. This function is important for performance-sensitive applications operating over WAN links. Fiorano also extends compression support for server-to-server communication.
Base Implementation
Many data compression implementations have been developed in the past, of which the Zlib implementation is, by far, the most significant one. The Fiorano compression implementation is based on "Zlib Compressed Data Format Specification Version.
This specification defines a lossless compression data format. The advantages of this compression implementation, as per specification, are:
- It is independent of CPU type, operating system, file system and character set.
- Can be produced or consumed by an arbitrarily long sequentially presented input data stream, using a bounded amount of intermediate storage.
- Can be implemented readily in a manner not covered by patents.
- Can use a number of different compression methods.
In FioranoMQ, the Zlib implementation provided in the default Java runtime library java.util.zip has been used. This implementation provides 'deflate' and 'inflate' mechanisms using different compression levels and different compression strategies. Compression level is the amount of compression required. Compression strategy is the actual compression method used.) The default strategy uses a combination of the LZ77 algorithm and Huffman coding.
Message Compression Characteristics
FioranoMQ provides message compression on a 'per message' as well as on 'per destination' basis. In 'per message' compression, clients can enable or disable compression for each message. In 'per destination' compression, all messages sent to a particular destination (topic or queue) are compressed.
Client applications can choose compression levels and strategies from Zlib specifications using public APIs.
The available options are:
- NO_COMPRESSION
- BEST_SPEED (fastest compression)
- BEST_COMPRESSION
- DEFAULT_COMPRESSION
There are ten possible compression levels (0-9) available, where BEST_SPEED is defined as 1 and BEST_COMPRESSION is defined as 9.
The possible values for the compression strategy are:
- FILTERED: Compression strategy best used for data consisting primarily of small values with a random distribution. It enforces more Huffman coding and less string matching.
- HUFFMAN_ONLY:
- DEFAULT_STRATEGY: This uses a combination of the LZ77 method and Huffman coding.
Compression support provided helps a client application to decide on the optimum compression level and strategy by providing APIs to check compression ratios of messages sent and/or received.
Compression involves compressing only the payload of the message and not its JMS header. The same set of APIs can be used for message headers as well as message selectors, irrespective of whether message compression is enabled or not.
FioranoMQ's implementation allows users to plug in their proprietary compression implementation, which overrides the default implementation.