Databases Reference
In-Depth Information
If you can't tune garbage collection in the CLR, how can you ensure that
garbage collection works in favor of your application's performance? The way
your application code is designed and coded largely affects how efficiently
garbage collection is performed.
Performance Tip
To optimize garbage collection in the CLR, make sure that your applica-
tion closes connections as soon as the user is finished with them, and
correctly and consistently use the Dispose method to free an object's
resources. See the section, “Disconnecting Efficiently,” page 196, for more
information.
Operating System
Another factor in the environment that affects performance is the operating sys-
tem. This is not to claim that one operating system is better than another—just
that you need to be aware that any operating system change, no matter how
minor, can increase or decrease performance, sometimes dramatically. For
example, when testing an application that applied a recommended Windows
update, we saw performance plummet when the database driver made
CharUpper calls. In our benchmark, 660 queries per second throughput
dropped to a mere 11 queries per second—an astounding 98% decrease.
Often, we see performance differences when running the same benchmark
on different operating systems. For example, on UNIX/Linux, a database driver
may use mblen() , a standard C library function, to determine the length in bytes
of a multibyte character; on Windows, it may use the equivalent function,
IsDBCSLeadByte() . Our benchmarks have shown that when an application used
mblen() on Linux, the processing of mblen() appropriated 30% to 35% of the
total CPU time. When run on Windows, IsDBCSLeadByte() used only 3% to 5%
of the total CPU time.
It's also helpful to know which byte order, or endianness 1 , is used by the
operating system on the database client to store multibyte data in memory, such
as long integers, floating point numbers, and UTF-16 characters. The endianness
1 The term endianness was adopted from the novel Gulliver's Travels by Jonathan Swift, first published in
1726. In the novel, a shipwrecked castaway, Gulliver, tangled with a sovereign state of diminutive
Lilliputians who were split into two intractable factions: Big-Endians who opened their soft-boiled eggs
at the larger end, and Little-Endians who broke their eggs at the smaller end.
 
Search WWH ::




Custom Search