Aug 7, 2009

Understanding jdbc connection pool settings in WebLogic

Few days ago, I was looking at database and found that there were about 30-40 connection/sessions established per minute on average. This should not be the usual case with connection pooling in place.

Then looked at database listener.log to see which web server was requesting connections and at what rate. Found a pattern, after about each 10 min, there is a flood of connection requests from all the web servers. Now it's time to look at connection pool setting - what are there!

Weblogic Connection pool Settings

< jdbc-connection-pool-params >
< initial-capacity >10< /initial-capacity >
< max-capacity >150< /max-capacity >
< capacity-increment>10< /capacity-increment>
< shrink-frequency-seconds >600< /shrink-frequency-seconds >
< highest-num-waiters >300< /highest-num-waiters>
< connection-creation-retry-frequency-seconds >3< /connection-creation-retry-frequency-seconds >
< connection-reserve-timeout-seconds >30< /connection-reserve-timeout-seconds >
< test-connections-on-reserve >true< /test-connections-on-reserve >
< inactive-connection-timeout-seconds>1800< /inactive-connection-timeout-seconds>
< test-table-name>SQL SELECT 1 FROM DUAL< /test-table-name>
< /jdbc-connection-pool-params >


We set connection shrink time to 600 sec that means 10 min.

What does "ShrinkFrequencySeconds" parameter mean?

"The number of seconds to wait before shrinking a connection pool that has incrementally increased to meet demand. ShrinkingEnabled must be set to true for a connection pool to shrink."

So, after 10 min, connections were returned to database. But just after that, probably a bunch of http requests came into play with the web servers. Most of the case, it needs to establish connection to the database to serve the request. Since these requests were more than the initial connection pool value which is 10 (back to the initial connection numbers after shrinking), jdbc establishes a bunch of new connections again to serve those requests. This is how we had a flood of new connection request after about 10 min on avg.


Here we can find the description of all the connection pool parameters -

http://e-docs.bea.com/wls/docs81/config_xml/JDBCConnectionPool.html

No comments: