Databases Reference
In-Depth Information
Guidelines for Connection Pooling
Here are some general guidelines for using connection pooling. For details about
different connection pooling models, see Chapter 8, “Connection Pooling and
Statement Pooling.”
A perfect scenario for using connection pooling is when your applications
reside on an application server, which implies multiple users using the appli-
cations.
Consider using connection pooling if your application has multiple users
and your database server has enough memory to manage the maximum
number of connections that will be in the pool at any given time. In most
connection pooling models, it is easy to calculate the maximum number of
connections that will be in a pool because the connection pool implementa-
tion allows you to configure the maximum. If the implementation you are
using does not support configuring the maximum number of connections in
a pool, you must calculate how many connections will be in the pool during
peak times to determine if your database server can handle the load.
Determine whether the number of database licenses you have accommo-
dates a connection pool. If you have limited licenses, answer the following
questions to determine if you have enough licenses to support a connection
pool:
a.
Will other applications use database licenses? If yes, take this into
account when calculating how many licenses you need for your con-
nection pool.
b.
Are you using a database that uses a streaming protocol, such as
Sybase, Microsoft SQL Server, or MySQL? If yes, you may be using
more database connections than you think. In streaming protocol
databases, only one request can be processed at a time over a single
connection; the other requests on the same connection must wait for
the preceding request to complete before a subsequent request can be
processed. Therefore, some database driver implementations duplicate
connections (establish another connection) when multiple requests
are sent over a single connection so that all requests can be processed
in a timely manner.
When you develop your application to use connection pooling, open con-
nections just before the application needs them. Opening them earlier than
Search WWH ::




Custom Search