Recommendations, Tuning connection pool, Minimum pool size – HP Integrity NonStop H-Series User Manual
Page 86: Maximum pool size, Checkouttimeout, Maxidletime
NOTE:
C3P0 is tunable and offers a number of configuration parameters.
For more information on C3P0 configuration, see
.
For the complete list of parameters, see
Recommendations
Connection Pooling mechanism should be used when your application:
•
Cannot handle the overhead of obtaining and releasing connections frequently.
•
Requires JTA transactions
•
Does not manage the specifics of creating a connection, such as the database name, username,
or password.
Tuning Connection Pool
Performance improvements can be made by correctly tuning the parameters on the connection
pool. This section details each of the properties found on the Connection Pooling and how they
can be tuned for optimal performance.
Minimum Pool Size
The correct minimum value for the pool can be determined by examining the applications that
are using the pool. If it is determined, for example, that at least four connections are needed at
any point in time, the minimum number of connections should be set to 4 to ensure that all
requests can be fulfilled without connection wait timeout exceptions. At off-peak times, the pool
shrinks back to this minimum number of connections. A good rule of thumb is to keep this
number as small as possible to avoid holding connections unnecessarily open.
Maximum Pool Size
The best practice is to ensure that only one connection is required on a thread at any time. This
avoids possible deadlocks when the pool is at maximum capacity and no connections are left to
fulfill a connection request. Therefore, with one connection per thread, the maximum pool size
can be set to the maximum number of threads.
When using servlets, this can be determined by looking at the MaxConnections property in the
Servlet Engine. If multiple connections are required on a thread, the maximum pool size value
can be determined using the following formula:
T *(C -1) + 1
Where T is the number of threads, and C is the number of connections.
checkoutTimeout
It is important to know roughly how long the average application will use a connection in the
pool. For example, if all applications using a connection pool are known to only hold a connection
for an average time of 5 seconds, with a maximum of 10 seconds, it may be useful to have a
Timeout value of 10 or 15 seconds.
maxIdleTime
This is a very useful parameter if you are using a resource strapped machine. If you have set
your maximum and minimum connection pool sizes properly, you may want to lower the Idle
Timeout so that when usage of the pool is low, there are no connections sitting open that are not
doing anything. Be very careful in how low to set this parameter because setting it to low will
introduce the cost of creating connections to more applications when a transformation from light
load to heavy load begins.
86
Configuring Spring Applications on NonStop Systems