!--a11y-->
Tuning Database ConnectivityAccess to the persistence layer typically slows down client request processing, since it involves the establishment of a database connection, and database operations are time-consuming. With J2EE Engine, you can configure database connection pools.
JDBC
Connector Service enables you to configure a database connection pool for each
DataSource you use. You can set the initial and the maximum number of
connections in the pool, as well as their lifetime. For more information about
these settings, see
Managing Connection
Pooling.
Guidelines
·
Since each client request on the J2EE Engine server
processes runs in a separate application thread, you should configure the
number of database connections in the pool considering the maximum number of
application threads set on the server processes. The application thread number
is also the maximum number of client requests that are processed concurrently
on the server. A single client may use several database connections, and you
can define the application thread number and the number of pooled database
connections considering the average connections-per-user number. The
application thread number is configured in the properties of Application
Thread Manager. For more information, see
Configuring the Thread
Pool.
However, when you define the maximum number of pooled connections, you should also take into account the number of server processes that you have in your cluster. If the overall number of connections is too big, this may deteriorate the database performance.
·
To limit the time during which an application
thread remains locked while waiting for a database connection, you can
decrease the value of the Maximum Time to Wait for
Connection property for the DataSource. For more information, see
Managing Connection
Pooling.

Note that the good performance of the application also depends on its implementation. With regard to database connectivity, for example, it is very important that you close your connections after using them. For more information, see Accessing DataSource.
