1
0
mirror of https://github.com/minio/docs.git synced 2025-04-25 17:22:39 +03:00
Andrea Longo 0747c9a191
mention that tiny files are not compressed, also other typos (#1357)
Came up in a customer issue. Specifically the threshold is 4 kb and
there is no configuration option. (Nor does Klaus want one.)

Worth adding? With how much detail? The threshold choice is because of
typical block size on disk. You will use at least that much anyway so
why bother compressing.

Staged:


http://192.241.195.202:9000/staging/dont-compress-small-objects/linux/administration/object-management/data-compression.html#excluded-file-types

Drive-by fix tacked onto this PR: correct typos in some `mc anonymous`
examples.

Staged:

http://192.241.195.202:9000/staging/dont-compress-small-objects/linux/reference/minio-mc/mc-anonymous.html

---------

Co-authored-by: Daryl White <53910321+djwfyi@users.noreply.github.com>
Co-authored-by: Ravind Kumar <ravind@min.io>
2024-10-25 14:52:33 -06:00

7.8 KiB

Data Compression

minio

Table of Contents

Overview

MinIO Server supports compressing objects to reduce disk usage. Objects are compressed on PUT before writing to disk, and uncompressed on GET before they are sent to the client. This makes the compression process transparent to client applications and services.

Depending on the type of data, compression may also increase overall throughput. Write throughput for a production deployment is generally 500MB per second or greater per available CPU core in the system. Decompression is approximately 1 GB per second or greater for each CPU core.

For best results, review MinIO's recommended hardware configuration <deploy-minio-distributed-recommendations> or use to work directly with engineers for analyzing compression performance.

Default File Types

Data compression is a global option, the configured settings apply to all buckets in a deployment. Enabling data compression compresses the following types of data by default:

You can control which objects are compressed by specifying the desired file extensions and media (MIME) types.

Existing objects are not modified

Enabling, disabling, or updating a deployment's compression settings does not modify existing objects. New objects are compressed according to the settings in effect at the time they are created.

Excluded File Types

Some data cannot be effectively compressed. For example: video, already compressed data, or files less than 4KiB. MinIO does not compress common incompressible file types, even if they are specified in the compression configuration.

Objects of these types are never compressed:

Data Compression and Encryption

MinIO supports encrypting compressed objects but recommends against combining compression and encryption without a prior risk assessment. Before enabling encryption for compressed objects, carefully consider the security needs of your environment.

See Transparent Data Compression on MinIO for more about combining compression and encryption. users can log in and engage with our engineering and security teams to review encryption options.

Tutorials

Enable Data Compression

To enable data compression, use mc admin config set to set the compression key ~compression.enable option to on.

The following enables compression for new objects of the default types <minio-data-compression-default-types>:

mc admin config set ALIAS compression enable=on
  • Replace ALIAS with the alias <mc alias> of a configured MinIO deployment.

Existing uncompressed objects are not modified. To configure which extensions and types to compress, see minio-data-compression-configure-objects.

To view the current compression settings:

mc admin config get ALIAS compression

Disable Data Compression

To disable data compression, use mc admin config set to set the compression key ~compression.enable option to off:

The following disables data compression for new objects:

mc admin config set ALIAS compression enable=off
  • Replace ALIAS with the alias <mc alias> of a configured MinIO deployment.

Existing compressed objects are not modified.

Configure Which Objects to Compress

Configure the objects to compress by specifying the desired file extensions and media types in ~compression.extensions or ~compression.mime_types arguments.

The default data compression configuration compresses the following types of data:

Default excluded extensions and types are never compressed

Some objects cannot be efficiently compressed. MinIO will not attempt to compress these objects, even if they are specified in ~compression.extensions or ~compression.mime_types arguments. See minio-data-compression-excluded-types for a list of excluded types.

The sections below describe how to configure compression for the desired file extensions and media types.

Compress All Compressible Objects

To compress all objects except the default excluded types <minio-data-compression-excluded-types>, use mc admin config set to set the compression key ~compression.extensions and ~compression.mime_types options to empty lists:

mc admin config set ALIAS compression extensions= mime_types=
  • Replace ALIAS with the alias <mc alias> of a configured MinIO deployment.

Compress Objects by File Extension

To compress objects with certain file extensions, use mc admin config set to set the desired file extensions in an ~compression.extensions argument.

The following command compresses files with the extensions .bin and .txt:

mc admin config set ALIAS compression extensions=".bin, .txt"
  • Replace ALIAS with the alias <mc alias> of a configured MinIO deployment.

The new list of file extensions replaces the previous list. To add or remove an extension, repeat the ~compression.extensions command with the complete list of extensions to compress.

The following adds .pdf to the list of file extensions from the previous example:

mc admin config set ALIAS compression extensions=".bin, .txt, .pdf"
  • Replace ALIAS with the alias <mc alias> of a configured MinIO deployment.

Compress Objects by Media Type

To compress objects of certain media types, use mc admin config set to set the compression key ~compression.mime_types option to a list of the desired types.

The following example compresses files of types application/json and image/bmp:

mc admin config set ALIAS compression mime_types="application/json, image/bmp"
  • Replace ALIAS with the alias <mc alias> of a configured MinIO deployment.

The new list of media types replaces the previous list. To add or remove a type, repeat the ~compression.mime_types command with the complete list of types to compress.

You can use * to specify all subtypes of a single media type. The following command adds all text subtypes to the list from the previous example:

mc admin config set ALIAS compression mime_types="application/json, image/bmp, text/*"
  • Replace ALIAS with the alias <mc alias> of a configured MinIO deployment.