Docs Menu
Docs Home
/
MongoDB Atlas
/ /

Configure Auto-Scaling

On this page

  • How Atlas Scales Cluster Tier
  • Scaling Up a Cluster Tier
  • Scaling Down a Cluster Tier
  • Scaling a Sharded Cluster
  • How Atlas Scales Cluster Storage
  • Cluster Tier and Cluster Storage Might Scale in Parallel
  • Oplog Considerations
  • Configure Auto-Scaling Options
  • Auto-Scaling Enabled by Default
  • Review the Cluster Tier Auto-Scaling Options
  • Opt Out of Cluster Tier and Storage Auto-Scaling
  • Review Auto-scaling Activity Feed
  • Configure Alerts for Auto-scaling Events

Note

Feature Availability

Atlas cluster tier auto-scaling is available for all dedicated cluster tiers under the General and the Low-CPU cluster classes.

You can configure the cluster tier ranges that Atlas uses to automatically scale your cluster tier, storage capacity, or both in response to cluster usage.

Atlas auto-scaling adjusts cluster tier based on real-time resource usage. The improved auto-scaling engine can now more accurately detect sustained higher demand and short-term peak traffic for upscaling decisions. Similarly, Atlas makes downscaling choices more promptly, for more optimized resource utilization and cost profile.

To help control costs, you can specify a range of maximum and minimum cluster sizes that your cluster can automatically scale to.

Auto-scaling works on a rolling basis, and the process doesn't incur any downtime. Atlas maintains a primary during this process but the nodes are upgraded one by one and will be unavailable while being upgraded.

Note

Tier Availability

Automatic scaling works on cluster tiers in General and Low-CPU classes, but not on clusters in the Local NVMe SSD class.

Atlas analyzes the following cluster metrics to determine when to scale a cluster, and whether to scale the cluster tier up or down:

  • Normalized System CPU Utilization

  • System Memory Utilization

Atlas calculates system System Memory Utilization based on available node memory and total memory as follows:

(memoryTotal - (memoryFree + memoryBuffers + memoryCached)) / (memoryTotal) * 100

In the previous calculation, memoryFree, memoryBuffers, and memoryCached are amounts of available memory that Atlas can reclaim for other purposes. To learn more, see System Memory in Review Available Metrics.

Atlas won't scale your cluster tier if the new cluster tier would fall outside of your specified Minimum and Maximum Cluster Size range.

Atlas scales your cluster to another tier in the same class. For example, Atlas scales General clusters to other General cluster classes, but doesn't scale General clusters to Low-CPU cluster classes.

The exact auto-scaling criteria are subject to change in order to ensure appropriate cluster resource utilization.

Important

During a migration, if you restore a snapshot with a larger size than the storage capacity of the destination cluster, the cluster does not automatically scale.

If you deploy read-only nodes and want your cluster to scale faster, consider adjusting your Replica Set Scaling Mode.

To effectively manage dynamic workloads for your applications, Atlas scales up nodes in your cluster under the conditions described in this section.

If the next cluster tier is within your Maximum Cluster Size range, Atlas scales the nodes in your cluster up to the next tier if at least one of the following criteria is true for any node of the specified type in the cluster:

  • Operational nodes:

    • For operational nodes in M10 clusters, the average Normalized System CPU Utilization or the System Memory Utilization has exceeded 75% of resources available to the cluster for the past one hour.

    • For operational nodes in M20 clusters, the average Normalized System CPU Utilization or the System Memory Utilization has exceeded 90% of resources available to the cluster for at least 20 minutes, or has exceeded 75% of resources available to the cluster for at least one hour.

    • For operational nodes in M30+ clusters, the average Normalized System CPU Utilization or the System Memory Utilization has exceeded 90% of resources available to the cluster for the past 10 minutes, or has exceeded 75% of resources available to the cluster for at least one hour.

      These thresholds ensure that your cluster scales up quickly in response to high loads, and your application can handle spikes in traffic or usage, maintaining its performance and reliability.

  • Analytics nodes:

    • The average Normalized System CPU Utilization or the System Memory Utilization has exceeded 75% of resources available to the cluster for the past hour.

Atlas scales a cluster to the next tier when the cluster hasn't been scaled up under the following conditions:

  • The M10+ cluster hasn't been scaled up in the past hour.

  • The M20+ cluster hasn't been scaled up in the past 20 minutes or one hour, depending on thresholds.

  • The M30+ cluster hasn't been scaled up in the past 10 minutes or one hour, depending on thresholds.

For example, Atlas will scale an M30+ cluster at T+10, if the cluster's current Normalized System CPU Utilization is greater than 90%.

Important

Sudden Workload Spikes

Scaling up to a greater cluster tier requires enough time to prepare backing resources. Automatic scaling may not occur when a cluster receives a burst of activity, such as a bulk insert. To reduce the risk of running out of resources, plan to scale up clusters before bulk inserts and other workload spikes.

