问题
We are trying to add AWS X ray JDBC interceptor to our lambda functions and in order to add JDBC interceptor we have added Tomcat JDBC datasource with max active and max idle connection as 1. Connections are not getting reused and we are getting lot of "connection already closed error". Another pattern we observed is Lambda is taking almost 10 minutes to flush the connection from Aurora DB. Did any one successfully implemented connection pooling with Lambda.( Java 8) and RDS (Aurora).
回答1:
I've had some recent success with the latest MariaDB Connector-J and aurora
failover. I've had no issues with any queries as of yet with my jdbc
url like jdbc:mariadb:aurora://host:port/db?...
See https://mariadb.com/kb/en/the-mariadb-library/failover-and-high-availability-with-mariadb-connector-j/#specifics-for-amazon-aurora
I'm still working on error-free connection pooling, but I'm running into the occasional DEBUG from HikariCP about TransientConnectionError
or the MariaDB Connector-J with NullPointerException
来源:https://stackoverflow.com/questions/44581622/aws-lambda-rds-connection-pooling