How to fix connection timeout issues with AWS Lambda in VPCs
Blog post from Momento
Facing critical connection timeouts during load tests with AWS Lambda in VPCs, a Momento customer uncovered underlying networking limitations impacting their serverless architecture. The investigation revealed that the combination of NAT Gateways and Lambda's Hyperplane Elastic Network Interfaces (ENIs) were unable to handle the high-concurrency demands, leading to timed-out connections. Despite internal load tests showing no issues, the customer's architecture, which involved a Lambda function in a VPC connecting to Momento via a NAT Gateway, experienced bottlenecks due to the NAT Gateway’s connection limits and the ENI’s capacity constraints. To resolve these issues, it was recommended to increase network capacity by provisioning additional elastic IPs on the NAT Gateway and adding private subnets to the VPC, thus expanding the capacity for concurrent connections. The process highlighted the importance of careful network capacity planning for high-concurrency scenarios and suggested considering running Lambda outside of a VPC or utilizing PrivateLink to bypass such limitations, with Momento offering a robust solution for connection re-use in Lambda environments.