RDS Proxy causing a consistent increase in DB Connections from Lambda

0

I implemented RDS Proxy with the hopes it would decrease the DB connections from my lambda functions, but so far I seem to see a consistent increase in the number of connections, but no spikes. Is this the expected outcome? Why aren't these connections getting closed?

(started using RDS Proxy at 3pm yesterday afternoon) Enter image description here

  • please accept the answer if it was useful

asked 6 days ago58 views
1 Answer
0

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.
profile picture
EXPERT
answered 6 days ago
profile pictureAWS
EXPERT
reviewed 6 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions