Compression

New in version Kraken.

The Ceph Object Gateway supports server-side compression of uploaded objects,using any of Ceph’s existing compression plugins.

Configuration

Compression can be enabled on a storage class in the Zone’s placement targetby providing the —compression=<type> option to the commandradosgw-admin zone placement modify.

The compression type refers to the name of the compression plugin to usewhen writing new object data. Each compressed object remembers which pluginwas used, so changing this setting does not hinder the ability to decompressexisting objects, nor does it force existing objects to be recompressed.

This compression setting applies to all new objects uploaded to buckets usingthis placement target. Compression can be disabled by setting the type toan empty string or none.

For example:

  1. $ radosgw-admin zone placement modify \
  2. --rgw-zone default \
  3. --placement-id default-placement \
  4. --storage-class STANDARD \
  5. --compression zlib
  6. {
  7. ...
  8. "placement_pools": [
  9. {
  10. "key": "default-placement",
  11. "val": {
  12. "index_pool": "default.rgw.buckets.index",
  13. "storage_classes": {
  14. "STANDARD": {
  15. "data_pool": "default.rgw.buckets.data",
  16. "compression_type": "zlib"
  17. }
  18. },
  19. "data_extra_pool": "default.rgw.buckets.non-ec",
  20. "index_type": 0,
  21. }
  22. }
  23. ],
  24. ...
  25. }

Note

A default zone is created for you if you have not done anyprevious Multisite Configuration.

Statistics

While all existing commands and APIs continue to report object and bucketsizes based their uncompressed data, compression statistics for a given bucketare included in its bucket stats:

  1. $ radosgw-admin bucket stats --bucket=<name>
  2. {
  3. ...
  4. "usage": {
  5. "rgw.main": {
  6. "size": 1075028,
  7. "size_actual": 1331200,
  8. "size_utilized": 592035,
  9. "size_kb": 1050,
  10. "size_kb_actual": 1300,
  11. "size_kb_utilized": 579,
  12. "num_objects": 104
  13. }
  14. },
  15. ...
  16. }

The size_utilized and size_kb_utilized fields represent the totalsize of compressed data, in bytes and kilobytes respectively.