问题
I'm using C3P0 connection pool and PostgreSQL(10.3) in AWS RDS.
I did a load test at low TPS (1 TPS) for 2 minutes, after load test finished, the number of connections were not dropped according to the monitoring board in AWS RDS. (See below). Neither did CPU utilization.
I'm still new to database, not sure if this is expected? This seems like it's reaching RDS instance's max_connection. I did a select
from pg_stat_activity
, 99% of connections are idle
, and most of the queries are SHOW TRANSACTION ISOLATION LEVEL
and SELECT 1
.
Here's my C3P0 config:
maxConnection: 100
initialPoolSize: 1
minPoolSize: 1
acquireIncrement: 1
idleConnectionTestPeriod: 40
maxIdleTime: 20
maxConnectionAge: 30
maxStatements:0
numHelperThread:5
preferredTestQuery: SELECT 1
propertyCycle: 0
testConnectionOnCheckIn: false
testConnectionOnCheckOut: false
debugUnreturnedConnectionStacktraces: false
unreturnedConnectionTimeout: 60
acquireRetryAttempts: 10
acquireRetryDelay: 1000
checkoutTimeout: 10000
Any help will be appreciated! Thanks in advance!
Load test tool: It's a company internal load test tool. Generally speaking, it's creating loads to the service (5+ hosts) to hit my API, the API talks to connection pool to connectionPool.getDataSource().getConnection()(ComboPooledDataSource). The connection pool is a singleton instance among service, while each call to the API is in its own thread.
来源:https://stackoverflow.com/questions/51682584/idle-not-idle-in-transaction-connections-are-not-released-closed-in-postgresql