Connection pooling and connection-storm control for Atlas (serverless and Lambda clients)
Parent: Cluster Tier Limits and Feature Gates as Cost Drivers (Connections, IOPS Caps, Minimum Tiers) · Published reference · snapshot 2026-10-22 · skill mongodb-cohort-2a03c480ee30
↓ Facts as markdown↓ Portable .llms packagent context libraries
Source-anchored research for Connection pooling and connection-storm control for Atlas (serverless and Lambda clients). 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.
Problems, failure modes and limitations
- maxPoolSize limits one connection pool, not the total connections from a Lambda fleet. MongoDB warns that separate clients create independent pools, and AWS provisions separate execution environments for concurrent requests, so per-client limits alone cannot cap fleet-wide Atlas connections. (high confidence) Sources: https://www.mongodb.com/docs/manual/troubleshooting/connection-storms.md ; https://docs.aws.amazon.com/lambda/latest/dg/lambda-concurrency.html [source 1] [source 2]
- maxConnecting limits simultaneous connection establishment within one pool. MongoDB says raising it speeds pool growth but increases connection-storm risk, while a value that is too low can throttle pool fill and increase tail latency; it does not limit the number of Lambda environments. (medium confidence) (verified as of 2026-10-14) [source 1] [source 2]
- MongoDB recommends checking sudden increases in connections.current and connections.active, rapidly increasing connections.totalCreated, spikes in metrics.network.totalIngressTLSHandshakeTimeMillis, log messages (large numbers of "Connection accepted" messages with a rapidly increasing connectionCount), and, on Atlas, the Metrics > Connections graphs when diagnosing a connection storm. Sources: https://www.mongodb.com/docs/manual/troubleshooting/connection-storms.md [source 1] [source 2]
- Atlas sets maximum incoming connections per node based on cluster tier and class; sharded-cluster limits apply per mongos router. When an application reaches the applicable limit, Atlas can reject connections, and a higher tier can raise the per-node ceiling. (high confidence) (verified as of 2026-10-14) Sources: https://www.mongodb.com/docs/atlas/reference/atlas-limits.md ; https://www.mongodb.com/docs/manual/troubleshooting/connection-storms.md [source 1] [source 2]
Comparisons and alternatives
- As of 2026-10-22, Lambda Managed Instances with Node.js can process multiple concurrent requests in one execution environment and share global state across them. This differs from standard Lambda's one-in-flight-request-per-environment model, so standard Lambda's environment-to-pool arithmetic should not be applied unchanged. (high confidence) (verified as of 2026-10-22) [source 1] [source 2]
Facts and statements
- For standard AWS Lambda functions, create one MongoClient outside the handler and reuse it across warm invocations in that execution environment. Creating a new MongoClient for every invocation creates independent pools and can exhaust database connection limits. (high confidence) [source 1] [source 2] [source 3] [source 4] [source 5] [source 6]
- For standard Lambda functions, reserved concurrency caps the maximum number of concurrent invocations and can bound the number of active execution environments and their client pools during a spike. Invocations are throttled at the configured ceiling, so this limits downstream connection pressure by trading away excess request concurrency. (high confidence) (verified as of 2026-10-22) [source 1] [source 2] [source 3] [source 4]
- In a July 2025 Stack Overflow question, the author reported that about ten Lambda functions were triggered per second and that each created a ten-connection pool. The author reported temporarily setting SQS batch size, Lambda reserved concurrency and maxConnectionPoolSize to one, and explicitly called this workaround neither scalable nor ideal. These are the author's reported settings, not validated MongoDB driver option names or general defaults. (low confidence) (verified as of 2025-07-19) [source]
- In standard Lambda, scale-out adds execution environments when no pre-initialized environment is available for a request. Each MongoClient instance manages its own connection pool, so if each execution environment holds its own client, client reuse within warm environments does not make total Atlas connection demand independent of Lambda scale. Across many concurrent requests or short-lived execution environments, per-environment pools multiply the total number of open connections and can trigger connection storms. Sources: https://docs.aws.amazon.com/lambda/latest/dg/lambda-concurrency.html ; https://www.mongodb.com/docs/manual/administration/connection-pool-overview.md ; https://www.mongodb.com/docs/manual/troubleshooting/connection-storms.md [source 1] [source 2] [source 3] [source 4]
- Lambda can purge idle connections, so a cached client does not guarantee that every pooled socket remains usable across warm invocations. AWS recommends keep-alive behavior, and MongoDB's Lambda guidance says tuning maxIdleTimeMS can reduce serverless timeout errors. (medium confidence) Sources: https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html ; https://www.mongodb.com/docs/atlas/manage-connections-aws-lambda.md [source 1] [source 2]
Children
- No children recorded.