3.7.1. Database Compaction Options¶
Specifies the copy buffer’s maximum size in bytes:
[database_compaction] doc_buffer_size = 524288
Triggers a checkpoint after the specified amount of bytes were successfully copied to the compacted database:
[database_compaction] checkpoint_after = 5242880
3.7.2. View Compaction Options¶
3.7.3. Compaction Daemon¶
CouchDB ships with an automated, event-driven daemon internally known as “smoosh” that continuously re-prioritizes the database and secondary index files on each node and automatically compacts the files that will recover the most free space according to the following parameters.
A comma-delimited list of channels that are sent the names of database files when those files are updated. Each channel can choose whether to enqueue the database for compaction; once a channel has enqueued the database, no additional channel in the list will be given the opportunity to do so.
A comma-delimited list of channels that are sent the names of secondary index files when those files are updated. Each channel can choose whether to enqueue the index for compaction; once a channel has enqueued the index, no additional channel in the list will be given the opportunity to do so.
The number of minutes that the (expensive) priority calculation on an individual can be stale for before it is recalculated. Defaults to 5.
If set to true, the compaction daemon will delete the files for indexes that are no longer associated with any design document. Defaults to false and probably shouldn’t be changed unless the node is running low on disk space, and only after considering the ramifications.
The time a channel waits before starting compactions to allow time to observe the system and make a smarter decision about what to compact first. Hardly ever changed from the default of 30 (seconds).
The following settings control the resource allocation for a given compaction channel.
There are also several settings that collectively control whether a channel will enqueue a file for compaction and how it prioritizes files within its queue:
Each item must have a priority lower than this to be enqueued. Defaults to infinity.
The item must be no larger than this many bytes in length to be enqueued. Defaults to infinity.
The item must have a priority at least this high to be enqueued. Defaults to 5.0 for ratio and 16 MB for slack.
The minimum number of changes since last compaction before the item will be enqueued. Defaults to 0. Currently only works for databases.
The item must be at least this many bytes in length to be enqueued. Defaults to 1mb (1048576 bytes).
The method used to calculate priority. Can be ratio (calculated as
sizes.file/sizes.active) or slack (calculated as
sizes.file - sizes.active). Defaults to ratio.