Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/JPA/Advanced JPA Development/Performance/Performance Monitoring and Profiling"

m
m
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
----
 +
 +
 +
'''[[Image:Elug_draft_icon.png|Warning]] This page is now obsolete. '''
 +
 +
For current information, please see "Understanding Performance Monitoring and Profiling" in the ''EclipseLink Concepts Guide'':
 +
http://www.eclipse.org/eclipselink/documentation/latest/concepts/monitoring.htm
 +
 +
 +
----
 +
 +
 
{{EclipseLink_UserGuide
 
{{EclipseLink_UserGuide
 
|info=y
 
|info=y
|toc=y
+
|toc=n
 
|eclipselink=y
 
|eclipselink=y
 
|eclipselinktype=JPA
 
|eclipselinktype=JPA
Line 7: Line 19:
 
|apis=
 
|apis=
 
* [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/tools/profiler/package-summary.html profiler]
 
* [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/tools/profiler/package-summary.html profiler]
 +
* [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/tools/profiler/PerformanceMonitor.html PerformanceMonitor]
 
* [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/tools/profiler/PerformanceProfiler.html PerformanceProfiler]
 
* [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/tools/profiler/PerformanceProfiler.html PerformanceProfiler]
}}
+
* [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/tools/profiler/QueryMonitor.html QueryMonitor]
=Performance Profiling=
+
  
 
==Measuring EclipseLink Performance with the EclipseLink Profiler==
 
The most important challenge to performance tuning is knowing what to optimize. To improve the performance of your application, identify the areas of your application that do not operate at peak efficiency. The EclipseLink performance profiler helps you identify performance problems by logging performance statistics for every executed query in a given session.
 
 
{{EclipseLink_Note
 
|note=You should also consider using general performance profilers such as JDeveloper or JProbe to analyze performance problems. These tools can provide more detail that may be required to properly diagnose a problem.
 
 
}}
 
}}
  
 +
=Performance Monitoring and Profiling=
  
