Databases Reference
In-Depth Information
in the pool are actually used by the application, performance improves signifi-
cantly. Obtaining a connection becomes one of the fastest operations an applica-
tion performs instead of one of the slowest.
Although obtaining connections from a pool is efficient, when your applica-
tion opens and closes connections impacts the scalability of your application.
Open connections just before the user needs them, not sooner, to minimize the
time that the user owns the physical connection. Similarly, close connections as
soon as the user no longer needs them.
To minimize the number of connections required in a connection pool to
service users, you can switch a user associated with a connection to another user
if your database driver supports a feature known as reauthentication.
Minimizing the number of connections conserves memory and can improve
performance. See “Using Reauthentication with Connection Pooling,” page 232.
See Chapter 8, “Connection Pooling and Statement Pooling,” for details
about connection pooling.
Establishing Connections One at a Time
Some applications are not good candidates for connection pooling, particularly
if connection reuse is limited. See “When Not to Use Connection Pooling,” page
15, for examples.
Performance Tip
If your application does not use connection pooling, avoid connecting
and disconnecting multiple times throughout your application to execute
SQL statements because of the performance hit your application pays for
opening connections. You don't need to open a new connection for each
SQL statement your application executes.
Using One Connection for Multiple Statements
When you're using a single connection for multiple statements, your application
may have to wait for a connection if it connects to a streaming protocol database.
 
 
Search WWH ::




Custom Search