Databases Reference
In-Depth Information
Assess Other Factors
If your application does not perform in the real world as your benchmark pre-
dicted, what then? Look at external influences such as corporate traffic slowing
down the network or excessive CPU and memory use on the client or database
server.
In addition, be aware that some tasks such as stored procedures or application-
side caching of a large amount of data can mask the performance of the network,
database middleware, or application code. For example, if the execution of a stored
procedure takes 50 times longer than retrieving the data, changing the application
code or database driver so that it's 100% faster at data retrieval would not show a
noticeable difference in the benchmark results because most of the time processing
the data requests is spent on the database server. Using tools such as code profilers
and network sniffers to create a log that times each operation can tell you where
processing time is being spent and help you make educated guesses about where
your efforts can improve performance.
Benchmark Example
The following example shows a benchmark that measures the response time of a
typical reporting application to retrieve data. Although we don't show all the
code involved, such as connecting to the database, we show the core parts of the
benchmark that incorporate many of the principles discussed in this chapter,
including these.
Your test environment should resemble your production environment as
closely as possible. Your test data should be realistic, and your benchmark
should perform the types of tasks it will perform in the real world. Notice
that the following benchmark retrieves different types of data, including
long data.
Your benchmark should measure the right tasks. Notice that the following
benchmark records the CPU time at the start and end of a timing loop. In
addition, it retrieves data from the result set, and it closes statements after
they are executed to release resources.
Your benchmark should measure over a sufficient duration. Notice that the
following benchmark measures over a period of 100 seconds.
 
 
Search WWH ::




Custom Search