Configuring BlueStore compression for a specific pool

Use these commands to configure compression settings for a specific pool. These settings override global defaults.

Procedure

  1. Set the compression algorithm for the pool.
    ceph osd pool set POOL_NAME compression_algorithm ALGORITHM
    For example,
    [ceph: root@host01 /]# ceph osd pool set test_pool compression_algorithm snappy
    set pool 2 compression_algorithm to snappy
  2. Set the compression mode for the pool.
    ceph osd pool set POOL_NAME compression_mode MODE
    For example,
    [ceph: root@host01 /]# ceph osd pool set test_pool compression_mode force
    set pool 2 compression_mode to force
  3. Set the required compression ratio for the pool.
    ceph osd pool set POOL_NAME compression_required_ratio RATIO
    Note: Compression occurs only when compressed data size is less than or equal to 70% of the original size.
    For example,
    [ceph: root@host01 /]# ceph osd pool set test_pool compression_required_ratio 0.7
  4. Set minimum and maximum blob sizes for the pool.
    ceph osd pool set POOL_NAME compression_min_blob_size SIZE 
    ceph osd pool set POOL_NAME compression_max_blob_size SIZE
  5. Verify the per-pool compression settings.
    ceph osd pool get POOL_NAME OPTION_NAME
    For example,
    [ceph: root@host01 /]# ceph osd pool get test_pool compression_algorithm
    compression_algorithm: snappy
     

Configuring global BlueStore compression

Use the ceph config set commands to configure compression across all OSDs in the cluster.

Procedure

  1. Set the global compression algorithm.
    ceph config set osd bluestore_compression_algorithm ALGORITHM
    The default value is snappy. This parameter is optional.
  2. Set the global compression mode.
    ceph config set osd bluestore_compression_mode MODE
    The supported MODE inputs are:
    • none (default)
    • passive
    • aggressive
    • force
  3. Set the global compression ratio.
    ceph config set osd bluestore_compression_required_ratio RATIO

    The default value is 0.875. A value of 0.7 means that compression is applied only if the compressed data is 70% or smaller than the original.

  4. Set the minimum and maximum blob sizes.
    ceph config set osd bluestore_compression_min_blob_size SIZE
    ceph config set osd bluestore_compression_max_blob_size SIZE
    The following are the default blob sizes:
    SSD
    65536 bytes (minimum and maximum)
    HDD
    8192 bytes (minimum) and 65536 bytes (maximum)

Removing global BlueStore compression

Remove global BlueStore compression settings when you want all OSDs to revert to their default values. Removing these options stops applying the overridden compression behavior for future writes; existing data is not modified.

Procedure

  1. Remove the global compression algorithm.
    This command overrides any set algorithms so that OSDs stop forcing a specific compression algorithm.
    ceph config rm osd bluestore_compression_algorithm
  2. Remove the global compression mode.
    This command clears the compression mode (none, passive, aggressive, or force) and returns OSDs to the default mode.
    ceph config rm osd bluestore_compression_mode
  3. Remove the global required ratio.
    This command removes the threshold used to decide whether compressed data should be kept.
    ceph config rm osd bluestore_compression_required_ratio
  4. Remove the minimum blob size.
    This command removes the configured minimum blob size so that OSDs use the default value based on the device type.
    ceph config rm osd bluestore_compression_min_blob_size
  5. Remove the maximum blob size.
    This command removes the configured maximum blob size so that OSDs use the default value based on the device type.
    ceph config rm osd bluestore_compression_max_blob_size