I am using oracle ons.jar ojdbc8.jar and ucp.jar version 19.24
Using poolDataSource.getConnection();
to get the connection. Then I log the statistics returned from poolDataSource.getStatistics()
Pool size max is 500
I have MyCustomPoolDataSource
class which takes PoolDataSource
instance. MyCustomPoolDataSource
acts as a wrapper around the PoolDataSource
instance.
@Override
public Connection getConnection() throws SQLException {
//Log all poolDataSource.getStatistics()
Connection connection = poolDataSource.getConnection();
connection.setAutoCommit(true);
//Log all poolDataSource.getStatistics()
return connection;
}
Then MyCustomPoolDataSource
is injected to DAOs. That instance is used to create jdbcTemplate.
@Autowired
public RestAct(DataSource myCustomPoolDataSource) {
this.jdbcTemplate = new JdbcTemplate(myCustomPoolDataSource);
}
While I am sending a load, I can see the poolDataSource.getStatistics().getTotalConnectionsCount()
value increases gradually untill 500.
But the getBorrowedConnectionsCount
value barely exceeds 3. Once TotalConnectionsCount
reached 500 ucp starts to throw UniversalConnectionPoolException : All connectoins in the Universal Connection Pool are in use
But the borrowed count is only 3(or 1 or 2)
Why it is not borrowing/utilizing all the active connections?