javaoracle-databaseconnection-poolingucp

Oracle connection harvesting not working as expected


I am using UCP jar 11.2.0.3.0 for DB connection pool for oracle. Here are some DB connection configurations

<property name="datasource.connections.connectionHarvestTriggerCount">100</property>
<property name="datasource.connections.connectionHarvestMaxCount">50</property>
<property name="datasource.connections.min_size">5</property>
<property name="datasource.connections.max_size">500</property>
<property name="datasource.connections.idle_test_period">100</property>
<property name="datasource.connections.testConnectionOnCheckout">true</property>
<property name="datasource.connections.checkoutTimeout">60000</property>
<property name="datasource.connections.timeout">300</property>
<property name="datasource.connections.preferredTestQuery">SELECT 1 from dual</property>
<property name="datasource.max_statements">200</property>
<property name="datasource.connections.wait.timeout">3</property>

I am expecting is used connection count reached up to 400 harvesting should start and close 50 connections an place them back in to pool. But I am facing connection close exception even only 30-40 connections are in used. Is any configuration I am missing here?


Solution

  • Harvesting never consider what connection pool configured in application. It just check what all connections opened from application and calculate max count and harvesting trigger count and finally close connections. For example, you might configure 100 connection pool but application will not start all 100 connections at a time. So Application might got 40 connections. our max count is 10 and harvesting trigger count is 10 as you are expecting that when application full with 90 connections, harvest 10 out of them and keep 80 to save you application. But Harvesting will start closing connections from usage reached at 30 only as your application activated 40 connections.