To optimize costs, Atlas scales down nodes in your cluster under the conditions described in this section.

If the next lowest cluster tier is within your Minimum Cluster Size range, Atlas scales the nodes in your cluster down to the next lowest tier if all of the following criteria are true for all nodes of the specified cluster type:

  • Operational nodes:

    • The average Normalized System CPU Utilization is below 50% of resources available to the cluster over at least the last 4 hours.

    • The average WiredTiger's cache usage is below 90% of the maximum WiredTiger cache size for at least 4 hours at the current cluster tier size. This indicates to Atlas that the current cluster isn't overloaded.

    • The projected total System Memory Utilization at the new lower cluster tier is below 60% for at least 4 hours. Atlas calculates the projected total memory usage mentioned in the preceding statement as follows.

      Atlas measures the current memory usage and replaces the current WiredTiger cache usage size with 80% of the WiredTiger cache size on the new lower tier cluster.

      Next, Atlas checks whether the projected total memory usage would be below 60% for at least 4 hours on the new tier size.

      Note

      Atlas includes the WiredTiger cache in its memory calculation to make it more likely that clusters with a full cache, but otherwise low traffic will scale down. In other words, Atlas examines the size of the WiredTiger cache to determine that it can safely down scale an otherwise idle cluster with low Normalized System CPU Utilization in cases where the cluster's WiredTiger caches might reach 90% of the cluster's maximum WiredTiger cache size.

    • The cluster hasn't been scaled down (manually or automatically) in the past 24 hours.

    These conditions ensure that Atlas scales down operational nodes in your cluster to prevent high utilization states.

  • Analytics nodes:

    • The average Normalized System CPU Utilization and System Memory Utilization over the past 24 hours is below 50% of resources available to the cluster.

    • The cluster hasn't been scaled down (manually or automatically) in the past 24 hours.

    Note

    M10 and M20 clusters use lower thresholds to account for caps on CPU usage set by cloud providers after burst periods. These thresholds vary depending on your cloud provider and cluster tier.

  • When Atlas scales down the storage capacity of your cluster, this can take longer than expanding storage capacity due to the mechanics of the scaling process.

  • Estimate your deployment's range of workloads and then set the Minimum Cluster Size value to the cluster tier that has enough capacity to handle your deployment's workload. Account for any possible spikes or dips in cluster activity.

  • You can't scale to a cluster tier smaller than M10.

  • You can't select a minimum cluster tier that is below the current disk configuration of your cluster. If your storage increases beyond what is supported by your minimum cluster tier, Atlas increases your clusters storage configuration beyond what your minimum cluster tier supports, then Atlas automatically adjusts your minimum cluster tier to a tier that supports the current storage requirements of your cluster.

    Example

    You have set your auto-scaling bounds to M20 - M60 and your current cluster tier is M40 with a disk capacity of 200GB. Atlas triggers a disk auto-scaling event to increase capacity to 320GB because current disk usage exceeds 180GB, which is more than 90% of the 200GB capacity.

    Atlas:

    1. Raises your minimum cluster tier to the next lowest tier, M30, that can accommodate the new storage capacity. M20 supports a maximum storage capacity of 256GB, so it is no longer a valid auto-scaling bound.

    2. Atlas determines that the current instance size, M40, supports the new disk configuration. The disk auto-scaling event succeeds.

Atlas auto-scales the cluster tier for sharded clusters using the same criteria as replica sets. Atlas applies the following rules:

  • Auto-scaling applies to all shards in the sharded cluster. You can't apply auto-scaling for some shards and not for others within the same cluster.

  • If any shard meets the criteria to auto-scale its cluster tier up, all shards will scale their cluster tier up.

  • All shards in the cluster must meet the criteria before Atlas will auto-scale the cluster tier down.

  • The Config server replica set doesn't auto-scale.

Atlas enables cluster storage auto-scaling by default. Atlas automatically increases cluster storage when disk space used reaches 90% for any node in the cluster.

The following considerations apply:

When Atlas attempts to automatically scale your cluster storage capacity, it might need to scale your storage outside of the bounds that your current cluster tier supports. To help ensure that your cluster doesn't experience any downtime, Atlas scales your cluster tier (in addition to cluster storage) to accommodate the new storage capacity.

On Azure, if you enable auto-scaling on a cluster deployed in one of the regions that support extended storage, and the current IOPS is lower than the default IOPS for the auto-scaled disk size, Atlas increases the alloted number of IOPS in the IOPS slider and notifies you in the UI. To learn more, see Extend Storage Capacity and IOPS on Azure.

Example

The maximum storage capacity for an M30 cluster is 480 GB. If you have an M30 cluster with the maximum storage allocated and your disk space used reaches 90%, a storage auto-scaling event requires raising your storage capacity to 600 GB. In this case, Atlas scales your cluster tier up to M40 because this is the lowest cluster tier that can support the new required storage capacity. On Azure, if you deployed the cluster in one of the regions that support extended storage, Atlas also automatically increases IOPS to match the IOPS level for that tier's cluster.

