Performance Profiling

Key API
{{{apis}}}

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.

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.

The EclipseLink performance profiler logs the following information to the EclipseLink log file (for general information about EclipseLink logging, see Logging):

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);

How to Configure the EclipseLink Performance Profiler

When using JPA the profiler can be set in your persistence.xml through the persistence property "eclipselink.profiler" to "PerformanceProfiler". See the ProfilerType in the config package for other profiling options.

The EclipseLink performance profiler is an instance of org.eclipse.persistence.tools.profiler.PerformanceProfiler class. It provides the following public API:

logProfile – enables the profiler;

dontLogProfile – disables the profiler;

logProfileSummary – 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;

logProfileSummaryByQuery – organizes the profiler log into a summary of all the individual operation profiles by query;

logProfileSummaryByClass – 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 Logging.