Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 5. BlueStore server side compression


BlueStore server-side compression reduces raw disk usage by compressing data at the storage layer based on pool configuration and object characteristics.

BlueStore applies compression based on pool settings, the configured compression mode, and object access patterns. Each blob (data fragment) is evaluated individually to determine whether compression is applied.

Object characteristics determine which blob size BlueStore uses, not whether compression is enabled.

  • For immutable, append-only objects, or objects with sequential read access, BlueStore uses the compression_max_blob_size parameter.
  • For objects with random read or write access, BlueStore uses the compression_min_blob_size parameter.

Benefits

BlueStore server-side compression provides the following benefits:

  • Stores more data without adding physical capacity.
  • Reduces raw disk usage and infrastructure costs.
  • Enables selective compression per pool to balance performance and efficiency.

Considerations

Compression introduces CPU overhead and can slightly increase read and write latency. In some scenarios, small overwrites on compressed objects can increase space usage because overlapping data fragments require both the old and new blobs to be retained.

Enable compression only for pools or workloads where data reduction benefits outweigh performance costs. Avoid enabling compression cluster-wide without testing workload access patterns.

How compression works

BlueStore applies compression based on pool settings and object characteristics. Each blob is evaluated independently.

Compression is applied when an object meets the following conditions:

  • Marked as immutable or append-only
  • Not expected to have random reads or writes
  • Expected to have sequential reads

If these conditions are met, BlueStore uses the compression_max_blob_size parameter. Otherwise, it uses the compression_min_blob_size parameter.

Blob size determines how data is divided and aligned before compression. Larger blobs typically improve compression efficiency, while smaller blobs improve read performance by reducing the amount of data that must be decompressed.

Figure 1 illustrates how BlueStore selects a blob size based on object properties.

BlueStore compression workflow

BlueStore does not use a continuous range of blob sizes. Instead, it selects one of the two configured blob sizes based on allocation hints provided through the rados_set_alloc_hint2 API call.

Ceph clients such as RBD, CephFS, and Ceph Object Gateway (RGW) already provide these hints to optimize storage performance.

Compression behavior

BlueStore compresses write operations according to the configured compression mode, required ratio, and blob size limits.

The supported compression modes are:

  • none – Compression is never applied.
  • passive – Compression is applied only when the client marks data as compressible.
  • aggressive – Compression is applied unless the client marks data as incompressible.
  • force – Compression is always attempted.

The compression_required_ratio parameter defines the minimum acceptable compression ratio. For example, when set to 0.7, BlueStore compresses data only if the compressed output is 70 percent or smaller than the original data size. If the threshold is not met, the data is stored uncompressed.

This ratio check is performed for each blob individually to prevent unnecessary CPU usage and space amplification.

Blob size is controlled by the compression_min_blob_size and compression_max_blob_size parameters. BlueStore supports the following compression algorithms:

  • snappy
  • zlib
  • lz4
  • zstd

When configured appropriately, BlueStore balances capacity savings and performance efficiency across Red Hat Ceph Storage clusters.

5.1. Configuring BlueStore compression

Learn how to enable, adjust, or remove BlueStore compression settings to optimize storage efficiency and performance.

5.1.1. Configuring compression for a specific pool

Override global defaults by setting compression options for individual pools to fine-tune performance and data reduction.

Procedure

  1. Set the compression algorithm for the pool.

    ceph osd pool set POOL_NAME compression_algorithm ALGORITHM
    Copy to Clipboard Toggle word wrap

    Example

    [ceph: root@host01 /]# ceph osd pool set test_pool compression_algorithm snappy
    set pool 2 compression_algorithm to snappy
    Copy to Clipboard Toggle word wrap

  2. Set the compression mode for the pool.

    ceph osd pool set POOL_NAME compression_mode MODE
    Copy to Clipboard Toggle word wrap

    Example

    [ceph: root@host01 /]# ceph osd pool set test_pool compression_mode force
    set pool 2 compression_mode to force
    Copy to Clipboard Toggle word wrap

  3. Set the required compression ratio for the pool.

    Note

    Compression occurs only when compressed data size is less than or equal to 70% of the original size.

    ceph osd pool set POOL_NAME compression_required_ratio RATIO
    Copy to Clipboard Toggle word wrap

    Example

    [ceph: root@host01 /]# ceph osd pool set test_pool compression_required_ratio 0.7
    Copy to Clipboard Toggle word wrap

  4. Set the 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
    Copy to Clipboard Toggle word wrap
  5. Verify the per-pool compression settings.

    ceph osd pool get POOL_NAME OPTION_NAME
    Copy to Clipboard Toggle word wrap

    Example

    [ceph: root@host01 /]# ceph osd pool get test_pool compression_algorithm
    compression_algorithm: snappy
    Copy to Clipboard Toggle word wrap

5.1.2. Configuring global compression

Set cluster-wide BlueStore compression policies that apply to all pools unless overridden locally.

Procedure

  1. Set the global compression algorithm.

    ceph config set osd bluestore_compression_algorithm ALGORITHM
    Copy to Clipboard Toggle word wrap

The default value is snappy. This parameter is optional.

  1. Set the global compression mode.

    ceph config set osd bluestore_compression_mode MODE
    Copy to Clipboard Toggle word wrap

    The supported MODE inputs are:

    • none (default)
    • passive
    • aggressive
    • force
  2. Set the global compression ratio.

    ceph config set osd bluestore_compression_required_ratio RATIO
    Copy to Clipboard Toggle word wrap

    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.

  3. 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
    Copy to Clipboard Toggle word wrap

    The following are the default blob sizes:

    SSD
    65536 bytes (minimum and maximum)
    HDD
    8192 bytes (minimum) and 65536 bytes (maximum)

5.1.3. Removing global compression settings

Remove global BlueStore compression settings to revert all OSDs to their default values. Removing these options affects only 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
    Copy to Clipboard Toggle word wrap
  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
    Copy to Clipboard Toggle word wrap
  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
    Copy to Clipboard Toggle word wrap
  4. Remove the minimum blog 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
    Copy to Clipboard Toggle word wrap
  5. Remove the maximum blog 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
    Copy to Clipboard Toggle word wrap
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2026 Red Hat
Nach oben