Navigation

Connection Alerts

Overview

Connection alerts typically occur when the maximum number of allowable connections to a MongoDB process has been exceeded. Once the limit is exceeded, no new connections can be opened until the number of open connections drops down below the limit.

Exceeding the connection limit for an Atlas cluster may occur for a number of reasons. Different Atlas tiers have different connection limits; clusters of size M0/M2/M5, for example, are limited to 100 connections, and clusters of size M10 are limited to 350 connections. Larger instance sizes have higher connection limits. Different database access applications have different ways of implementing connection pooling, which affects how many open connections your application maintains at any given time.

Fixing the Immediate Problem

M0/M2/M5 Instances

To resolve a connection alert condition, restart the application which is currently making connections to your Atlas cluster. Restarting the application terminates all existing connections opened by the application and allows the Atlas cluster to resume normal operations.

M10+ Instances

Atlas clusters of size M10 and greater can utilize the Test Failover option. The Test Failover procedure steps down the current primary node and triggers an election, which drops all connections to the primary node.

Note

If your application connects exclusively to a secondary node, you may need to perform the Test Failover procedure several times to make sure the applicable secondary node rotates its position within the replica set and drops its connections.

Test Failover is usually the preferable solution, but another possible solution is to restart the application currently making connections to your Atlas cluster. Restarting the application terminates all existing connections and allows the Atlas cluster to resume normal operations.

The Long-Term Solution

Connection alerts are generally a symptom of a larger problem. Employing one of the strategies outlined above will fix the immediate problem, but a permanent solution usually requires either:

  • Examining your database applications for flawed connection code. Situations in which connections are opened but never closed can allow old connections to pile up and eventually exceed the connection limit. Additionally, you may need to implement some form of connection pooling.
  • Upgrading to a larger Atlas instance size which allows a greater number of connections, if your user base is too large for your current instance size.