Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/
Atlas
/ /

Write-Blocking

If Atlas identifies that your cluster's primary node exceeds write-blocking policy thresholds, Atlas blocks writes to the cluster until disk utilization falls below the unblocking thresholds. When MongoDB receives writes to a cluster, it flushes data to disk in bulk, which can result in large jumps in disk utilization. Running out of disk space on the primary node may result in cluster downtime, especially if disk exhaustion cascades through all replica set nodes.

To prevent this scenario, when Atlas observes that the cluster's primary node disk exceeds critical write-blocking policy thresholds, Atlas blocks writes to the cluster's primary node. Atlas continues to blocks writes until disk utilization falls below the unblocking thresholds.

By activating write-blocking behavior on the primary node, Atlas:

  • Prevents cluster unavailability due to disk exhaustion on the primary node.

  • Allows clusters operating close to maximum storage utilization to retain read availability in cases of sudden spikes in write volume.

Cluster write-blocking behavior is part of Intelligent Workload Management (IWM) in MongoDB Atlas. IWM is a dynamic resource manager that enables real-time workload monitoring and automated safeguards to maintain high availability under load.

Write-blocking behavior has the following considerations:

  • Atlas currently blocks writes to the primary node on replica sets (non-sharded clusters) on dedicated clusters running MongoDB 8.0+.

  • Atlas doesn't block writes on free and Flex clusters.

  • Atlas monitors disk utilization on the primary node only. Atlas doesn't monitor disk utilization on secondary, read-only, search, or analytics nodes.

To block writes, Atlas uses the following process:

To prevent write-blocking behavior from occurring and bring the cluster below the Atlas write-blocking policy thresholds, we recommend that you:

  • Enable storage auto-scaling, which automatically scales your cluster storage when disk utilization exceeds 90% and ensures consistent workload availability and performance.

    To enable storage auto-scaling in the Atlas UI, navigate to the Cluster Tier menu and check the Storage Scaling checkbox in the Auto-scale section.

    • For all new clusters that you create in the Atlas UI, Atlas enables storage auto-scaling by default.

    • If you create clusters with the API, cluster auto-scaling isn't selected by default and you must explicitly enable it, using the options in the autoScaling object of the Update One Cluster in One Project endpoint.

  • If you choose to opt out of storage auto-scaling and your disk utilization is close to 90%, you can release existing disk space before Atlas activates write-blocking behavior on your cluster:

Atlas uses the following write-blocking thresholds to accommodate disk utilization scenarios with high write volume:

Disk size < 20 GB

Atlas blocks writes when free disk space drops below 800 MB. Atlas unblocks writes when disk space exceeds 1.2 GB.

Disk size < 1.25 TB

Atlas blocks writes when free disk space drops below 4% of total disk size. Atlas unblocks writes when disk space exceeds 6% of total disk size.

Disk size ≥ 1.25 TB

Atlas blocks writes when free disk space drops below 50 GB. Atlas unblocks writes when free disk space exceeds 75 GB.

The thresholds are not configurable. If the disk size increases due to auto-scaling, or if you manually increase the disk size, Atlas automatically adjusts the thresholds based on cluster's disk size.

Once write-blocking behavior is active in your cluster, you:

  • Can increase cluster storage manually from the Edit Cluster page or enable storage auto-scaling in the Atlas UI to avoid any future write-blocking behavior.

  • Cannot delete indexes or collections because Atlas blocks operations that require writing to the database. To delete indexes and collections, increase the cluster storage.

Atlas blocks writes when free disk space on the primary node reaches approximately 96% of total disk size, with the caveats for small and large disks noted in the write-blocking policy thresholds.

By comparison, auto-scaling triggers when disk utilization reaches 90% of total disk size. This means that:

  • If you enable auto-scaling, your cluster has the opportunity to scale up before write-blocking behavior activates.

  • If you disable auto-scaling, you must monitor disk utilization and take action to prevent write-blocking behavior from activating.

When Atlas blocks writes to the cluster, the following actions occur:

Atlas unblocks writes when free disk space increases 50% over the blocking threshold. The extra buffer to unblock writes ensures that:

  • Atlas doesn't enable and disable write-blocking behavior in quick succession.

  • The cluster remains in a good state as it begins accepting writes again.

For the exact parameters, see write-blocking policy thresholds.

Back

Cluster Sharding

On this page