04 Slides ST05
04 Slides ST05
Table of Contents
Approach
Assess an application’s resource consumption.
Oriented
Tools-
IV. Performance Trace (ST05)
Evaluate events that leave the ABAP work process.
Approach
Problem-
VI. Performance Analysis
Oriented
Combine the tools to analyze an application’s performance.
1
Performance Trace
ST05
Manfred Mensch
SAP SE
Performance and Scalability
March 01, 2021
2
Abstract
This lesson …
… introduces the Performance Trace as SAP’s interface trace tool
… explains that traces capture an application’s requests to external resources
… shows how to record and analyze traces
… indicates that traces identify optimization potential
This lesson focusses mainly on SQL traces. This is the most relevant trace type offered by the
Performance Trace.
3
Introduction
By default, all trace types are switched off, so that the system’s performance is not impaired.
An SQL trace does not record SQL statements handled by the application server’s table buffer. It
exclusively captures requests that are processed by the database server. DB trace would be a
more appropriate name.
4
Scope and Purpose
Investigate applications with respect to the resources they request from outside of
the work process.
Check adherence to architecture requirements.
Get KPIs mandated by quality requirements.
Identify hot spots in an application
… expensive SQL statements
… unnecessary accesses to the persistence layer
… long running SAP locks
… RFC issues
Deduce approaches for optimization.
ST05 is not the appropriate tool if the entire system or the database server is slow.
The optimization of performance problems discovered with the help of ST05 traces is not in the
scope of this lesson.
5
Use of the Performance Trace
Prepare
0
Execute Application
1 a
Activate Trace Recording
Record
b
c
Execute Application
Deactivate Trace Recording
2 a
Trace List (Main Records)
Display
b c d e f g
Individual Structure-Id. Value-Id. Table Trace Sizing
Records Statements Statements Accesses Overview Information
Analyze
3 a b c d e
Statement DDIC DB Explain ABAP Editor Call Stack
The analysis of an application with the Performance Trace proceeds in four main steps, all of
which have to be executed on the same ABAP application server instance.
Step 0: Execute the application to be traced several times to fill buffers and caches.
Step 1: Record trace.
a) Activate trace recording.
Use filter conditions to restrict its scope.
b) Execute the application.
c) Deactivate trace recording.
Step 2: Display trace.
a) Main Trace Records
b) Detailed Trace Records
c) Structure-Identical Statements
d) Value-Identical Statements¹
e) Table Accesses2
f) Trace Overview
g) Sizing Information
Step 3: Analyze individual statements.
a) Statement details with variable values3
b) DDIC information on the accessed object
c) DB Explain
d) ABAP source code
e) ABAP call stack
Forward trace to Code Inspector to check compliance with architecture requirements.
¹ Only relevant for SQL, BUF, and ENQ trace records.
² Only relevant for SQL and BUF trace records.
3 Values are available only for SQL, BUF and ENQ trace records.
6
Trace Preparation
Prepare
0
Execute Application
Step 0: Execute the application to be traced several times to fill buffers and caches.
7
Trace Recording
1 a
Activate Trace Recording
Record
b
c
Execute Application
Deactivate Trace Recording
The kernel saves trace records in dedicated trace files on the application server. The trace files’
base name is determined by the value of profile parameter rstr/filename (e.g.,
/usr/sap/Y4H/D00/log/TRACE).
To minimize the impact on system performance, the records are not written directly to file but
first saved in an internal buffer. Profile parameter rstr/buffer_size_kB (default value 200)
determines this buffer’s size. If the size of a single statement (including its variables’ values)
exceeds this value, it will be truncated.
If the maximum size of the trace file (set by parameter rstr/max_filesize_MB; default value 16,
maximum value 100) is reached, the file is renamed by appending a number between 00 and 99
to the file name. If a file by that name already exists, it will be overwritten. By this mechanism a
trace may overwrite its own beginning if trace recording is active for too long or if the traced
application triggers a large number of recorded events. The maximum number of trace files is
controlled by parameter rstr/max_files (default value 10, maximum value 99).
The current values of these profile parameters can be checked with Edit → Display Profile
Parameters for Trace.
8
Trace Recording
Activate Trace
Trace Types 1
An active trace recording can be enhanced by selecting additional trace types and activating the
trace again. Likewise, trace types can be deactivated without completely stopping the trace
recording.
Based on benchmark runs (SD, FI, MM), the average size of a trace record is 880 Bytes and the
overhead for server response time, as well as CPU time, is less than 3%.
If the stack trace is active, the trace records will contain ABAP call stack information so that
during trace analysis the call hierarchy leading to the statement that triggered the trace record
can be retrieved. This is especially helpful for enqueues, which are always set from function pool
SAPLSENA, and also for events encapsulated within frameworks. In both cases, the trigger in the
application coding is accessible by the ABAP call stack. Capturing call stack information takes
~30µs per record and increases the trace record size by ~50%.
9
Trace Recording
Activate Trace with Filter
Trace Types 1
d instance b
up to 5 tables to be e
included or excluded
10
Trace Recording
Display Filter
The trace status indicates the current settings―including if a running trace was activated with
filter.
The filter conditions can be seen under Edit → Display Filter for Trace Recording.
11
Trace Recording
Deactivate Trace
Trace Types 1
For an ongoing trace recording with multiple active trace types, selected trace types can be
deactivated without completely switching off the trace recording.
Option Deactivate Trace on All Servers switches off all trace recordings on all application server
instances of the system, regardless of the types and independent of the users who have
activated tracing. Use this option with caution and courtesy toward your colleagues.
12
Trace Administration
Display Trace I
1
Display Trace 2
You can display a trace only on the application server instance where it was recorded.
Due to load balancing, with a new logon your requests might be processed on another instance.
If you know the instance where your trace was recorded, you can go there with transaction
SM51. Otherwise you have to search the system’s instances until you find your trace. The trace
may have been overwritten in the meantime.
13
Trace Administration
Display Trace Ib
You can display a trace while tracing is still active. The trace recording continues undisturbed.
14
Trace Administration
Display Trace II
Trace Types 1
of Trace Records
15
Trace Administration
Display Trace Directory
1
Display Trace Directory 2
The Trace Directory integrated into ST05 addresses some symptoms caused by the facts that
the storage of trace records is application server instance specific and has a limited capacity.
When trace recording is activated, an entry is written into a database table. It stores the client
from where the recording was started, the name of the user who activated tracing and the date
and time when the trace was switched on. This entry also saves the name of the ABAP
application server instance where the trace is captured. Upon deactivation of trace recording,
this entry is completed with the end date and time. This kind of trace directory entry contains
only header data, it does not store any trace records. Its purpose is to facilitate the recovery of
previously recorded traces in multi instance systems. It does not protect trace records from
overwriting. When the kernel deletes a trace file in the application server’s file system, the
corresponding trace directory entries will be removed.
Traces that must not be overwritten (e.g., because they are needed for documentation or
comparison purposes long after they were recorded) can be stored in the trace directory.
16
Trace Administration
Trace Directory
Trace Selection 1
Entries in the trace directory can be filtered by some of their meta data, such as owner or
description, and by the trace’s start date.
The trace directory includes both types of entries, those that contain only header data (indicated
by the binary file icon in the first column), and those that also persist the records (identified by
the database icon ). Double-clicking an entry of either type will display the corresponding
records.
The trace directory supports various functions for the administration of its entries:
• For entries that contain only header data, the trace records can be stored in the trace directory
on the database. This will create an additional entry.
• The description and the delete date can be modified.
• Entries can be deleted.
• Export to the local front end can be done in binary format for the entire trace or in CSV format
for a particular aggregation level.
• Traces stored on the local front end in the appropriate binary format can be imported.
• Two traces represented by trace directory entries with persisted trace records can be
compared.
17
Trace Display
2 a
Trace List (Main Records)
Display
b c d e f g
Individual Structure-Id. Value-Id. Table Trace Sizing
Records Statements Statements Accesses Overview Information
Levels of aggregation:
a The list of main records aggregates all individual trace records triggered by distinct events.
b Individual records correspond to technical operations executed while a distinct event is
processed. This is the granularity written by the kernel.
The list of structure-identical statements summarizes statements with a common structure
c
and adds statistical and technical information.
In the list of value-identical statements, statements are summarized if their structures and
d
their sets of values coincide.
The table accesses aggregates trace records by table, statement type, and DB connection.
e
18
Trace Display
Main Records
The processing of statements implemented in an application’s source code may involve several
operations that are captured as individual, detailed records in a trace. The list of main records
attempts to aggregate all these records so that ideally there is a one-to-one correspondence
between main records and implemented statements. Individual records that cannot be
aggregated into a main record are collected into dummy main records with statement OTHER
(<trace_type>) and empty Time.
For SQL statements, all trace records corresponding to database operations triggered by the
statement’s execution are summarized.
Display of a trace best starts with the list of main records. Its default layout shows
• Time Start time of the event in the user’s time zone
• Duration Execution time of the operation in microseconds (µs)
• Records1 SQL, BUF: number of records returned by the operation;
ENQ: number of lock granules
• Program Name Name of the ABAP program that called the event
• Object Name Name of the object that was accessed (SQL, BUF: table, view;
ENQ: lock object; RFC: function; HTTP: path)
• Statement Edited statement: field list and FROM clause removed, variable
names replaced by values
• DB Cursor2 Number of the cursor used for the operation
• Array2 Maximum number of records that can be transferred from the
database to the ABAP work process within one communication
package
• DB connection3 SQL: name of the logical database connection (default = R/3);
HTTP: network protocol
• User Name Name of the user who executed the event
19
• Client Client where the event was executed
• WP Type Type of the work process which executed the event
Further fields can be added by changing the ALV’s layout.
1 Not relevant for RFC, HTTP, APC, and AMC trace records.
2 Only relevant for SQL trace records.
3 Only relevant for SQL and HTTP trace records.
19
Trace Display
Individual Records
The list of individual trace records provides the highest level of detail. It shows all trace records
captured during an application’s execution without any aggregation. Its default layout shows:
• Time Start time of the event in the user’s time zone
• Duration Execution time of the operation in microseconds (µs)
• Records1 SQL, BUF: number of records returned by the operation;
ENQ: number of lock granules
• Program Name Name of the ABAP program that called the event
• Object Name Name of the object that was accessed (SQL, BUF: table, view;
ENQ: lock object; RFC: function; HTTP: path)
• Statement Edited statement: field list and FROM clause removed,
variable names replaced by values
• Operation Operation that was executed; RFC, HTTP: Client or Server
• DB Cursor2 Number of the cursor used for the operation
• Array2 Maximum number of records that can be transferred from the
database to the ABAP work process within one communication
package
• Return Code Return code of the executed operation
• DB connection3 SQL: name of the logical database connection (default = R/3);
HTTP: network protocol
• User Name Name of the user who executed the event
• Client Client where the event was executed
• WP Type Type of the work process which executed the event
Further fields can be added by changing the ALV’s layout.
1 Not relevant for RFC, HTTP, APC, and AMC trace records.
2 Only relevant for SQL trace records.
3 Only relevant for SQL and HTTP trace records.
20
Trace Display
Structure-Identical Statements
Structure-identical statements share a common structure. For SQL statements, the structure is
determined by the accessed object and the WHERE clause.
The default layout of the list of structure-identical statements displays these columns:
• Executions Total number of executions of the structure-identical statements
• Redundancy Absolute number of redundant value-identical statements
• Identical Relative number of redundant value-identical statements
• Duration Total execution time of the structure-identical statements in µs
• Records Total number of records returned by the structure-identical
statements
• Duration/Execution Average execution time per statement
• Records/Execution Average number of records returned per statement
• Duration/Record Average execution time per record
(Records = 0 ➔ average duration per statement)
• Min. Duration/Record Minimum execution time per record
(Records = 0 ➔ minimum duration of contributing statements)
• Length Nametab record length of the table or view
• Buffer Type Buffer type of the table or view
• Table Type Table type of the table or view
• Object Name Name of the table or view that was accessed
• Statement Edited statement: field list and FROM clause removed
Further fields can be added by changing the ALV’s layout.
Redundant value-identical statements shall be avoided.
A record with many Executions and Records/Execution = 1 points to multiple SELECT SINGLE
statements. These shall be replaced by a more efficient array SELECT.
21
If Min. Duration/Record exceeds 10.000 µs = 10 ms for SELECTs, or 50.000 µs = 50 ms for
INSERTs, UPDATEs, DELETEs, the statement is slow and shall be investigated in detail.
If a statement has been executed multiple times (e.g., Executions ≥ 10), the value of
Duration/Record shall be considered in addition to Min. Duration/Record. Otherwise a single
fast execution may conceal many slow executions. With few executions, a single outlier may
distort the average, but with 10 or more executions, it should be reliable and taken seriously.
21
Trace Display
Value-Identical Statements
Value-identical statements are structure-identical statements where identical sets of values are
passed to the variables. This aggregation is available only for SQL, BUF, and ENQ trace
records. These are the only trace types where values are recorded. Value-identical SQL
statements read identical data multiple times from the database and create unnecessary load.
The default layout of the list of value-identical statements displays these columns:
• Executions Total number of executions of the value-identical statements
• Duration Total execution time of the value-identical statements in µs
• Records Total number of records returned by the value-identical
statements
• Duration/Execution Average execution time per statement
• Records/Execution Average number of records returned per statement
• Duration/Record Average execution time per record
(Records = 0 ➔ average duration per statement)
• Min. Duration/Record Minimum execution time per record
(Records = 0 ➔ minimum duration per statement)
• Length Nametab record length of the table or view
• Buffer Type Buffer type of the table or view
• Table Type Table type of the table or view
• Object Name Name of the object that was accessed
• Statement Edited statement: field list and FROM clause removed,
variable names replaced by values
Further fields can be added by changing the ALV’s layout.
Identical data can be read redundantly by statements that are not value-identical―and not even
structure-identical. This is not visible in the list of value-identical statements. All unnecessary
accesses to the persistence layer must be eliminated. This is a more comprehensive demand
than just removing value-identical statements.
22
Trace Display
Table Accesses
The table accesses display includes only SQL and BUF trace records.
All SQL trace records corresponding to statements of the same type (e.g., SELECT, INSERT,
UPDATE, DELETE) that access an object over the same database connection are aggregated.
Similarly, all BUF trace records triggered by statements that were handled by the table buffer
and that access an object with the same number of key fields are aggregated.
The default layout of the list of table accesses displays these columns:
• Object Name Name of the table or view that was accessed
• Statement Type of statement: SELECT, INSERT, UPDATE, DELETE,
COMMIT, ROLLBACK , …; buffer accesses by number of used
key fields
• DB Connection SQL: name of the logical database connection (default = R/3);
BUF: empty
• Duration Total execution time of the statements in µs
• Records Number of records returned or modified by the statements
• Executions Number of accesses to the object by statements of the
given type
23
Trace Display
Application Component Hierarchy
The display of the application component hierarchy enhances the list of the table accesses. It
additionally shows the tables’ DDIC short descriptions, and groups the accessed tables by
application component (levels 0 and 1 are supported; level 0 is the default). For each application
component, absolute and relative subtotals of the number of accesses, number of records, and
duration are given for the statement types (SELECT, INSERT, UPDATE, DELETE, COMMIT,
ROLLBACK, …; buffer accesses by number of used key fields).
24
Trace Display
Trace Overview
• Meta data
• Quality control
• High level summary
• Check of architecture
requirements 12, 13
• Suspicious statements
25
Trace Display
Sizing Information
• Summary of changing
SQL statements
• DDIC sizes of
affected tables
• Estimation of data
volume change
The sizing information estimates how much the traced SQL statements change the data volume
persisted in the database.
It considers only INSERT, DELETE, and MODIFY statements. It determines the line sizes of the
affected tables based on their static DDIC definition. It also takes into account the sizes of the
primary key and the secondary indexes. Based on these sizes, it calculates two estimates for the
change of the data volume persisted in the database caused by the traced application:
1. MODIFY statements are ignored. This assumes that all MODIFY statements captured in the
trace have changed database table entries that already existed before the application’s
execution. It gives a lower limit for the change of the data volume.
2. MODIFY statements are treated like INSERTs. This uses the assumption that none of the
database table entries addressed by MODIFY statements existed before the application’s
execution.
Both estimations only consider table fields whose lengths are statically declared in the DDIC. For
other fields (of data types LRAW, RAW, RAWSTRING, or STRING) no reliable value for the
change of the persisted data volume can be guessed. They are ignored.
26
Trace Analysis
Analyze
3 a b c d e
Statement DDIC DB Explain ABAP Editor Call Stack
¹ Values are available only for SQL, BUF, and ENQ trace records.
27
Trace Analysis
Statement Details
1
values separately
2 Variable names 2
2 replaced with values
The statement details show additional information that was captured with the trace records, but
does not fit into any of the tabular displays of all selected records. The structure of the statement
details’ view depends on the type of trace record. For SQL, BUF, and ENQ records, it includes
the variables’ values.
A statement’s details are also available from the lists of structure-identical and value-identical
statements. In case of the structure-identical statements, the variable values are taken from the
statement’s first execution. In the individual trace records list, SQL records corresponding to
some operations (e.g., PREPARE, (RE)OPEN, EXECSTA, EXECSTM), also support the
navigation to the statement’s details. The variable names depend on the database platform.
Oracle uses “:An” (n is the variable’s running number), others use “?”.
The statement details are also accessible by double-click on the statement. For SQL records,
this calls the view with variable names and values shown separately.
28
Trace Analysis
DDIC Information
The DDIC information¹ displays data on the selected object in three areas:
• Technical names in DDIC and on the database²; category; logical storage parameters;
buffering status and type
• Context short description; application component hierarchy; author(s); last editor
• Statistics static nametab record length; date of last optimizer statistics update;
average length of table record and index records
A list with the (primary) key and any (secondary) indexes follows below these areas.
The DDIC information is available in the list of individual trace records, the display of structure-
and value-identical statements and the list of table accesses. In all cases, it can also be called
by double-click on the object’s name.
29
Trace Analysis
Execution Plan
The execution plan is the path by which the database accesses the data requested by the SQL
statement. Its details and its features are highly dependent on the make, model, and version of
the underlying database platform.¹ The overall structure of the display always includes the
statement with variable names, but without actual variable values. This is followed by the
execution plan where typically the individual steps of the access strategy, the used index(es),
and the costs as determined by the database’s cost based optimizer are given. Some database
platforms include statistics (e.g., number of rows in the table, number of distinct values in index
columns) on which the optimizer based its decision.
The execution plan displays how the statement would be executed under the conditions at the
time when it is called. This might be different from the execution plan that was used at the time
when the trace was recorded.
The execution plan can also be called from the list of individual trace records, where it is
available for (RE)OPEN; (RE)EXEC; EXECSTA; and EXECSTM operations, and the displays of
structure- and value-identical statements. Double-click on the cursor ID also navigates to the
execution plan. Depending on the make, model, and version of the database, it may be
supported only for SELECT statements.
For more information, refer to Gahm, Hermann: Explaining the explain plan (SDN blog at
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/18169).
¹ The screen shot above is from a system using a SAP HANA RDBMS Version 1 SP8 Rev. 85.
30
Trace Analysis
Execution Plan II
Statement editor 1
entered statement
1
With the execution plan for an SQL statement that was entered manually, the effects of
modifications to the statement’s structure or values on the access path and the estimated costs
can be deduced. This is a valuable tool for tuning slow statements.
31
Trace Analysis
ABAP Source Code
1
Statement’s call position 1
The source code position from where the statement was called¹ provides context information
and shows how the statement was programmed in ABAP. This is especially helpful for dynamic
SQL statements or for Open SQL statements that were modified by the database interface of the
ABAP work process.
Navigation to the ABAP source code also works from the list of individual trace records, and
from the displays of structure- and value-identical statements. In the lists of main and individual
records, the ABAP source code display can be called by double-clicking the program name. If a
structure- or value-identical statement was called from distinct ABAP source code positions, an
intermediate popup
¹ For RFC, HTTP, and APC server records as well as for AMC consumer records, the called function on the current
server is displayed.
32
Trace Analysis
ABAP Call Hierarchy
If the stack trace was active when the trace was recorded, the trace records contain ABAP call
stack information. From there, the call hierarchy leading to a statement can be retrieved during
trace analysis. This is especially helpful for enqueues which are always set in function pool
SAPLSENA. It is also useful for events encapsulated within frameworks. In both cases, the trigger
in the application coding may be far away from the direct caller of the traced statement.
Navigation to the ABAP source code position will show this immediate caller which does not
contribute to further problem analysis or resolution. The relevant application coding can be
identified in the ABAP call hierarchy and reached by double-click on the associated entry.
Navigation to the ABAP call hierarchy is also possible in the list of individual trace records, and
the display of structure-identical statements. If a structure-identical statement was called from
distinct ABAP source code positions, an intermediate popup like
allows to select the relevant top-level call. Its first call hierarchy is displayed upon double-click.
33
Trace Analysis
Code Inspector
Combine SQL 1
All trace records can be passed to Code Inspector. It will apply the global check variant
ANALYZE_SQL_TRACE (part of Code Inspector’s standard delivery) to the SQL trace records. It
investigates WHERE clauses for SELECTs, UPDATEs, and DELETEs and analyzes accesses to
buffered tables. This feature extends Code Inspector’s capabilities into the dynamic domain, so
that dynamic SQL statements, as well as database accesses through ADBC are covered. Only
SQL statements that were executed during trace recording are checked. Statements in
alternative paths of the application are not contained in the trace and therefore not inspected.
Trace analysis using Code Inspector is also available from the list of individual trace records and
the display of structure-identical statements.
34
Summary
Traces …
… help to check adherence to architecture requirements
… supply KPIs mandated by quality requirements
… reveal hot spots in an application
… indicate where optimization is required
35
Best Practice
Guidelines for Efficient Use of the Performance Trace
Keep the trace size as small as possible to minimize the risk of loosing trace records.
36
Further Reading
Books
Schneider, Thomas: SAP Performance Optimization Guide, SAP Press, 8th edition, 2018
Gahm, Hermann: ABAP Performance Tuning, SAP Press, 1st edition, 2009
Boes, Siegfried: Performanceoptimierung von ABAP-Programmen: Wie Sie Ihre SAP-
Anwendung schneller machen, dpunkt Verlag, 1st edition, 2009
SAPinsider
• Mensch, Manfred: Track Down the Root of Performance Problems with Transaction ST05
Notes
31511 (Program runs very long: Performance analysis)
805934 (FAQ: Database time)
37
Appendix I
Buffer Trace
38
Trace Display
Buffer Trace
Buffer trace records are always shown in the detailed trace list. The default layout shows these
columns:
• Time Start time of the event in the user’s time zone
• Duration Execution time of the operation in microseconds (µs)
• Program Name Name of the ABAP program that called the event
• Object Name Name of the table or view that was accessed
• Operation Operation that was executed (cf. Appendix V)
• Cursor <Not relevant for buffer records>
• Array <Not relevant for buffer records>
• Hits Number of records returned by the operation
• RC Return code of the executed operation
• DB connection <Not relevant for buffer records>
• Statement Encoded statement
The first character indicates the buffer type:
P: single record buffer (partial)
R: full or generic buffer (resident)
M: shared memory
S: shared buffer (Import/Export buffer)
C: CUA buffer
O: OTR buffer
Then the length of the specified keys is given, followed by the key field
values.
Further fields can be added by changing the ALV’s layout.
Buffer traces are seldom used: They very rarely identify optimization potential, but cause
significant overhead and produce huge trace files.
39
Buffer Trace Analysis
Statement Details
1
Buffer statement details 2
1 2
For buffer statements, the variables’ values are always listed separately.
The buffer operations are listed in Appendix V.
The key length is the total length of all table fields used in the statement’s WHERE clause.
Generic key length is the length of the generic key for generic buffered tables.
For the table fields used in the WHERE clause, name, type, and length are displayed and the
values used in the statement are given.
The statement details are accessible by double-click on the statement.
40
Appendix
Background Information on Table Buffers
41
Appendix
Buffer Loads in SQL and BUF Traces: Single Record Buffer
42
Appendix
Buffer Loads in SQL and BUF Traces: Generic Area Buffer
5
Read data from buffer 5
43
Appendix II
RFC Trace
44
Trace Display
RFC Trace
RFC trace records are only shown in the detailed trace list. The default layout shows these
columns:
• Time Start time of the event in the user’s time zone
• Duration Execution time of the operation in microseconds (µs)
• Program Name Name of the ABAP program that called the function module
• Object Name Source server for server calls
Destination server for client calls
? if it cannot be determined
• Operation Client: the function module was called from the current server
Server: the function module was executed on the current server
• Cursor <Not relevant for RFC records>
• Array <Not relevant for RFC records>
• Hits <Not relevant for RFC records>
• RC <Not relevant for RFC records>
• DB connection <Not relevant for RFC records>
• Statement Encoded statement:
Source server
Destination server
Client or Server
Name of the function module
Amount of data sent in Bytes
Amount of data received in Bytes
Further fields can be added by changing the ALV’s layout.
45
RFC Trace Analysis
Statement Details
1
RFC statement details 2
1 2
For RFC statements, the actual values passed into or returned by the called function are not
captured in the trace record.
The statement details are accessible by double-click on the statement.
46
Appendix
Background Information on RFCs
47
Appendix III
HTTP Trace
48
Trace Display
HTTP Trace
HTTP trace records are only shown in the detailed trace list. The default layout shows these
columns:
• Time Start time of the event in the user’s time zone
• Duration Execution time of the operation in microseconds (µs)
• Program Name Name of the called service with path
• Object Name Local server
• Operation Client: the service was called from the current server
Server: the service was executed on the current server
• Cursor <Not relevant for HTTP records>
• Array <Not relevant for HTTP records>
• Hits <Not relevant for HTTP records>
• RC HTTP status code
• DB connection TCP/IP protocol (in most cases HTTP or HTTPS)
• Statement Encoded statement:
Request method
HTTP status code with reason phrase
TCP/IP protocol
Hostname with port number where the service was executed
Name of the called service with path
Amount of data sent in Bytes
Amount of data received in Bytes
Further fields can be added by changing the ALV’s layout.
49
HTTP Trace Analysis
Statement Details
1
HTTP statement details 2
1 2
For HTTP statements, the actual values passed into or returned by the called service are not
captured in the trace record.
The statement details are accessible by double-click on the statement.
50
Appendix
Background Information on HTTPs
51
Appendix IV
Enqueue Trace
52
Trace Display
Enqueue Trace
Enqueue trace records are only shown in the detailed trace list. The default layout shows these
columns:
• Time Start time of the event in the user’s time zone
• Duration Execution time of the operation in microseconds (µs)
• Program Name Name of the ABAP program that called the function module
• Object Name Name of the lock object
• Operation Lock operation (cf. Appendix V)
• Cursor <Not relevant for ENQ records>
• Array <Not relevant for ENQ records>
• Hits Number of granules
• RC <Not relevant for ENQ records>
• DB connection <Not relevant for ENQ records>
• Statement Granules with:
Lock mode
Table name of the lock object
Lock argument
Further fields can be added by changing the ALV’s layout.
An enqueue trace is useful only in connection with an SQL trace. These traces need to be
analyzed together with the focus on the processing sequence to identify locks that are held too
long (requested too early or released too late).
53
Enqueue Trace Analysis
Statement Details
1
Enqueue statement 2
details
1 2
For enqueue records, the variables’ values are always listed separately.
The most common enqueue operations are listed in Appendix V.
The statement details are accessible by double-click on the statement.
54
Enqueue Trace Analysis
DDIC Information
dictionary
1
The DDIC information for an enqueue trace record displays the lock object in the ABAP
dictionary. There are three tabs:
• Attributes Administrative meta data on the lock object
• Tables Name(s) of the table(s) that contain the data records to be locked
There is always at least one table, which is shown in the Primary Table
area. Further tables linked via foreign key relation may be contained in the
Secondary Tables area.
The supported lock modes are listed in Appendix V.
• Lock parameter The lock parameters are defined in relation to the table’s fields. They
determine the highest possible granularity of the locks.
The DDIC information can be called by double-click on the object’s name.
55
Enqueue Trace Analysis
ABAP Source Code
The source code position for enqueue statements is most often in routines within the central
enqueue framework (function group SENA in SAP_BASIS). Displaying these routines will not
help with the analysis of enqueue problems. Always record an enqueue trace with an active
stack trace.
Navigation to the ABAP source code is possible by double-click on the program name.
56
Enqueue Trace Analysis
ABAP Call Stack
to statement
1
Navigation to ABAP
source code
If the stack trace was active at the time of trace recording, the trace records contain ABAP call
stack information. From that, the call hierarchy leading to a statement can be retrieved during
trace analysis. This is especially helpful for enqueues, which are set in function group SENA. The
trigger in the application coding may be far away from the immediate caller of the traced
statement. Navigation to the ABAP source code position will only show this immediate caller
which does not contribute to further problem analysis or resolution. The relevant application
coding can be identified in the ABAP call stack and reached by double-click on the associated
entry.
57
Appendix
Background Information on Enqueues
Enqueues are logical locks. They are required because physical DB locks are too
short-lived to achieve the data consistency objective of business processes with
multiple dialog steps.
The duration of logical locks shall be as short as possible―esp. for central objects
that are accessed frequently.
There are several types of enqueues.
58
Appendix V
Miscellaneous Tables
59
Appendix
DB Operations
DECLARE Assigns the SQL statement to a new cursor in the work process.
PREPARE Parses the SQL statement and determines the execution plan.
OPEN Passes a set of parameter values into a previously prepared
SELECT statement.
REOPEN Passes a set of parameter values into an SELECT statement that
has been used before.
FETCH Gets the record(s) matching the WHERE clause of the SELECT
statement into the DB interface of the R/3 work process.
LOBSTA Gets BLOB(s) contained in record(s).
EXECSTA Passes a set of parameter values into a previously prepared
statement that modifies the DB object.
EXECSTM Passes a set of parameter values into a previously prepared
statement that modifies the DB object.
REEXEC Passes a set of parameter values into a modifying statement that
has been used before.
© 2021 SAP SE. All rights reserved.
During the PREPARE operation, the database optimizer analyzes the statement to determine
the most efficient execution plan. This does not rely on the variables’ actual values. Parsed SQL
statement and execution plan are stored in the database’s statement cache.
For repeated executions of a scenario, there shall be no DECLARE, PREPARE, and OPEN
operations. Instead the system reuses the previously parsed statement from the cursor cache
and in REOPEN or REEXEC operations only passes the variable values.
Exception: MaxDB always determines the execution plan that is best suited for the actual
parameter values.
Some database platforms fetch and transfer the first data package already with the OPEN or
REOPEN operation.
The database operations serving a given SQL statement depend on the database platform.
MaxDB uses
• EXECSTA for COMMIT, ROLLBACK, TREX accesses
• EXECSTM for INSERT, UPDATE, DELETE, SELECT SINGLE with fully specified primary
key
60
Appendix
Table Types
In the first years of R/3, databases had a small maximum number of tables that could be created
in the database. Furthermore, in these days disc space was a precious and limited resource.
To work around the insufficient maximum number of tables, the concept of pool tables and table
pools was introduced. Pool tables are multiple logical tables that reside inside one physical
table, the so called table pool.
With cluster tables and table clusters the disc space issue was addressed. Cluster tables are
logical tables that reside inside physical tables, the so called table clusters. On the database
only the table cluster is visible.
From SAP_BASIS 8.00 on, pool and cluster tables are not supported any longer.
61
Appendix
Buffer Operations
Fully buffered tables are also contained in the generic area buffer.
62
Appendix
Buffer Types
Any statement recorded in an SQL trace accessed the database and did not use the buffer—
regardless of the object’s buffer type.
Ideally an SQL trace does not contain any records with a non-empty value in column BfTp. If the
buffer type is listed as SNG, GEN, FUL, CUST, or DDIC, further investigation of the statement is
required to understand why it bypasses the buffer and to identify possibilities for avoiding these
database accesses. For the other buffer types, either the application needs to be corrected or
the table’s buffer settings should be changed.
63
Appendix
Return Codes
Further return codes for buffer accesses are described in note 626573.
64
Appendix
Enqueue Operations
ENQUEUE Set lock or increase lock counter for the lock object.
DEQUEUE Remove lock or decrease lock counter for the lock object.
DEQ ALL Remove all locks on all lock objects for owner identified by owner
ID or transaction ID.
QUERY Read lock entries from the lock table.
STATIST Read statistics for the enqueue server.
Further enqueue operations are rarely used and mainly serve administrative or diagnostic
purposes.
65
Appendix
Enqueue Modes
E Write Lock
S Read Lock
X Exclusive, not cumulative
O Set Optimistic Lock
R Promote Optimistic Lock; Conversion from '0' to 'E'
U Only Collision Check for Extended Write Lock, as with 'X'
V Only Collision Check for Write Lock, as with 'E'
W Only Collision Check for Read Lock, as with 'S'
C Only Promotion Check for Optimistic Lock, as with 'R'
T Reserved
+ Reserved
•E The locked data can be read or processed by one user only. A request for
another exclusive lock or for a shared lock will be rejected.
• S Several users can read the same data at the same time, but as soon as a user
edits the data, a second user can no longer access this data. Requests for further
shared locks are accepted, even if they are issued by different users, but
exclusive locks are rejected.
• X Exclusive locks can be requested by the same transaction more than once and
handled successively, but an exclusive, not cumulative lock can only be
requested once by a given transaction. All other lock requests will be rejected.
• O Optimistic locks behave initially like shared locks and can be converted into
exclusive locks.
• R Converts an optimistic lock into an exclusive lock.
• U, V, W, C Checks whether one of the respective locks (‘X', ‘E', ‘S', ‘R') is possible, but does
not set any lock.
66
ABAP Tools for Performance Measurements and Analyses
Table of Contents
Approach
Assess an application’s resource consumption.
Oriented
Tools-
IV. Performance Trace (ST05)
Evaluate events that leave the ABAP work process.
Approach
Problem-
VI. Performance Analysis
Oriented
Combine the tools to analyze an application’s performance.
67
Thank You!
Contact information:
Manfred Mensch
Performance and Scalability
68
© 2021 SAP SE. All rights reserved
No part of this publication may be reproduced or transmitted in any form or for any purpose Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal
without the express permission of SAP SE. The information contained herein may be Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services
changed without prior notice. mentioned herein as well as their respective logos are trademarks or registered trademarks
of Business Objects Software Ltd. Business Objects is an SAP company.
Some software products marketed by SAP SE and its distributors contain proprietary
software components of other software vendors. Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase
products and services mentioned herein as well as their respective logos are trademarks or
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft
registered trademarks of Sybase, Inc. Sybase is an SAP company.
Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, All other product and service names mentioned are the trademarks of their respective
System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, companies. Data contained in this document serves informational purposes only. National
z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, product specifications may vary.
PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, The information in this document is proprietary to SAP. No part of this document may be
OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, reproduced, copied, or transmitted in any form or for any purpose without the express prior
RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, written permission of SAP SE.
Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered This document is a preliminary version and not subject to your license agreement or any
trademarks of IBM Corporation. other agreement with SAP. This document contains only intended strategies, developments,
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. and functionalities of the SAP® product and is not intended to be binding upon SAP to any
particular course of business, product strategy, and/or development. Please note that this
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or
document is subject to change and may be changed by SAP at any time without notice.
registered trademarks of Adobe Systems Incorporated in the United States and/or other
countries. SAP assumes no responsibility for errors or omissions in this document. SAP does not
Oracle is a registered trademark of Oracle Corporation. warrant the accuracy or completeness of the information, text, graphics, links, or other items
contained within this material. This document is provided without a warranty of any kind,
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. either express or implied, including but not limited to the implied warranties of
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are merchantability, fitness for a particular purpose, or non-infringement.
trademarks or registered trademarks of Citrix Systems, Inc. SAP shall have no liability for damages of any kind including without limitation direct,
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World special, indirect, or consequential damages that may result from the use of these materials.
Wide Web Consortium, Massachusetts Institute of Technology. This limitation shall not apply in cases of intent or gross negligence.
Java is a registered trademark of Sun Microsystems, Inc. The statutory liability for personal injury and defective products is not affected. SAP has no
control over the information that you may access through the use of hot links contained in
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for these materials and does not endorse your use of third-party Web pages nor provide any
technology invented and implemented by Netscape. warranty whatsoever relating to third-party Web pages.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer,
StreamWork, and other SAP products and services mentioned herein as well as their
respective logos are trademarks or registered trademarks of SAP SE in Germany and other
countries.
69