Enablement Session:
ABAP Performance Tuning
Delivered By: Anshul Srivastava
Agenda
Day-1 Day-2 Day-3 Day-4 Day-5
Measuring ABAP Performance Trace Analysis of ABAP Dumps
Performance ABAP Trace TIME_OUT Dumps Database Analysis Miscellaneous
ABAP performance SQL Traces Memory Dumps
analysis (System wide) DB6 Architecture Pooled and Cluster
Buffer Trace Table
SQL Cache Analysis
Enqueue Trace SAP Table Buffering
R/3 Work load Monitor Suitable and Unsuitable
RFC Trace Debugging Access Path Performance best
practice (Golden Rules)
Response Time,
Selectivity
Dispatcher wait time, Analysis and Memory analysis of DB index / Changing
Interpretation of Traces Internal Table
Roll in etc . index design
ABAP SELECT and
ABAP tuning Technique Joins.
Analysing Individual
Objects
Database Tuning
Analysing Transaction Technique
steps
Handling Doubts and Handling Doubts and Handling Doubts and Handling Doubts and Handling Doubts and
Hands On Hands On Hands On Hands On Hands On
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 2
Day-1
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 3
Agenda
Day-1 Day-2 Day-3 Day-4 Day-5
Measuring ABAP Performance Trace Analysis of ABAP Dumps
Performance ABAP Trace TIME_OUT Dumps Database Analysis Miscellaneous
ABAP performance SQL Traces Memory Dumps
analysis (System wide) DB6 Architecture Pooled and Cluster
Buffer Trace Table
SQL Cache Analysis
Enqueue Trace SAP Table Buffering
R/3 Work load Monitor Suitable and Unsuitable
RFC Trace Debugging Access Path Performance best
practice (Golden Rules)
Response Time,
Selectivity
Dispatcher wait time, Analysis and Memory analysis of DB index / Changing
Interpretation of Traces Internal Table
Roll in etc . index design
ABAP SELECT and
ABAP tuning Technique Joins.
Analysing Individual
Objects
Database Tuning
Analysing Transaction Technique
steps
Handling Doubts and Handling Doubts and Handling Doubts and Handling Doubts and Handling Doubts and
Hands On Hands On Hands On Hands On Hands On
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 4
Measuring ABAP Performance
System bottlenecks may cause long-
running programs
System bottlenecks Long-running Programs
Hardware Unnecessary functionality
Configuration Non-optimal Implementation
Long-running programs may cause
system bottlenecks
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 5
Monitors
SM50/SM66
STAD
ST03/ST03N
ST06
ST02
ST04
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 6
Global Work Process Monitor – SM66
Used to display all
active work
processes across all
instances
WP Status Current action
Current runtime
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 7
Global Work Process Monitor – Status
Status column
Status waiting shows that the process is available for a user request.
Normally there should always be sufficient work processes with status waiting;
otherwise, users will experience poor response times.
You can check transaction SARFC to check sufficient free work process
Status running means that the work process is processing a user request
Look in the column Action/Reason for waiting
Status stopped means that the process is waiting
Look in the column Reason
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 8
Global Work Process Monitor
Work process in status running Look in column
Action/Reason
Database actions in column Action/Reason for waiting
Sequential read, Direct read
Insert, Update, Delete, Commit
R/3 actions in column Action/Reason for waiting
Load report, Load CUA
Roll in, Roll out
No action in column Action/Reason for waiting
Most likely ABAP processing
Work process in status stopped Look in column Reason
PRIV, DEBUG
CPIC
UPD, ENQ ...
SLEEP
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 9
Global Work Process Monitor
Processes without action in column Action/Reason for
waiting
Check CPU consumption (CPU button or Top CPU processes in Operating
System Monitor, ST06)
Process with high CPU consumption
– Good evidence for processing of ABAP statements ABAP trace
Process with no or low CPU consumption
– Hardware bottleneck (CPU, Paging)
– Process may have died?
– Other problems
All update processes in Status running, Report RSM13000, no information
in column Action
Update processing may be deactivated
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 10
Global Work Process Monitor
Processes in status stopped (1)
Reason PRIV: Normally no problem, if there are still enough work
processes in status waiting and the R/3 Extended Memory is not
exhausted
Time is not recorded in Workload Statistics (ST03)
Reason DEBUG: Using the debugger
Time is not recorded in Workload Statistics (ST03)
Reason CPIC: Find more information about status of CPIC connection in
the Gateway Monitor (Transaction SMGW)
Time shows up as CPIC+RFC time in Workload Statistics
Reason RFC: Work process is waiting for the response from an RFC call
Reason RPC: Work process is waiting for an ABAP program to be
generated (as of 6.10)
Reason SLEEP: Workprocess is waiting
This only appears for ‘fixed’ work processes (Batch or private)
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 11
Global Work Process Monitor
Processes in status stopped (2)
Reason GUI: Connection to GUI (e.g. data upload/download)
Reason NUM: Number range buffer is filled on an application server
Reason UPD: Dialog or Background work process waiting for update
Reason ENQ: Waiting for Enqueue
Reason ADM: ADM message (communication with message server)
Time during stopping for reasons GUI, UPD, ENQ, ADM show up as “Lost
time” in Workload Statistics
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 12
Work Process Overview - SM50
To display a snapshot of the
current activities on the
instance you are logged on to
Long-holding sequential reads are an
indication for expensive select
statements.
If direct reads (inserts, updates, deletes)
appear for a relatively long time in the
process overview, it is very likely that
there are DB locks.
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 13
Work Process Overview - SM50 - Details
Select the QP and use the
“Details” button. The
number of database reads
and the memory
consumption of the work
process are displayed
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 14
Monitors
SM50/SM66
STAD
ST03/ST03N
ST06
ST02
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 15
Transaction STAD
Display mode: Affects the way data are grouped
Read Interval: By default STAD shows data for the last
10 minutes
It can be changed but reading statistical records for
several hours might take longer. Statistical records are
only available for the last two days
Filter Parameters: Filter on user, transactions, task
type, etc. or on records that exceed a certain threshold
Tools:
Display data only from selected instances (default: all
instances)
Show additional application statistics that some
applications might add to the STAD record
Include statistics from memory: this will force a buffer
flush before reading statistical records from the file
system.
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 16
Via the push button ‚Sel.fields‘ you
can select the columns, that are
displayed in the overview list.
To display all details of one dialog
step just double click the
corresponding line in this list.
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 17
Rule of thumb: Processing time
should not be larger than
130% of CPU time
Processing time = Response
time - (Load time +
Generation time + Roll
(in+wait) time Database
request time + Enqueue
time)
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 18
Analysis of database requests(1)
Few but inefficient selects
database or SQL
statement tuning required
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 19
Analysis of database requests(2)
Many efficient selects
no database tuning
potential
check if all these db
requests are necessary
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 20
Task & memory information
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 21
Task and memory information
Network communication
between application server
and front-end
Memory information
Was heap memory used?
Did WP go into PRIV mode?
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 22
Example: high times for front-end communications (1)
10 seconds to transfer 770kB
from the application server to
the front-end
network speed probably
OK but too much data
transferred
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 23
Example: high times for front-end communications (2)
1.5 seconds per 1kB
Insufficient
network speed
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 24
Accesses to database tables
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 25
Top 10 table accesses in STAD records
To display current stat/tabrec setting (ST03->Online
Parameters->Diaglog step statistics)
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 26
RFC Information
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 27
Statistical Records: Entry Screen
Use Statistical Records
(transaction STAT/STAD)
Analyse critical transactions
Specify transaction or program in the
selection screen
Analyse long-running programs
Specify “Resp. time >=“
Analyse system waiting situations
(hanging situations)
Specify dialog work process with the
highest number
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 28
Monitors
SM50/SM66
STAD
ST03/ST03N
ST06
ST02
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 29
Workload Monitor – Workload Statistics
SAP Transaction ST03N, the
Workload Monitor,
summarizes statistics
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 30
Workload Monitor – Transaction Profile
Transaction Profile enables you to find out the
most-used transactions. Tuning these transactions
creates the greatest improvements in overall
performance.
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 31
Workload Monitor – Server Profile
Check that dialog steps and
response times are well
distributed
If they are not well distributed
then there is a problem with
the load balance.
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 32
Workload Monitor – Time Profile
The Time Profile view is used to
display various response times
across the system. High response
times in certain areas can indicate
where a bottleneck may exist
Does this view show if there is problem on the current system?
What are the possible reasons for this
bottleneck?
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 33
Workload Monitor – History
Check for days with bad response times
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 34
Workload Monitor – Summary
After performing the analysis, you should be able to answer the
following questions:
Is there a general performance problem?
Is the performance problem temporary or permanent?
Is there a hardware bottleneck?
Is there a general database performance problem?
Is load distribution non-optimal?
Is there a performance problem caused by R/3 memory
configuration?
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 35
Monitors
SM50/SM66
STAD
ST03/ST03N
ST06
ST02
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 36
Operating System Monitors
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 37
Operating System Monitors – Detail Analysis
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 38
Operating System Monitors – TOP CPU
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 39
Monitors
SM50/SM66
STAD
ST03/ST03N
ST06
ST02
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 40
Tune Summary
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 41
Demonstration of Monitors
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 42
Analysis of Time in work process
Dialog Response Time
SERV Roll-
Out
CPU
DB
RFC
DEST
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 43
Analysis of Time in work process
Greater than 10% of
Response time?
This may indicate the lack
of free work processes.
Check in transaction
ST03N, if the problem is
system wide.
Dialog Response Time
SERV Wait Roll-
Out
Dispatcher
CPU
DB
RFC
DEST
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 44
Analysis of Time in work process
Greater than 2 × CPU time?
Analyze hardware
bottlenecks in transaction
ST06.
Dialog Response Time
SERV Wait Proc. Proc. Proc. Roll-
Out
Dispatcher
CPU
DB
RFC
DEST
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 45
Analysis of Time in work process
Greater than 50 ms?
Repeat program execution.
If problem persists, check R/3
memory configuration –
program buffer may be too
small.
Dialog Response Time
SERV Wait Load Proc. Proc. Proc. Roll-
Out
Dispatcher
CPU
DB
RFC
DEST
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 46
Analysis of Time in work process
Greater than 0ms?
For the first run in system
it is OK.
Otherwise check the
buffers.
Dialog Response Time
SERV Wait Load Proc. Proc. Proc. Roll-
Out
Dispatcher
CPU
DB
RFC
DEST
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 47
Analysis of Time in work process
Relatively high value?
Check Statistical Records
with RFC Information in
remote system.
If GUI times are high, too,
check front-end
communication.
Dialog Response Time
SERV Wait Roll Load Proc. Roll- Proc. Proc. Roll- Roll- Roll-
In Wait Wait In Out
Dispatcher Dispatcher
CPU
DB
RFC Proc.
DEST
Display
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 48
Analysis of Time in work process
Dialog Response Time
SERV Wait Roll Load Proc. Roll- Proc. Database Proc. Roll- Roll- Roll-
In Wait request Wait In Out
Dispatcher Dispatcher
CPU
DB Proc.
RFC Proc.
DEST
Display
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 49
Analysis of Time in work process
Greater than 5ms?
Indicates the problem with
locking.
Dialog Response Time
SERV Wait Roll Load Proc. Roll- Proc. Database Proc. Roll- Roll- Roll-
In Wait request Wait In Out
Dispatcher Dispatcher
CPU
DB Proc.
RFC Proc.
DEST
Display
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 50
Analysis of Time in work process
Dialog Response Time
SERV Wait Roll Load Proc. Roll- Proc. Database Proc. Roll- Roll- Roll-
In Wait request Wait In Out
Dispatcher Dispatcher
CPU
DB Proc.
RFC Proc.
DEST
Display
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 51
Analysis of Time in work process
High RFC time?
Check corresponding RFC
statistical records in
remote system.
Dialog Response Time
SERV Wait Roll Load Proc. Roll- Proc. Database Proc. Roll- Roll- Roll-
In Wait request Wait In Out
Dispatcher Dispatcher
CPU
DB Proc.
RFC Proc.
DEST
Display
GUI
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 52
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 53
Thank You
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 54
© 2018 SAP SE or an SAP affiliate company. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an
SAP affiliate company.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE
(or an SAP affiliate company) in Germany and other countries. Please see http://global12.sap.com/corporate-en/legal/copyright/index.epx for additional trademark
information and notices.
Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
National product specifications may vary.
These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its
affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or
SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing
herein should be construed as constituting an additional warranty.
In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or
release any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future
developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for
any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-
looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place
undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.
© 2018 SAP SE or an SAP affiliate company. All rights reserved. Confidential 55