Personal tools

Connection Pooling

How to use connection pooling to improve database performance
This tutorial shows how you can configure GRIA to use different databases.
Page 3 of 4.

Database connection pooling improves the performance of database operations by eliminating most of the overhead of acquiring database connections.

To configure connection pooling, you need to edit the hibernate.propeties file located in the services configuration directory and edit certain lines in the file, as described below.

We do not recommend using connection pooling with Hypersonic (the default RDBMS) as it has been seen to cause problems.

First disable hibernate's basic connection pool by ensuring that there is a # at the start of the following line, as below.

#hibernate.connection.pool_size 1

Next, enable the c3pO connection pool by uncommenting the following lines by removing the # at the start of each line.

#hibernate.c3p0.min_size 2
#hibernate.c3p0.max_size 7

You should also set appropriate values for the "min_size" and "max_size" properties. These are the minimum and maximum number of database connections that will be managed by the connection pool. The uncommented lines with example values are shown below.

hibernate.c3p0.min_size 10
hibernate.c3p0.max_size 40

It is important to ensure that the maximum number of pooled connections (accross all GRIA services that use the same database) are within the limits of your database configuration. Refer to your database documentation and your database configuration files for details of the maximum number of available connections.