In the event that your specified maximum cluster tier can't support the new storage capacity, Atlas:

  1. Raises your maximum cluster tier to the next lowest tier that can accommodate the new storage capacity.

  2. Scales your cluster tier to that new maximum tier.

Note

When Atlas overrides your maximum cluster tier, it also disables your cluster from automatically scaling down. To re-enable downward auto-scaling, configure it in Cluster Settings. See also Considerations for Downward Auto-Scaling of Cluster Tier and Storage.

If Atlas attempts to scale your cluster tier down and the target tier can't support your current disk capacity, provisioned IOPS, or both, Atlas doesn't scale your cluster down. In this scenario, Atlas updates your auto-scaling settings based on the relationship between your current cluster tier and the configured maximum cluster tier:

  • If the cluster is currently at the configured maximum cluster tier, Atlas disables the cluster from automatically scaling down because all smaller tiers wouldn't be able to accommodate the necessary storage settings. If you want to re-enable downward auto-scaling, you must do so manually from your Cluster Settings.

  • If the cluster isn't currently at the configured maximum cluster tier, Atlas raises the minimum cluster tier to the current cluster tier. In this case, Atlas doesn't disable downward auto-scaling.

This auto-scaling logic reduces the downtime in cases when your storage settings don't match your workload.

Depending on whether you choose to use storage auto-scaling, Atlas manages the oplog entries based on either the minimum oplog retention window, or the oplog size. To learn more, see Oplog Size Behavior. Atlas enables storage auto-scaling by default.

You can configure auto-scaling options when you create or modify a cluster. For new clusters, Atlas automatically enables cluster tier auto-scaling and storage auto-scaling.

You can do one of the following:

  • Review and adjust the upper and lower cluster tiers that Atlas should use when auto-scaling your cluster, or

  • Opt out of using auto-scaling.

Atlas displays auto-scaling options in the Auto-scale section of the cluster builder for General and Low-CPU tier clusters.

When you create a new cluster, Atlas enables auto-scaling for cluster tier and cluster storage. You don't need to explicitly enable auto-scaling. If you prefer, you can opt out for cluster tier and cluster storage.

Note

Atlas enables cluster tier auto-scaling by default when you create clusters in the Atlas UI. If you create clusters with the API, Atlas disables cluster tier auto-scaling by default.

With auto-scaling enabled, your cluster can automatically:

  • Scale up to increase capability with a higher cluster tier.

  • Decrease the current cluster tier to a lower cluster tier.

In the Cluster tier section of the Auto-scale options, you can specify the Maximum Cluster Size and Minimum Cluster Size values that your cluster can automatically scale to. Atlas sets these values as follows:

  • The Maximum Cluster Size is set to one tier above your current cluster tier.

  • The Minimum Cluster Size is set to the current cluster tier.

To review the enabled auto-scaling options for cluster tier and storage:

  1. In the selected Auto-Scale checkbox, review the Maximum Cluster Size and Minimum Cluster Size values, and adjust them if needed.

  2. Review the Allow cluster to be scaled down option that is checked by default when you create a new cluster.

  3. Review the options under the Storage Scaling checkbox that is checked by default.

To opt out of cluster auto-scaling (increasing the cluster tier), when creating a new cluster, navigate to the Cluster Tier menu, and un-check the Cluster Tier Scaling checkbox in the Auto-scale section.

To opt out of cluster auto-scaling (decreasing the cluster tier), when creating a new cluster, navigate to Cluster Tier menu, and un-check the Allow cluster to be scaled down checkbox in the Auto-scale section.

To opt out of cluster storage scaling, un-check the Storage Scaling checkbox in the Auto-scale section.

You can view Activity Feed to review the events for each Atlas project. When an auto-scaling event occurs, Atlas logs the event in the project Activity Feed.

To view or download only auto-scaling events:

  1. In the Activity Feed, click the Filter by event(s) menu and check Atlas.

  2. In the search box above the list, start typing auto-scaling.

    In the right-hand side of the menu, all auto-scaling events display. Deselect any that you don't want to see. The feed list automatically updates with each change you make.

Important

In early August 2024, Atlas replaced legacy auto-scaling notification emails with configurable auto-scaling events. By default, Atlas continues to send all alert notifications to the project owners. You can customize your auto-scaling alert distribution to change alert recipients or a distribution method.

Auto-scaling activities are a subset of Atlas alerts.

Atlas automatically sets up default alerts for auto-scaling events. You can opt out of or change alert configuration for some or all auto-scaling events at a project level.

To modify an alert configuration, in the Category section, select Atlas Auto Scaling and then select the Condition/Metric from the list. You can then modify roles for alert recipients, change a notification method, such as email or SMS, and add a notifier, such as Slack. To learn more, see Configure an Auto-scaling Alert.

Back

Storage