Java Reference
In-Depth Information
formance aspects of JDBC also. Even for applications that use JPA (or some other database
framework), understanding JDBC performance will help get better performance out of the
JDBC Drivers
The JDBC driver is the most important factor in the performance of database applications.
Databases come with their own set of JDBC drivers, and alternate JDBC drivers are available
for most popular databases. Frequently, the justification for these alternate drivers is that they
offer better performance.
I can't adjudicate the performance claims of all database drivers, but here are some things to
consider when evaluating different drivers.
Where work is performed
JDBC drivers can be written to perform more work within the Java application (the database
client) or to perform more work on the database server. The best example of this is the thin
and thick drivers for Oracle databases. The thin driver is written to have a fairly small foot-
print within the Java application: it relies on the database server to do more processing. The
thick driver is just the opposite: it offloads work from the database at the expense of requir-
ing more processing and more memory on the Java client. That kind of trade-off is possible
in most databases.
There are competing claims as to which model gives the better performance. The truth is that
neither model offers an inherent advantage—the driver that will offer the best performance
depends on the specifics of the environment in which it is run. Consider the case where an
application host is a small, two-core machine connecting to a huge, well-tuned database. The
CPU of the application host is likely to become saturated well before any significant load is
placed on the database. A thin-style driver will give the better performance in that case. Con-
versely, an enterprise that has 100 departments accessing a single HR database will see the
best performance if database resources are preserved and the clients deploy a thick-style
This is a reason to be suspicious of any performance claims when it comes to JDBC drivers:
it is quite easy to pick a driver that is well suited to a particular environment and show that it
is superior to some other vendor's driver that performs badly on the exact same setup. As al-
ways, test in your own environment, and make sure that environment mirrors what you will
deploy on.
Search WWH ::

Custom Search