The EclipseLink performance profiler logs the following information to the EclipseLink log file (for general information about EclipseLink logging, see [[Introduction%20to%20EclipseLink%20Sessions%20(ELUG)#Logging|Logging]]):
+
EclipseLink provides the following means to monitor and profile performance.  
* query class;
+
* domain class;
+
* total time, total execution time of the query, including any nested queries (in milliseconds);
+
* local time, execution time of the query, excluding any nested queries (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 script (in milliseconds);
+
* SQL execute, the amount of time spent executing the SQL script (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 script before it is sent to the database (in milliseconds).
+
 
+
 
+
{{EclipseLink_Note
+
|note=Use the EclipseLink profiler to profile single-threaded finite use cases to determine the bottle neck.
+
 
+
Do not use the EclipseLink profiler to enable monitoring of a long-running multi-threaded server.
+
}}
+
 
+
 
+
This section includes information on the following topics:
+
* [[#How to Configure the EclipseLink Performance Profiler|How to Configure the EclipseLink Performance Profiler]]
+
* [[#How to Access the EclipseLink Profiler Results|How to Access the EclipseLink Profiler Results]]
+
 
+
 
+
===How to Configure the EclipseLink Performance Profiler===
+
To enable the EclipseLink performance profiler, select the '''EclipseLink''' profiler option when configuring your session (see [[Configuring%20a%20Session%20(ELUG)#Configuring a Performance Profiler|Configuring a Performance Profiler]]).
+
 
+
When using JPA the profiler can be set in your <tt>persistence.xml</tt> through the persistence property <tt>"eclipselink.profiler"</tt> to <tt>"PerformanceProfiler"</tt>.  See the <tt>ProfilerType</tt> in the <tt>config</tt> package for other profiling options.
+
 
+
The EclipseLink performance profiler is an instance of <tt>org.eclipse.persistence.tools.profiler.PerformanceProfiler</tt> class. It provides the following public API:
+
* <tt>logProfile</tt> – enables the profiler;
+
* <tt>dontLogProfile</tt> – disables the profiler;
+
* <tt>logProfileSummary</tt> – organizes the profiler log into a summary of all the individual operation profiles including operation statistics like the shortest time of all the operations that were profiled, the total time of all the operations, the number of objects returned by profiled queries, and the total time that was spent in each kind of operation that was profiled;
+
* <tt>logProfileSummaryByQuery</tt> – organizes the profiler log into a summary of all the individual operation profiles by query;
+
* <tt>logProfileSummaryByClass</tt> – organizes the profiler log into a summary of all the individual operation profiles by class.
+
 
+
===How to Access the EclipseLink Profiler Results===
+
The simplest way to view EclipseLink profiler results is to read the EclipseLink log files with a text editor. For general information about EclipseLink logging, such as logging file location, see [[Introduction%20to%20EclipseLink%20Sessions%20(ELUG)#Logging|Logging]].
+
 
+
This example  shows an example of the EclipseLink profiler output.
+
 
+
<span id="Example 11-1"></span>
+
''''' Performance Profiler Output'''''
+
<source lang="text">
+
Begin Profile of{
+
ReadAllQuery(com.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
+
</source>
+
 
+
The second line of the profile contains the following information about a query:
+
 
+
{{EclipseLink_Vote
+
|bug=310820
+
|description=to add nanosecond (10^6 ms) resolution
+
}}
+
 
+
* <tt>ReadAllQuery(com.demos.employee.domain.Employee)</tt><nowiki>: specific query profiled, and its arguments.</nowiki>
+
* <tt>Profile(ReadAllQuery</tt><nowiki>: start of the profile and the type of query.</nowiki>
+
* <tt><nowiki># of obj=12</nowiki></tt><nowiki>: number of objects involved in the query.</nowiki>
+
* <tt>time=1399</tt><nowiki>: total execution time of the query (in milliseconds).</nowiki>
+
* <tt>sql execute=217</tt><nowiki>: total time spent executing the SQL statement.</nowiki>
+
* <tt>prepare=495</tt><nowiki>: total time spent preparing the SQL statement.</nowiki>
+
* <tt>row fetch=390</tt><nowiki>: total time spent fetching rows from the database.</nowiki>
+
* <tt>time/obj=116</tt><nowiki>: number of milliseconds spent on each object.</nowiki>
+
* <tt>obj/sec=8</tt><nowiki>: number of objects handled per second.</nowiki>
+
 
+
 
+
  
 +
*[[EclipseLink/UserGuide/JPA/Advanced JPA Development/Performance/Performance Monitoring and Profiling/Performance Monitoring|Performance Monitoring]]
 +
*[[EclipseLink/UserGuide/JPA/Advanced JPA Development/Performance/Performance Monitoring and Profiling/Performance Profiling|Performance Profiling]]
 +
*[[EclipseLink/UserGuide/JPA/Advanced JPA Development/Performance/Performance Monitoring and Profiling/Fetch Group Monitoring|Fetch Group Monitoring]]
 +
*[[EclipseLink/UserGuide/JPA/Advanced JPA Development/Performance/Performance Monitoring and Profiling/Query Monitoring|Query Monitoring]]
  
 
{{EclipseLink_JPA
 
{{EclipseLink_JPA
 
|previous=[[EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance|Performance]]
 
|previous=[[EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance|Performance]]
|next    =[[EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving|Weaving]]
+
|next    =[[EclipseLink/UserGuide/JPA/Advanced JPA Development/Performance/Performance Monitoring and Profiling/Performance Profiling|Performance Profiling]]
 
|up      =[[EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance|Performance]]
 
|up      =[[EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance|Performance]]
 
|version=2.2.0 DRAFT}}
 
|version=2.2.0 DRAFT}}

Latest revision as of 07:37, 17 April 2013



Warning This page is now obsolete.

For current information, please see "Understanding Performance Monitoring and Profiling" in the EclipseLink Concepts Guide: http://www.eclipse.org/eclipselink/documentation/latest/concepts/monitoring.htm




EclipseLink JPA


Performance Monitoring and Profiling

EclipseLink provides the following means to monitor and profile performance.

Eclipselink-logo.gif
Version: 2.2.0 DRAFT
Other versions...

Copyright © Eclipse Foundation, Inc. All Rights Reserved.