Oracle® Application Server TopLink Application Developer's Guide
10g Release 2 (10.1.2) Part No. B15901-01 |
|
Previous |
Next |
The most important challenge to performance tuning is knowing what to optimize. To improve your application performance, identify the areas of your application that do not operate at peak efficiency. The OracleAS TopLink Performance Profiler helps you identify performance problems.
The OracleAS TopLink Performance Profiler logs a summary of the performance statistics for every query you execute. The Profiler also logs a summary of all queries executed in a given session.
The Profiler logs the following information:
Query class
Domain class
Total time—total execution time of the query (in milliseconds)
Local time—the amount of time spent on the user's workstation (in milliseconds)
Number of objects—the total number of objects affected
Number of objects handled per second
Logging—the amount of time spent printing logging messages (in milliseconds)
SQL prepare—the amount of time spent preparing the SQL (in milliseconds)
SQL execute—the amount of time spent executing the SQL (in milliseconds)
Row fetch—the amount of time spent fetching rows from the database (in milliseconds)
Cache—the amount of time spent searching or updating the object cache (in milliseconds)
Object build—the amount of time spent building the domain object (in milliseconds)
Query prepare—the amount of time spent to prepare the query prior to execution (in milliseconds)
SQL generation—the amount of time spent to generate the SQL before it is sent to the database (in milliseconds)
The OracleAS TopLink Web Client also includes a graphical Performance Profiler.
For more information, see "Using the Performance Profiler".
The Performance Profiler is an instance of the PerformanceProfiler class, found in oracle.toplink.tools.profiler
. To access the Profiler, call the session getProfiler()
method.
To enable the Profiler, invoke the setProfiler(new PerformanceProfiler())
method on the session. To end a profiling session, invoke the clearProfiler()
method. The Profiler supports the following public API:
logProfile()
: Enables the profiler
dontLogProfile()
: Disables the profile
logProfileSummaryByQuery()
: Organizes the profiler log as query summaries. This is the default profiler behavior.
logProfileSummaryByClass()
: Organizes the profiler log as class summaries. This is an alternative to the default behavior implemented by logProfileSummaryByQuery()
.
Example 10-1 Executing a Read Query with the Profiler
session.setProfiler(new PerformanceProfiler()); Vector employees = session.readAllObjects(Employee.class);
Example 10-2 Implementing the Performance Profiler in the sessions.xml File
<session> ... <profiler-class>oracle.toplink.tools.profiler.PerformanceProfiler</profiler-class> ... </session>
Example 10-3 Performance Profiler Output
Begin Profile of{ ReadAllQuery(oracle.toplink.demos.employee.domain.Employee)Profile(ReadAllQuery,# of obj=12, time=1399,sql execute=217, prepare=495, row fetch=390, time/obj=116,obj/sec=8) */ } End Profile
The second line of the profile contains the following information about a query:
ReadAllQuery(oracle.toplink.demos.employee.domain.Employee)
: Specific query profiled and its arguments
Profile(ReadAllQuery)
: Start of the profile and the type of query
# of obj=12
: Number of objects involved in the query
time=1399
: Total execution time of the query (in milliseconds)
sql execute=217
: Total time spent executing the SQL
prepare=495
: Total time spent preparing the SQL
row fetch=390
: Total time spent fetching rows from the database
time/obj=116
: Number of milliseconds spent on each object
obj/sec=8) */
: Number of objects handled per second