Database Reference
In-Depth Information
Instrumentation
As mentioned in Chapter 1, every application should be instrumented. In other words, the question isn't whether you
should do it but how you should do it. This is an important decision that architects should make at the beginning of
the development of a new application. Even though instrumentation code is usually implemented to externalize the
behavior of an application in case of abnormal conditions, it can also be useful for investigating performance issues.
To identify performance problems, we're particularly interested in knowing which operations are performed, in which
order, how much data is being processed, how many times operations are performed, and how much time they take.
In some cases (for example, large jobs), it's also useful to know how many resources are used. Because information
at the call or line level is already provided by code profilers, with instrumentation you should focus particularly on
business-relevant operations and on interactions between components (tiers). In addition, if a request needs complex
processing inside the same component, it could be wise to provide the response time of the major steps carried out
during the processing. In other words, to effectively take advantage of instrumentation code, you should add it to
strategic positions in the code. Let me stress that without information about the response time, the instrumentation is
useless for investigating performance problems.
Let's look at an example. In the application JPetStore (briefly introduced in Chapter 1), there's an action called
Sign-on for which Figure 2-5 shows the sequence diagram. Based on this diagram, the instrumentation should provide
at least the following information:
The system response time of the request from the perspective of the servlet
2 responding to
requests ( FrameworkServlet ). This is the business-relevant operation.
The SQL statement and response time of the interactions between the data access object
( AccountDao ) and the database. This is the interaction between middle tier and database tier.
Timestamp of beginning and ending of both the request and the interaction with the database.
Figure 2-5. Sequence diagram for the Sign-on action of JPetStore
 
Search WWH ::




Custom Search