Compression Guide Slack

MinIO server allows streaming compression to ensure efficient disk space usage. Compression happens inflight, i.e objects are compressed before being written to disk(s). MinIO uses klauspost/compress/s2 streaming compression due to its stability and performance.

This algorithm is specifically optimized for machine generated content. Write throughput is typically at least 300MB/s per CPU core. Decompression speed is typically at least 1GB/s.
This means that in cases where raw IO is below these numbers compression will not only reduce disk usage but also help increase system throughput.
Typically enabling compression on spinning disk systems will increase speed when the content can be compressed.

Get Started

1. Prerequisites

Install MinIO - MinIO Quickstart Guide.

2. Run MinIO with compression

Compression can be enabled by updating the compress config settings for MinIO server config. Config compress settings take extensions and mime-types to be compressed.

$ mc admin config get myminio compression
compression extensions=".txt,.log,.csv,.json,.tar,.xml,.bin" mime_types="text/*,application/json,application/xml"```

Default config includes most common highly compressible content extensions and mime-types.

$ mc admin config set myminio compression extensions=".pdf" mime_types="application/pdf"

To enable compression for all content, with default extensions and mime-types.

~ mc admin config set myminio compression

The compression settings may also be set through environment variables. When set, environment variables override the defined compress config settings in the server config.

export MINIO_COMPRESS="on"
export MINIO_COMPRESS_MIME_TYPES="application/pdf"

3. Note

All files with these extensions and mime types are excluded from compression, even if compression is enabled for all types.

To test the setup

To test this setup, practice put calls to the server using mc and use mc ls on the data directory to view the size of the object.

Explore Further