A newer version of this documentation is available.

View Latest

Compaction API

Compaction allows on-disk data to be relocated into the closest-possible proximity.

Compaction is used by Couchbase Server to relocate on-disk data; so as to ensure the data’s closest-possible proximity, and thereby reclaim fragments of unused disk-space. The periodic compaction of a bucket’s data helps to ensure the ongoing efficiency of both reads and writes.

Administrators can initiate the compaction of a single bucket’s data at any time, and can cancel such compaction if and when necessary. The REST APIs that support this are described in Performing Compaction Manually.

Additionally, settings are provided whereby compaction is triggered automatically, according to a specified configuration and schedule. This auto-compaction can be achieved in two ways:

  • Globally, meaning that all buckets in the cluster are compacted according to the same configuration and schedule — with the exception of those buckets for which these default settings are deliberately overridden. The REST APIs that support global auto-compaction are described in Auto-Compaction: Global.

  • Per bucket, meaning that a specified bucket is automatically compacted according to a different configuration and schedule than those established as the global defaults. The REST APIs that support per-bucket auto-compaction are described in Auto-Compaction: Per Bucket.