- Newest
- Most votes
- Most comments
Using RDS Proxy should generally help manage and pool database connections from your Lambda functions more efficiently, which should ideally reduce the total number of connections to your RDS database. However, there are several reasons why you might see a consistent increase in the number of connections:
1. Lambda Concurrency: If you have high concurrency in your Lambda functions, each concurrent invocation might need a separate connection, leading the proxy to open more connections to handle the load.
2. Idle Connections: RDS Proxy keeps idle connections open to quickly respond to new requests. These connections might not close immediately if the proxy anticipates a need for them.
3. Connection Pool Settings: The connection pool settings configured in RDS Proxy determine how connections are managed. If the minimum connection count is set high, you might see more persistent connections.
4. Traffic Patterns: If your application experiences consistent traffic, the proxy might keep more connections open to optimize for this pattern, even if the traffic is not spiky.
Steps to Investigate and Optimize
1. Review Proxy Settings:
- Check the minimum and maximum connection settings in your RDS Proxy configuration.
- Adjust these settings based on your application’s actual usage patterns.
2. Monitor Metrics:
- Use Amazon CloudWatch metrics to monitor the number of connections, connection usage, and other relevant metrics for your RDS Proxy and RDS instance.
- Look for patterns and correlate them with your Lambda function invocations.
3. Optimize Lambda Configuration:
- Ensure your Lambda functions are properly reusing database connections. For example, if you're using Node.js, make sure to reuse the connection objects rather than creating new ones for each invocation.
4. Check Idle Timeout:
- Review the idle client timeout settings. This determines how long idle connections are kept open before they are closed.
- Adjusting this setting can help reduce the number of open idle connections.

please accept the answer if it was useful