Cloud Run Atlas Connection Pooling
Parent: MongoDB Atlas on GCP · Published reference · snapshot 2026-10-22 · skill mongodb-cohort-2a03c480ee30
↓ Facts as markdownall context files
Source-anchored research for Cloud Run Atlas Connection Pooling. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
How it works
- MongoDB recommends reusing one MongoClient per process. Combined with Cloud Run's independently scaled instances, this means each instance has its own process-local client pool and the service's potential connection count grows with active instances and the connected topology. This is a capacity inference; it does not mean every pool reaches its ceiling. (medium confidence) (verified as of 2026-10-20) [source]
- Cloud Run concurrency limits simultaneous requests per instance, not MongoDB sockets. For a fixed request volume, lower concurrency can require more instances, while higher concurrency can let fewer instances serve traffic when the application handles parallel work; because client pools are process-local, concurrency changes the number of pools indirectly. (medium confidence) (verified as of 2026-10-20) [source]
Problems, failure modes and limitations
- In a Node.js Cloud Run service, follow the driver's one-MongoClient-per-process reuse recommendation and place the reusable client outside per-request logic. Google's Cloud Run guide says global-scope objects can be reused by later requests on the same instance, but whether an individual request benefits from that reuse cannot be known ahead of time. (high confidence) [source]
- Cloud Run concurrency and maximum-instance settings affect the connection envelope: lower concurrency can require more instances for the same traffic, and a maximum-instance setting can limit connections to a backing database but may be exceeded briefly during traffic spikes. Set these controls against the application's tested concurrency and Atlas connection budget, with headroom for temporary scale-out. (medium confidence) (verified as of 2026-10-20) [source]
- Google documents the Cloud Run maximum-instance setting as a way to limit connections to a backing database and recommends a service-level cap. The configured maximum can be exceeded briefly during traffic spikes, and separate revision limits can overlap during deployments, so a pool budget should include headroom. (medium confidence) (verified as of 2026-10-20) [source]
Comparisons and alternatives
- Each MongoClient owns a pool for each server in its topology, and Cloud Run instances cannot share process-local pools. Estimate Atlas connection pressure across all simultaneously live clients and instances rather than treating one Cloud Run service as one pool. (medium confidence) [source]
- Atlas sets concurrent open-connection limits by cluster tier and class; the limits apply per node, or per mongos router for sharded clusters. Atlas documents new-connection-per-second limits separately, with applicability depending on tier and MongoDB version, and says its autoscaling responds to memory and compute use rather than connection count by itself. (low confidence) (verified as of 2026-10-20) [source]
Facts and statements
- Revel's public field report describes multiple Cloud Run Spring Boot services connecting to Atlas and attributes near-cap connection counts during scale-out to each container holding its own pool. The report's suggested pool, concurrency, and instance settings were proposals for that workload, not general defaults or validated results. (low confidence) [source]
- The current Node.js driver documentation says each MongoClient has a pool for each server, opens application sockets on demand, defaults maxPoolSize to 100 per pool, and opens up to two additional monitoring connections per server. The 100 value is a per-server ceiling, not the number every Cloud Run instance necessarily opens. (low confidence) (verified as of 2026-10-22) [source]
- A May 2022 Stack Overflow question reports up to 130 Atlas connections while its author saw five or six Cloud Run instances. The author's accepted self-answer proposes rapid scale-out and Mongoose's pool ceiling as the explanation. This is one author's workload report and proposed diagnosis, not a measured general connection count per Cloud Run instance. (low confidence) (verified as of 2022-05-07) [source]
Children
- No children recorded.