CEPH inline compression

get compression ratio

ceph df detail
 
--- POOLS ---
POOL             ID  PGS   STORED   (DATA)  (OMAP)  OBJECTS     USED   (DATA)   (OMAP)  %USED  MAX AVAIL  QUOTA OBJECTS  QUOTA BYTES  DIRTY  USED COMPR  UNDER COMPR
rbd               1  512  2.3 TiB  2.3 TiB  15 KiB  638.96k  6.4 TiB  6.4 TiB   44 KiB  59.17    1.5 TiB            N/A          N/A    N/A     562 GiB      1.1 TiB
  • USED COMPR: The amount of space allocated for compressed data. This includes compressed data in addition to all of the space required for replication, allocation granularity, and erasure- coding overhead.
  • UNDER COMPR: The amount of data that has passed through compression (summed over all replicas) and that is worth storing in a compressed form.

enable compression

ceph osd pool set {pool-name} compression_algorithm {algorithm}
  • {pool-name}: The name of the pool you want to modify.
  • {algorithm}: The compression algorithm to use.
    • zstd: A modern and fast compression algorithm.
    • snappy: A good default with high performance and a decent compression ratio.
    • lz4: Very fast but with a lower compression ratio.
    • none: Disables compression for the poo

* Snappy โ€” A fast and efficient compression algorithm developed by Google. It prioritizes speed over compression ratio. Snappy is used by default in Spark. * LZ4 โ€” A very fast compression algorithm that focuses on decompression speed. LZ4 provides a good balance between speed and compression ratio. * ZStandard (ZStd) โ€” A modern compression algorithm that provides a good compression ratio while still being pretty fast. ZStd offers compression ratios comparable to ZLib with faster compression/decompression speeds.

  • tbd
    • none: Never compress data.
    • passive: Do not compress data unless the write operation has a compressible hint set.
    • aggressive: Do compress data unless the write operation has an incompressible hint set.
    • force: Try to compress data no matter what.
ceph osd pool set rbd compression_algorithm zstd
ceph osd pool set rbd compression_mode aggressive
ceph osd pool get rbd compression_mode
ceph osd pool get rbd compression_algorithm

detailed statistics

Check compression ratios:

ceph daemon osd.2 perf dump bluestore | egrep -i "compressed_|allocated|stored|compress_.*_count"
ceph tell 'osd.*' perf dump bluestore | egrep -i "compressed_|allocated|stored|compress_.*_count"

or

ceph daemon osd.0 perf dump bluestore | egrep -i "compressed_|allocated|stored|compress_.*_count|write_big|write_small"
ceph tell 'osd.*' perf dump bluestore | egrep -i "compressed_|allocated|stored|compress_.*_count|write_big|write_small"