0
votes

Let's say I want to use RDS Proxy for my Spring Boot application running in EC2/ECS/EKS, I have everything working as expected using standard JDBC connection configuration. Do I still need to configure application side connection pooling using libraries like C3P0 or would that be redundant?

I'm assuming the benefits of using RDS Proxy is to be able to share connection pools across multiple different types of applications (serverless and none serverless) that connect to the same DB.

1
It depends on your architecture. Some folks still use both DB level proxy and application-level connection poolers. (Eg: Elixer apps) but the end of the day the DB level proxy will have more advantages.(like proxysql)TheDataGuy

1 Answers

0
votes

I'm mostly going to reuse the answer that I just gave to another question, Does RDS proxy affects current application side pooling?:

With a database proxy in the middle, there are two separate legs to a "connection":

  1. First, there is a connection from the application to the proxy. What you called the "application side pooling" is this type of connection. Since there's still overhead associated with creating a new instance of this type of connection, continuing to use a connection pool in your application probably is a good idea.
  2. Second, there is a connection from the proxy to the database. These connections are managed by the proxy. The number of connections of this type is controlled by a proxy configuration. If you set this configuration to 100%, then you're allowing the proxy to use up to the database's max_connections value, and other clients may be starved for connections.

So, the application connection pool is not redundant. When your application wants to use a connection, it needs to get a connection from its local pool. Then, the proxy needs to pair that with a connection to the database. The proxy will reuse connections to the database where possible (this technique also is called multiplexing).

Or, quoting the official docs: "You can open many simultaneous connections to the proxy, and the proxy keeps a smaller number of connections open to the DB instance or cluster. Doing so further minimizes the memory overhead for connections on the database server. This technique also reduces the chance of "too many connections" errors."

Going back to your original question, yes, "share connection pools across multiple different types of applications" is one of the benefits: you don't have to configure your different application connection pools to stay within the database's max_connections value. Other benefits of RDS Proxy, including efficiency, failover, security, etc., are covered in the official docs.