tencent cloud

TencentDB for MongoDB

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Strengths
Use Cases
Cluster Architecture
Product Specifications
Features
Regions and AZs
Terms
Service Regions and Service Providers
Purchase Guide
Billing Overview
MongoDB Pricing
Billing Formula
Payment Overdue
Backup Space Billing
Configuration Adjustment Billing
Getting Started
Quickly Creating an Instance
Connecting to a TencentDB for MongoDB Instance
Reading/Writing Database
Operation Guide
Access Management
Instance Management
Node Management
Version Upgrade
Network Configuration
Monitoring
Backup and Rollback
Database Audit
Data Security
SSL Authentication
Log Management
Database Management
Multi-AZ Deployment
Disaster Recovery/Read-Only Instances
Parameter Configuration
Recycle Bin
Task Management
Performance Optimization
Data Migration Guide
Practical Tutorial
Optimizing Indexes to Break Through Read/Write Performance Bottlenecks
Troubleshooting Mongos Load Imbalance in Sharded Cluster
Considerations for Using Shard Clusters
Sample of Reading and Writing Data in MongoDB Instance
Methods for Importing and Exporting Data Based on CVM Connected with MongoDB
What to Do for Errors of Repeated Instance Creation and Deletion of Databases with the Same Names?
Troubleshooting MongoDB Connection Failures
Shard Removal Task: Guide for Confirming the Progress and Troubleshooting Issues
Performance Fine-Tuning
Ops and Development Guide
Development Specifications
Command Support in Sharded Cluster v3.2
Command Support in v3.6
Development Ops
Troubleshooting
Increased Slow Queries
Number of Connections Exceeding Limit
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Backup APIs
Account APIs
Other APIs
Task APIs
Introduction
Data Types
Error Codes
Instance Connection
Shell Connection Sample
PHP Connection Sample
Node.js Connection Sample
Java Connection Sample
Python Connection Sample
Python Read/Write Sample
Go Connection Sample
PHP Reconnection Sample
Product Performance
Test Environment
Test Method
Test Result
FAQs
Cost
Features
Sharded Cluster
Instance
Rollback and Backup
Connection
Data Migration
Others
Service Agreement
Service Level Agreement
Terms of Service
Glossary
Contact Us

Connection Management

PDF
Focus Mode
Font Size
Last updated: 2025-11-18 16:35:34

Scenarios

When your business encounters sudden traffic spikes in scenarios such as e-commerce promotions and hot events, a large volume of concurrent requests may cause database instances to reach performance bottlenecks due to an insufficient number of connections. This specifically manifests as client connection failures, application errors, or slow response times. At this time, you can go to the TencentDB for MongoDB monitoring page and check the "current number of connections" metric. If the value persistently approaches or reaches the upper limit of the instance specification, the limit is considered the bottleneck. To quickly meet these requirements and ensure continuous and stable business operation, you can directly increase the value of the"maximum number of connections" in the console. This temporary scale-out approach helps alleviate connection pool pressure quickly, supporting the stable operation of the business during peak periods.

Version Description

Replica set: All MongoDB versions support management of the number of connections.
Sharded cluster: It is not supported in MongoDB 4.2, but is supported in all other versions.

Connection Number Management and Guide

When the system detects a high number of connections to an instance, you can follow the steps below for troubleshooting to ensure the stable operation of the business.
Number
Operation
Specific Description
1
Connection monitoring and manual intervention
The system will log all client IP addresses connected to the instance, along with their respective number of connections. If any abnormal sources are detected or urgent resource release is required, you can interrupt specific connections manually.
2
Dynamic increase in the number of connections
If the current connection utilization reaches 80% or above continuously and impacts the establishment of new connections, you can use the "one-click increase in the number of connections" feature in the console to temporarily increase the connection upper limit to 150% of the original specification within 6 hours, quickly meeting business requirements during peak periods.
3
Asking for further support
If the temporary increase of the number of connections still cannot meet the business requirements, contact after-sales staff or submit a ticket for handling.
4
Long-term optimization suggestions
Instance specification upgrade: If connection number bottlenecks occur frequently, it is recommended to plan an instance upgrade to a higher specification to improve the concurrency processing capability fundamentally.
Connection management optimization: Perform optimizations on the application side, such as using a database connection pool and disabling idle connections promptly to improve connection utilization.

Prerequisites

The status of the replica set instance or sharded cluster instance of TencentDB for MongoDB is Running.
For sharded cluster instances, confirm that the TencentDB for MongoDB version is not 4.2.

Viewing Connection Number Usage

2. In the left sidebar, expand the MongoDB dropdown list, and select either Replica Set Instance or Shard Instance. The operations for replica set instances and sharded cluster instances are similar.
3. Select a region at the top of the instance list page on the right.
4. Find the target instance in the instance list.
5. Click the target instance ID to go to the Instance Details page.
6. Select the Database Management tab, and select the Manage Connection tab.
7. View connection statistics for all clients in the current database.

Parameter Name
Parameter Description
Real-time connections
Statistics on the number of connections in the current database.
Connection Utilization
Percentage of the number of connections for all clients in the current database to the maximum number of connections.
Max connections
Upper limit of the number of connections.
Remaining
Increases the remaining usage time of connections.
Client IP
Client IP address for database connection.
Connections
Connection number statistics.

Increasing the Number of Connections

When the number of connections for the current instance exceeds 80% of the maximum number of connections, you can increase the maximum number of connections temporarily.
1. On the Manage Connection page, click Increase Connections.

2. In the Prompt dialog box, confirm the prompt message, and click OK.

Related APIs

API Name
API
DescribeClientConnections

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback