Databases Reference
In-Depth Information
the response time required for the actual order to be processed. Ask your user
liaisons what tasks are most important to them, and make testing of those tasks a
priority.
Make sure the benchmark application makes the same API calls your data-
base application makes. For example, we often see benchmarks that execute a
query and retrieve a result set but do nothing with the data. Of course, this would
never happen in a real-world application. For example, suppose you are tasked to
design a benchmark that measures the time it takes for a JDBC application to
process 50,000 rows. Let's take a look at the following simple benchmark:
Statement stmt = con.createStatement();
\\ Get start time
resultSet = stmt.executeQuery(
"SELECT acct.bal FROM table");
while (resultSet.next())
{}
\\ Get finish time
Notice that the statement is opened and executed but is never closed, so
resources are not released. Also, notice that the application positions a cursor on
a row in the result set, but it subsequently ignores the data in that row. Different
database drivers optimize retrieving data from network buffers and convert data
at different times. For example, some drivers retrieve all requested data when a
query is executed; others don't. Other drivers leave some data in the network
buffer on the database server until the application actually requests that data. If
you don't realize that this type of optimization occurs, you wouldn't know that
results generated by the previous benchmark code would be greatly influenced by
which driver you use.
Although these lapses in real-world modeling may not seem like a big deal,
they can add up to make a big difference in performance. For most applications,
75% to 95% of the time it takes to process data is spent in the database driver and
on the network. The difference between 75% and 95% can represent a big dispar-
ity in your application's performance.
So, let's rewrite the benchmark to reflect how the application would work in
the real world:
Statement stmt = con.createStatement();
\\ Get start time
resultSet = stmt.executeQuery(
"SELECT acct.bal FROM table");
while (resultSet.next()) {
Search WWH ::




Custom Search