- Newest
- Most votes
- Most comments
Right now we are simply trying to measure how much does RDS Proxy will allow to scale connections, the result we are getting suggest that connecting directly to the database is more beneficial since connecting to proxy only gives us at most 1/2 of the max connections of the database.
I tried to increase IP address range in the subnet to /20 which did not have any affect. With MaxDatabaseConnectionsAllowed being 3,396 I would expect to be able to scale my client connections to at least that not a fraction of the max connections on the database side. Keep in mind that we are not pushing any work through the proxy or db. Tried this with and without running sql from the test.
The behavior you're experiencing with RDS PostgreSQL Proxy is related to how the proxy manages connections and its internal capacity. While there isn't a specific setting or formula to determine the exact maximum client connections that RDS PostgreSQL Proxy supports, there are several factors to consider:
-
Connection Pooling: RDS Proxy performs connection pooling separately for the writer and reader instances of the associated RDS database. This optimization reduces the overhead of opening and closing connections.
-
Connection Multiplexing: RDS Proxy uses connection multiplexing (or connection reuse) to perform multiple transactions using a single underlying database connection. This allows for more simultaneous connections to the proxy while maintaining a smaller number of actual connections to the DB instance.
-
Automatic Capacity Adjustment: RDS Proxy automatically adjusts its capacity based on the size and number of DB instances registered with it. However, this adjustment isn't instantaneous and may require additional IP addresses to provision extra capacity.
-
MaxConnectionsPercent: This setting (which you've set to 90%) determines the maximum number of connections that the proxy can establish with the target database as a percentage of the database's max_connections.
-
Reserved Connections: RDS Proxy reserves a certain number of connections for active monitoring, fast failover, traffic routing, and internal operations. These reserved connections are not included in the available connections for your workload.
The fact that you're able to establish only about half the connections through the proxy compared to direct database connections could be due to a combination of these factors. The proxy needs to maintain some headroom for its operations and may not utilize the full 90% of max_connections that you've set.
To address your connection issues during traffic spikes:
-
Ensure you have sufficient free IP addresses in your subnets. RDS Proxy needs these to scale up during high-demand periods.
-
Consider increasing the size of your DB instance, as this can indirectly increase the proxy's capacity.
-
Implement and optimize application-side connection pooling to reduce the frequency of new connection establishments.
-
Monitor the MaxDatabaseConnectionsAllowed metric, which represents the number of connections available to serve the workload.
-
For db.r6i.large instances, consider setting MaxConnectionsPercent to at least 20-30% to allow for sufficient headroom.
-
Review proxy logs to check if connections are experiencing pinning, which can reduce multiplexing efficiency.
If you continue to experience issues, you may need to contact AWS support for a more detailed analysis of your specific setup and usage patterns. They may be able to provide more insight into any potential limitations or optimizations for your particular case.
Sources
RDS Proxy connection considerations - Amazon Relational Database Service
RDS Proxy concepts and terminology - Amazon Relational Database Service
Setting up network prerequisites for RDS Proxy - Amazon Relational Database Service
Modifying RDS Proxy - Amazon Relational Database Service
Relevant content
- asked a year ago
- asked 2 years ago
