3

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.

enter image description here

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.

3
  • My guess is that C3P0 doesn't release the connections it acquired when the API talked to it. You may change the C3P0 configuration for allowing faster connections release.
    – Stephan
    Aug 6, 2018 at 5:18
  • Can you explain more on "allowing faster connections release"? I already set most of the configs (e.g. max idle time) to less than 20s. Do you think all these idle connections are expected? I mean like - they're idle but can be re-used later. Or it should be like - the connections should be gone instead of staying as idle?
    – Zip
    Aug 6, 2018 at 5:56
  • Try the solution proposed here: stackoverflow.com/a/8773410/363573
    – Stephan
    Aug 6, 2018 at 14:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.