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 golang/snappy streaming compression due to its stability and performance.

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.

"compress": {
        "enabled": true,
        "extensions": [".txt",".log",".csv", ".json"],
        "mime-types": ["text/csv","text/plain","application/json"]
}

Since text, log, csv, json files are highly compressible, These extensions/mime-types are included by default for compression.

To update the configuration, use mc admin config get command to get the current configuration file for the minio cluster in json format, and save it locally.

$ mc admin config get myminio/ > /tmp/myconfig

After updating the compression configuration in /tmp/myconfig , use mc admin config set command to update the configuration for the cluster. Restart the Minio server to put the changes into effect.

$ mc admin config set myminio < /tmp/myconfig

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="true"
export MINIO_COMPRESS_EXTENSIONS=".pdf,.doc"
export MINIO_COMPRESS_MIMETYPES="application/pdf"

3. Note

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