Saturday Mar 09, 2013

One of the most time-consuming procedures of a database application
is establishing a connection. The connection pooling of the data source
can be used to minimize this overhead. That argues for using the data
source instead of accessing the database driver directly.

Configuring
the size of the pool in the data source is somewhere between an art and
science - this article will try to move it closer to science.

From
the beginning, WLS data source has had an initial capacity and a
maximum capacity configuration values. When the system starts up and
when it shrinks, initial capacity is used. The pool can grow to maximum
capacity. Customers found that they might want to set the initial
capacity to 0 (more on that later) but didn’t want the pool to shrink to
0. In WLS 10.3.6, we added minimum capacity to specify the lower limit
to which a pool will shrink. If minimum capacity is not set, it defaults
to the initial capacity for upward compatibility. We also did some work
on the shrinking in release 10.3.4 to reduce thrashing; the algorithm
that used to shrink to the maximum of the currently used connections or
the initial capacity (basically the unused connections were all
released) was changed to shrink by half of the unused connections.

The
simple approach to sizing the pool is to set the initial/minimum
capacity to the maximum capacity. Doing this creates all connections at
startup, avoiding creating connections on demand and the pool is stable.
However, there are a number of reasons not to take this simple
approach. Read the full article here.