compress_spool – Dynamic Spool Compression

March 26, 2020

One of the principle bottlenecks in handling a large amount of inbound mail is writing spool messages to disk on reception and then reading them back from disk again when they need to be delivered. The spool compression module attempts to assist in the IO demands of large messages by compressing them prior to writing them to disk. This module is primarily useful on systems which have IO bottlenecks but CPU to spare.

Warning

This module will fail to load if you set the configuration option Use_MMAP to true. For more information about this option, see use_mmap.

Configuration

This module is loaded automatically as required and does not need to be explicitly included. Include it if you wish to change the default values.

The following is an example configuration that enables compression of spool entries over 32k in size:

compress_spool {
  compress = "bzip2"
  minimum_size = 32768
  read_only = 1
}

In this example, messages greater than or equal to 32768 will be stored using bzip2 compression.

The following are the configuration options defined within this module:

minimum_size

Messages greater than or equal to the minimum size will be stored with compression. Anything under the minimum_size will be spooled directly to disk uncompressed. Default value is 4096.

read_only

Default value is 0.

compress

The default compression algorithm is gzip. The gzipio module is loaded automatically as required and does not need to be explicitly included.

bzip2 compression is also available. The "bzip2io {}" stanza is not necessary as it loads on demand when the compress spool module attempts to use the "bzip2" io wrapper.

Warning

This module compresses the spool messages in place. If you enable this module, you MUST be certain that the queue is empty before you disable it, or else you risk sending compressed messages without decompressing them.