Persistent High Connection Counts in RDS with Proxy: Seeking Community Insights and Solutions

0

Hello AWS community,

I'm experiencing an issue with persistently high connection counts in my Amazon RDS instance, which is configured with RDS Proxy to enhance performance and prevent saturation. Despite this setup, I consistently observe a minimum of 40 client connections and at least 60 database connections, rarely dropping below these numbers even during off-peak hours.

Here's a brief overview of my architecture:

Application Layer: Several serverless components including numerous AWS Lambda functions. Database: Amazon RDS with RDS Proxy enabled. Despite implementing RDS Proxy to manage database connections efficiently, the number of open connections remains unusually high throughout the day. This issue persists without any apparent spikes in traffic or workload, which should typically reduce the number of connections outside peak times.

Key Points:

  • The client and database connections remain high even during low traffic periods.

  • I have already enabled slow query logs and general logs on RDS to identify problematic queries but haven't pinpointed the cause.

I am looking for advice or diagnostic approaches that might help identify the source of these persistent connections. Are there specific RDS Proxy settings or AWS tools that could help monitor and potentially reduce these constant open connections?

Thank you in advance for your insights and suggestions!

3 Answers
0

Hello.

It is unclear what kind of SQL query Lambda is executing, but is it possible that session fixation is being performed as described in the document below?
When you run certain SQL queries when using RDS Proxy, a phenomenon called pinning occurs.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy-managing.html#rds-proxy-pinning

profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
reviewed 2 months ago
0

Hi,

Thank you so much for your question.

RDS Proxy has the pinning feature to prevent unexpected query results. This feature uses a single dedicated connection per application connection.

You can see how many connection comes from your application and goes to the backend DB instance using the CloudWatch metrics.

  1. DatabaseConnections
  2. ClientConnections
  3. DatabaseConnectionsCurrentlySessionPinned

In addition to this, RDS Proxy automatically scale based on backend DB instance capacity as stated in the document. You can see the estimate number of management connections using SHOW PROCESSLIST.

I hope this might help.

AWS
answered 2 months ago
0

Hi,

I would suggest one very simple thing to start with: create your own measure of the connections from the client side.

For example, having a SQS queue or Redis cache where each of the requesting client deposits a timestampedmark when it starts a request (possibly with the sql request itself) and deposits a second mark when the request ends.

Then, you can easily analyze by parsing those marks what the real database activity is from requester standpoint and also surface the lon-running requests via the timestamps.

Best,

Didier

profile pictureAWS
EXPERT
answered 2 months ago