- Newest
- Most votes
- Most comments
This performance difference between direct RDS connections and using RDS Proxy is a known issue that others have experienced. There are several factors that could be causing the slowdown:
-
Proxy Overhead: RDS Proxy introduces additional overhead due to connection pooling and management. This overhead can result in higher query times compared to direct connections, with some users reporting 8-12x slower query times even with a single connection.
-
Connection Management: While RDS Proxy is designed to help with connection pooling, the initial connection establishment can be slower, especially when using IAM authentication and TLS, which you've enabled.
-
Configuration Issues: Your proxy settings might need optimization. Check your connection pool settings, minimum and maximum connections, and idle connection timeout.
To troubleshoot and improve performance:
-
Monitor Metrics: Use CloudWatch to analyze RDS Proxy metrics like DatabaseConnections, ClientConnections, and connection limits.
-
Connection Reuse: Ensure your Lambda code is reusing connections rather than creating new ones for each query.
-
Evaluate Necessity: Consider whether you actually need RDS Proxy. AWS recommends it primarily for production environments with high concurrency that generate many connections in a short period. For Lambdas with lower execution frequency, direct connections might be more efficient.
-
Test Without IAM/TLS: Try testing without IAM authentication and TLS to see if these security features are contributing to the slowdown.
If your current workload doesn't generate connection spikes that risk exhausting database connections, you might be better off continuing with direct connections until your traffic increases to the point where connection pooling becomes necessary.
Sources
RDS Proxy query time is slower than expected | AWS re:Post
Which is preferred, Lambda->RDS Proxy->RDS or Lambda->RDS? | AWS re:Post
RDS Proxy causing a consistent increase in DB Connections from Lambda | AWS re:Post
Relevant content
- asked 2 years ago
- asked a year ago
- asked 7 months ago
