3.8.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.8.2. View Compaction Options¶
3.8.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.
The maximum number of items the channel can hold (lowest priority item is removed to make room for new items). Defaults to 9999.
The maximum number of jobs that can run concurrently in this channel. Defaults to 1.
The time period during which this channel is allowed to execute compactions. The value for each of these parameters must obey the format HH:MM with HH in [0..23] and MM in [0..59]. Each channel listed in the top-level daemon configuration continuously builds its priority queue regardless of the period defined here. The default is to allow the channel to execute compactions all the time.
If set to
true, any compaction that is still running after the end of the allowed perio will be suspended, and then resumed during the next window. It defaults to
false, in which case any running compactions will be allowed to finish, but no new ones will be started.
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.