Java Reference
In-Depth Information
Figure 7.1 Consider the cost of connections. Each additional connection has fixed costs, in both
units of time and system resources (such as memory). It isn't unusual for database connections
in an application to take longer than all of the data access combined.
Maybe it's because the performance of so many of our systems is out of our
control. Or perhaps we simply do not take the time to learn good practices.
One critical factor that never ceased to amaze my customers was the total
expense of establishing a database connection. As you can see in figure 7.1,
each connection has a fixed cost that must be paid in two different currencies.
The first is time. Many Internet applications feature very quick database trans-
actions, and it isn't unusual for a system to spend more time establishing com-
munication than processing a given transaction. The second cost is the early
exhaustion of system resources, including memory and file handles. Since each
connection must set aside buffers for communication and database resources,
as well as files for logging, the overhead can become significant in a hurry. For
many architectures, if the number of users is not well defined, it is easy for a
connection to strain the allocated resources on either the database machine or
the web server. To solve this problem, many systems maintain a connection for
a limited amount of time.
Two problems affect connection performance. First, the total number of
concurrent connections is limited. When a system hits a resource wall due to
a high number of connections, performance will crash or deteriorate rapidly,
as a result of excessive swapping or paging. Second, determining the number
of connections required at peak periods can be difficult, because Internet
application loads are inherently hard to predict. Well before the creation of
the Java development environment, many of my customers had problems
managing individual connections for client / server architectures. Though their
applications had a fixed number of connections and well-defined peak times
Search WWH ::

Custom Search