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_sizeparameter. -
For objects with random read or write access, BlueStore uses the
compression_min_blob_sizeparameter.
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 Copy linkLink copied to clipboard!
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 Copy linkLink copied to clipboard!
Override global defaults by setting compression options for individual pools to fine-tune performance and data reduction.
Procedure
Set the compression algorithm for the pool.
ceph osd pool set POOL_NAME compression_algorithm ALGORITHM
ceph osd pool set POOL_NAME compression_algorithm ALGORITHMCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
[ceph: root@host01 /]# ceph osd pool set test_pool compression_algorithm snappy set pool 2 compression_algorithm to snappy
[ceph: root@host01 /]# ceph osd pool set test_pool compression_algorithm snappy set pool 2 compression_algorithm to snappyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Set the compression mode for the pool.
ceph osd pool set POOL_NAME compression_mode MODE
ceph osd pool set POOL_NAME compression_mode MODECopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
[ceph: root@host01 /]# ceph osd pool set test_pool compression_mode force set pool 2 compression_mode to force
[ceph: root@host01 /]# ceph osd pool set test_pool compression_mode force set pool 2 compression_mode to forceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Set the required compression ratio for the pool.
NoteCompression 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
ceph osd pool set POOL_NAME compression_required_ratio RATIOCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
[ceph: root@host01 /]# ceph osd pool set test_pool compression_required_ratio 0.7
[ceph: root@host01 /]# ceph osd pool set test_pool compression_required_ratio 0.7Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
ceph osd pool set POOL_NAME compression_min_blob_size SIZE ceph osd pool set POOL_NAME compression_max_blob_size SIZECopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the per-pool compression settings.
ceph osd pool get POOL_NAME OPTION_NAME
ceph osd pool get POOL_NAME OPTION_NAMECopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
[ceph: root@host01 /]# ceph osd pool get test_pool compression_algorithm compression_algorithm: snappy
[ceph: root@host01 /]# ceph osd pool get test_pool compression_algorithm compression_algorithm: snappyCopy to Clipboard Copied! Toggle word wrap Toggle overflow
5.1.2. Configuring global compression Copy linkLink copied to clipboard!
Set cluster-wide BlueStore compression policies that apply to all pools unless overridden locally.
Procedure
Set the global compression algorithm.
ceph config set osd bluestore_compression_algorithm ALGORITHM
ceph config set osd bluestore_compression_algorithm ALGORITHMCopy to Clipboard Copied! Toggle word wrap Toggle overflow
The default value is snappy. This parameter is optional.
Set the global compression mode.
ceph config set osd bluestore_compression_mode MODE
ceph config set osd bluestore_compression_mode MODECopy to Clipboard Copied! Toggle word wrap Toggle overflow The supported MODE inputs are:
-
none(default) -
passive -
aggressive -
force
-
Set the global compression ratio.
ceph config set osd bluestore_compression_required_ratio RATIO
ceph config set osd bluestore_compression_required_ratio RATIOCopy to Clipboard Copied! Toggle word wrap Toggle overflow The default value is
0.875. A value of0.7means that compression is applied only if the compressed data is 70% or smaller than the original.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
ceph config set osd bluestore_compression_min_blob_size SIZE ceph config set osd bluestore_compression_max_blob_size SIZECopy to Clipboard Copied! Toggle word wrap Toggle overflow 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 Copy linkLink copied to clipboard!
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
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
ceph config rm osd bluestore_compression_algorithmCopy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the global compression mode. This command clears the compression mode (
none,passive,aggressive, orforce) and returns OSDs to the default mode.ceph config rm osd bluestore_compression_mode
ceph config rm osd bluestore_compression_modeCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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
ceph config rm osd bluestore_compression_required_ratioCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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
ceph config rm osd bluestore_compression_min_blob_sizeCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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
ceph config rm osd bluestore_compression_max_blob_sizeCopy to Clipboard Copied! Toggle word wrap Toggle overflow