What Can I Do If the Number of Connections of an Instance Reaches Its Maximum?
The number of connections indicates the number of applications that can be simultaneously connected to the database. The number of connections is irrelevant to the maximum number of users allowed by your applications or websites.
- For a cluster instance, the number of connections is the number of connections between the client and the dds mongos nodes.
- For a replica set instance, the number of connections is the number of connections between the client and the primary and secondary nodes.
- For a single-node instance, the number of connections is the number of connections between the client and the node.
When the number of connections to a DDS instance reaches the maximum supported, new connection requests cannot be responded to, and the connection attempt fails.
Symptom
- If the following information is displayed when you use Mongo Shell to connect to an instance, no more connections can be established.
Figure 1 Message displayed
Handling Method
- Check what applications are connected, optimize the connections, and release any that are not necessary.
- Check the value of the net.maxIncomingConnections parameter and the instance specifications. Change the parameter value or the database specifications.
- Check for abnormal metrics and alarms on the Cloud Eye console. Cloud Eye monitors database metrics, such as the CPU usage, memory usage, storage space usage, and database connections, and allows you to set alarm policies to identify risks in advance if any alarms are generated. For details, see the Cloud Eye User Guide.
Solution
- Release unnecessary connections.
- You can restart the instance to release all of the connections. For details, see Restarting an Instance or a Node.
- You can query the current number of connections on a node and the connection source, analyze the number of connections established between each client and the instance, and adjust the number of connections. For details, see How Do I Query and Limit the Number of Connections?
- Change parameter values or database specifications.
You can change the maximum number of connections of a DB instance by modifying the net.maxIncomingConnections parameter. For details about how to change parameter values, see Editing a Parameter Template.
- If the value is default, the maximum number of connections is the default value and is related to the instance specifications. For details, see Instance Specifications.
- If there are too many connections, the service may break down. In this case, you can increase the number of connections by changing the instance specifications. For details, see Changing a Cluster Instance Class.
If a default parameter template is used, you cannot change its settings. You can create a parameter template and change the corresponding parameter values. After the change, associate the new parameter template with the instance.
- Check whether there are slow queries. You can add indexes to improve queries.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot