Avoiding Connection Pinning in AWS Lambda and RDS Proxy: A Solution for Scalability

A common issue in deploying applications on Amazon Web Services (AWS) is connection pinning, which can lead to concurrency limits being exceeded. In a recent experience, the author of this article encountered such an issue when using AWS Lambda and RDS Proxy with Aurora. The concurrency limit was consistently exceeded, despite increasing the limit through AWS Service Quotas.

The root cause of the problem was identified as connection pinning, caused by query text sizes exceeding 16 KB. To address this issue, the author implemented proxy splitting, creating a new RDS Proxy specifically for the problematic API and configuring separate data sources in NestJS.

This solution allowed the application to stay within the set limits and maintain operations without exceeding Aurora's connection limits. The approach provides a short-term fix until a full migration to ECS on Fargate can be implemented.

Source: https://dev.to/suzuki0430/avoiding-connection-pinning-in-lambda-and-rds-proxy-with-nestjs-and-proxy-splitting-2l44

Reply to this note

Please Login to reply.

Discussion

No replies yet.