---
title: "Compare-Exchange Configuration"
description: "Configure compare-exchange settings in RavenDB, including cleanup intervals and expiration options for automatic item management."
url: "https://docs.ravendb.net/7.2/compare-exchange/configuration"
version: "7.2"
---

# Compare-Exchange Configuration

> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

> **Note**
>
> - For an overview of what configuration options are and how they can be applied,  
>   see the [Configuration Overview](https://docs.ravendb.net/7.2/server/configuration/configuration-options.md) article.
>
> - The following configuration options are available for compare-exchange:
>   - [Cluster.CompareExchangeExpiredDeleteFrequencyInSec](#clustercompareexchangeexpireddeletefrequencyinsec)
>   - [Cluster.CompareExchangeTombstonesCleanupIntervalInMin](#clustercompareexchangetombstonescleanupintervalinmin)
>   - [Cluster.MaxClusterTransactionCompareExchangeTombstoneCheckIntervalInMin](#clustermaxclustertransactioncompareexchangetombstonecheckintervalinmin)
>   - [Cluster.DisableAtomicDocumentWrites](#clusterdisableatomicdocumentwrites)

---

> **Note**
>
> ## Cluster.CompareExchangeExpiredDeleteFrequencyInSec
>
> Time (in seconds) between cleanup of **expired** compare-exchange items.
>
> - **Type**: `int`
> - **Default**: `60`
> - **Scope**: Server-wide only

> **Note**
>
> ## Cluster.CompareExchangeTombstonesCleanupIntervalInMin
>
> - Compare-exchange tombstones are created when compare-exchange items are [deleted](https://docs.ravendb.net/7.2/compare-exchange/delete-cmpxchg-items.md).  
>   These tombstones are not removed immediately - RavenDB uses an internal cleaner task to periodically remove tombstones that are eligible for deletion.
>
> - This configuration option sets the interval, in minutes, between each cleanup run.
>
> - At each interval, the cleaner will only remove tombstones that are ready for removal - meaning their deletion has already been processed by all relevant subscribers.
>   Subscribers are internal RavenDB processes that need to observe or react to compare-exchange deletions,
>   such as indexes, ETL tasks, subscriptions, etc.  
>   Tombstones become eligible for removal only after all such processes have handled the deletion.
>
> ---
>
> - **Type**: `int`
> - **Default**: `10`
> - **Scope**: Server-wide only

> **Note**
>
> ## Cluster.MaxClusterTransactionCompareExchangeTombstoneCheckIntervalInMin
>
> EXPERT ONLY:
>
> - This configuration sets the interval (in minutes) between checks for compare-exchange tombstones that can be marked for deletion by the cluster-wide transaction mechanism on the node.
>   This is separate from checks performed by other subscribers (such as indexes, subscriptions, or ETL tasks).
>
> - Normally, whenever a cluster-wide transaction command is processed, the cluster-wide transaction mechanism checks for compare-exchange tombstones that can be marked as eligible for deletion.
>   If no cluster-wide transaction command occurs within the specified interval, the mechanism will automatically perform this check after the configured time has elapsed.
>
> - Any tombstones that have been fully handled by the cluster-wide transaction mechanism will be marked for deletion, making them eligible for cleanup by the tombstone cleaner task.
>
> ---
>
> - **Type**: `int`
> - **Default**: `5`
> - **Scope**: Server-wide only

> **Note**
>
> ## Cluster.DisableAtomicDocumentWrites
>
> EXPERT ONLY:  
> Disable automatic atomic writes with cluster write transactions.  
> If set to *true*, will only consider explicitly added compare exchange values to validate cluster wide transactions.
>
> - **Type**: `bool`
> - **Default**: `false`
> - **Scope**: Server-wide or per database
