Reputation: 11
We are using AWS RDS Aurora Cluster with AWS RDS Proxy connected to a Payara Micro Application using PostgreSQL. We are receiving exceptions from time to time in our application ("PSQLException: This connection has been closed"). We identified the reason for this to be the maximum session lifetime in the RDS Proxy. As per the aws documentation:
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy-connections.html
"Client connection max life: RDS Proxy enforces a maximum life of client connections of 24 hours. This value is not configurable. Configure your pool with a maximum connection life less than 24 hours to avoid unexpected client connection drops."
We can see, that the connection drops happen exactly at the times when the proxy closes a client connection with the message: "The client connection closed. Reason: The connection exceeded the maximum connection duration."
Therefore we are now trying to limit the max connection lifetime in our application to prevent the connection drops. We're using the Payara Micro native connection pool.
How would one achieve to limit the max connection lifetime with a standard connection pool? I know that Hikari offers this feature, but switching connection pools is not a feasible option.
We approached the AWS support and they could not provide a suitable solution about the max lifetime. However they suggested we turn on connection recycling, using the "max-connection-usage-count" property. This should help with our connection drops, but I still want to explore the option to set a max lifetime to be safe.
Upvotes: 1
Views: 34