Maximizing SAP ABAP Performance

17,058 views

Published on

Power Point presentation on Maximizing SAP ABAP performance

2 Comments
6 Likes
Statistics
Notes
No Downloads
Views
Total views
17,058
On SlideShare
0
From Embeds
0
Number of Embeds
62
Actions
Shares
0
Downloads
907
Comments
2
Likes
6
Embeds 0
No embeds

No notes for slide

Maximizing SAP ABAP Performance

  1. 1. ABAP Performance Analysis
  2. 2. <ul><li>SCI - Code Inspector </li></ul><ul><li>ST05 – Performance Trace </li></ul><ul><li>SE30 ABAP Runtime Analysis </li></ul>Tools of the Trade
  3. 3. Tools of the Trade <ul><li>SCI – Code Inspector </li></ul><ul><ul><ul><li>Static analysis of the quality of the code. Scans your program code and reports on potential problems particularly in the area of performance and security. </li></ul></ul></ul><ul><ul><li>Benefits: </li></ul></ul><ul><ul><li>Analysis of SQL WHERE clause of SELECT, UPDATE and DELETE statements. </li></ul></ul><ul><ul><li>Identifies select statements that do not handle sy-subrc return codes </li></ul></ul><ul><ul><li>Use of statements that infer ominous database access </li></ul></ul><ul><ul><li>Identifies statements that bypass buffering </li></ul></ul><ul><ul><li>Drill through support from results screen to program source statement. </li></ul></ul><ul><ul><li>Etc. </li></ul></ul><ul><ul><li>Disadvantages: </li></ul></ul><ul><ul><li>Static checks cannot identify the relevancy of a piece of code </li></ul></ul><ul><ul><li>Cannot determine the frequency of execution of a statement of code. </li></ul></ul>
  4. 4. <ul><li>ST05 Performance Trace </li></ul><ul><ul><ul><li>The Performance Trace allows you to record database access, locking activities, and remote calls of reports and transactions in a trace file and to display the performance log as a list. It also provides extensive support for analyzing individual trace records. </li></ul></ul></ul><ul><ul><li>Benefits: </li></ul></ul><ul><ul><li>Comprehensive tools set for evaluation of SQL statements </li></ul></ul><ul><ul><li>Integrated tools for accessing DDIC information </li></ul></ul><ul><ul><li>Disadvantages: </li></ul></ul><ul><ul><li>Dynamic analysis requires equivalent production data content </li></ul></ul><ul><ul><li>Limited to database access analysis, no evaluation of code path execution </li></ul></ul>Tools of the Trade
  5. 5. <ul><li>SE30 ABAP Runtime Analysis </li></ul><ul><ul><ul><li>The runtime analysis provides an overview of the duration and performance of your source code, from individual statements up to complete transactions. </li></ul></ul></ul><ul><ul><li>Benefits: </li></ul></ul><ul><ul><li>Quickly identifies the percentage of time spent in database in contrast to abap code execution. </li></ul></ul><ul><ul><li>Evaluation of modularization units, modules, performs, functions, etc. </li></ul></ul><ul><ul><li>Analyze internal table operations </li></ul></ul><ul><ul><li>Disadvantage: </li></ul></ul><ul><ul><li>Dynamic analysis requires equivalent production data content </li></ul></ul><ul><ul><li>Lacks the integration of comprehensive SQL analysis tools </li></ul></ul>Tools of the Trade
  6. 6. Code Inspector Sophisticated static program checks should be part of each development process . <ul><li>Standard Checks Performed </li></ul><ul><ul><li>Syntax checks and program generation </li></ul></ul><ul><ul><ul><li>Normal ABAP syntax check </li></ul></ul></ul><ul><ul><ul><li>Extended Program Check </li></ul></ul></ul><ul><ul><ul><li>Program Generation </li></ul></ul></ul><ul><ul><li>Security checks </li></ul></ul><ul><ul><ul><li>Use of statements deemed critical </li></ul></ul></ul><ul><ul><ul><li>Use of statements the infers ominous database access </li></ul></ul></ul><ul><ul><ul><li>Selected statements that do not handle system return code </li></ul></ul></ul>
  7. 7. Code Inspector Sophisticated static program checks should be part of each development process . <ul><li>Standard Checks Performed (continued) </li></ul><ul><ul><li>Performance checks </li></ul></ul><ul><ul><ul><li>Select statements that implicitly bypass SAP table buffers </li></ul></ul></ul><ul><ul><ul><li>Check statements inside of SELETCT…ENDSELECT loops </li></ul></ul></ul><ul><ul><ul><li>Nested loops over internal tables and nested SELECT statements </li></ul></ul></ul><ul><ul><ul><li>Analysis of WHERE clause to determine support database indices </li></ul></ul></ul><ul><ul><li>Search operations </li></ul></ul><ul><ul><ul><li>Search for single tokens </li></ul></ul></ul><ul><ul><ul><li>Search for complete statements </li></ul></ul></ul>
  8. 8. Code Inspector Sophisticated static program checks should be part of each development process . Access directly from the Abap Editor, from SE38 or SE80
  9. 9. Code Inspector Sophisticated static program checks should be part of each development process . 16 31 6 Informational Warnings Error <ul><li>Extended Program Checks </li></ul><ul><li>Errors: </li></ul><ul><li>No EXCEPTION to set SY-SUBRC Declared for CALL FUNCTION. </li></ul><ul><ul><li>Evaluate to remove sy-subrc condition or possibly warrants the review of the function module for modification. </li></ul></ul><ul><li>This line contains a BREAK-POINT statement. </li></ul><ul><ul><li>All break points should be removed from production code unless specific reasons warrant their use. </li></ul></ul><ul><li>Dangerous use of TRANSLATE in a multilingual system. </li></ul><ul><ul><li>Evaluate to determine if this will have an impact when we implement other languages. </li></ul></ul><ul><li>Performance Checks </li></ul><ul><li>Errors: </li></ul><ul><li>Table VEPO no field from Table Index in WHERE condition </li></ul><ul><ul><li>Can the format of where clause be changed to use an index </li></ul></ul><ul><ul><li>Create an index to support where condition if warranted. </li></ul></ul><ul><li>Warnings: </li></ul><ul><li>Table KNMT: No First Field from Table Index in WHERE condition </li></ul><ul><ul><li>Further analysis may be required to determine if this is a problem. Dynamic analysis that determines frequency of execution can be used to determine impact of the warning. </li></ul></ul>
  10. 10. <ul><li>Transaction ST05 </li></ul><ul><ul><li>Used to analyze and fine-tune program’s database access </li></ul></ul><ul><ul><li>Dynamic analysis </li></ul></ul><ul><ul><li>Must be logged into processor where job is running that is subject to the trace. </li></ul></ul><ul><ul><li>Should pre-load the application before trace is started. </li></ul></ul><ul><ul><li>Should strive to use this trace in QA unless production problem cannot be re-created. </li></ul></ul><ul><li>Types of traces available </li></ul><ul><ul><li>SQL Trace </li></ul></ul><ul><ul><li>Enqueue Trace </li></ul></ul><ul><ul><li>RFC Trace </li></ul></ul><ul><ul><li>Buffer Trace </li></ul></ul>Performance Trace
  11. 11. Performance Trace Activate Trace with Filter Used to start the trace against another process. Activate Trace Use to start the trace in your current dialog process. Once activated you may exit the transaction and run the program that you wish to trace. User name Useful to start a trace another users dialog session. Transaction Further limits bounder of trace to a tcode. Process ID Used to activate trace against a batch process.
  12. 12. Performance Trace Display Trace
  13. 13. Performance Trace
  14. 14. Performance Trace - SQL Statement Summary
  15. 19. <ul><ul><li>Is there any SELECT * statements in use? </li></ul></ul><ul><ul><ul><li>Change them to SELECT COL1,COL2,COL3 specifying columns </li></ul></ul></ul><ul><ul><li>Are any CHECK statements embedded in SELECT..ENDSELECTs </li></ul></ul><ul><ul><ul><li>Incorporate the check statement logic in WHERE clause </li></ul></ul></ul><ul><ul><li>Do SELECTs use appropriate DB Index or is table buffered? </li></ul></ul><ul><ul><ul><li>Change logic, create an index, or buffer table </li></ul></ul></ul><ul><ul><li>Is nested SELECTs being used to retrieve data? </li></ul></ul><ul><ul><ul><li>Convert to DB join, view or SELECT FOR ALL ENTRIES IN ITAB </li></ul></ul></ul><ul><ul><li>Are there SELECTs without WHERE clauses, on tables that grow? </li></ul></ul><ul><ul><ul><li>You need to redesign the solution. </li></ul></ul></ul><ul><ul><li>Are SELECTs to master data tables buffered? </li></ul></ul><ul><ul><ul><li>Store master data in itab and use READ TABLE…BINARY SEARCH to eliminate duplicate access with same key </li></ul></ul></ul>Performance Trace - SQL Statement Evaluation Checklist
  16. 20. <ul><ul><li>Is SELECT…APPEND ITAB…ENDSELECT being used? </li></ul></ul><ul><ul><ul><li>Change processing to read data immediately into ITAB </li></ul></ul></ul><ul><ul><li>Is SELECT ORDER BY statements being used? </li></ul></ul><ul><ul><ul><li>Read data to ITAB and then sort, unless DB Index supports order by. </li></ul></ul></ul><ul><ul><li>Is program using calculations and summations that can be done on the database via SUM, AVG, MIN or MAX functions of SELECT? </li></ul></ul><ul><ul><ul><li>Use the calculations available on the SELECT statement. </li></ul></ul></ul><ul><ul><li>Are ITABs processed using READ TABLE itab WITH KEY? </li></ul></ul><ul><ul><ul><li>Change table accesses to use BINARY SEARCH method. </li></ul></ul></ul>Performance Trace - SQL Statement Evaluation Checklist
  17. 21. <ul><li>Tips for Running Trace </li></ul><ul><ul><li>Limit the duration of the trace to 10 minutes or less </li></ul></ul><ul><ul><li>Preload the program once to initialize database and cursor buffers </li></ul></ul><ul><ul><li>To access trace results later </li></ul></ul><ul><ul><ul><li>Save the trace or.. </li></ul></ul></ul><ul><ul><ul><li>Record stop and start time of trace </li></ul></ul></ul><ul><ul><li>Utilize trace SQL statement summary function </li></ul></ul><ul><ul><li>5,000ms access per execution, general rule of thumb </li></ul></ul><ul><ul><li>Make note of the appserver of the job you are tracing </li></ul></ul><ul><ul><li>Only ONE trace can be active on an appserver. </li></ul></ul>Performance Trace
  18. 22. <ul><li>Transaction SE30 </li></ul><ul><ul><li>Excessive or unnecessary use of modularization units </li></ul></ul><ul><ul><li>CPU intensive program functions </li></ul></ul><ul><ul><li>Inefficient or redundant database access </li></ul></ul>Runtime Analysis <ul><li>Three phases of the ABAP runtime analysis. </li></ul><ul><ul><li>Setting limits for the data that is measured </li></ul></ul><ul><ul><li>Measuring the data </li></ul></ul><ul><ul><li>Analyzing the data. </li></ul></ul>
  19. 23. Runtime Analysis
  20. 24. Runtime Analysis Initial Screen
  21. 25. Runtime Analysis Variant: Statements Filter Limit the trace to specified type of program statements.
  22. 26. Runtime Analysis Variant: Duration and Type Max File size default is 2meg Aggregation: Full – one trace record for each program part or instruction. By Call – one trace record for every calling position None – one trace record for each call. LARGE FILE!
  23. 27. Runtime Analysis Measurement Overview Abap interpreter Database System Statements Green bar indicates less that 50% of the total runtime. Database bar will be red when more than 25% runtime.
  24. 28. Runtime Analysis Database Table Hit List – shows table names number of accesses , table type and buffering mode sorted by access time.
  25. 29. Group Hit List Individual call instructions grouped by categories. Indicates the gross runtime and the number of times executed. Runtime Analysis
  26. 30. Runtime Analysis Internal Table Hit List List of all internal table accesses. Shows the number of accesses, the gross and net time required and the total memory consumed.
  27. 31. Runtime Analysis Call Hierarchy Shows the chronological sequence of analyzed objects, the gross and net time taken at each call level.
  28. 32. Runtime Analysis - Statistics
  29. 33. <ul><li>Statistics </li></ul>Runtime Analysis Number of form routines called in the specified program Called forms Number of Remote Function Calls RFC call. Number of function modules called from a module pool Called F. modules Number of function modules defined within a function group Defined F modules Number of form routines defined in the specified program Defined forms Number of methods called from the specified program Called methods Number of methods defined in the specified program Defined methods Memory occupied by the global data of the program when loaded (in bytes) Global data def. Memory occupied by the program when loaded (in bytes) Load Size Program name Program
  30. 34. <ul><li>Always perform static source evaluation </li></ul>Summary <ul><li>Do not leave a trace running for an extended period of time, consume system resources </li></ul><ul><li>You must be logged in to the same appserver as the process you are tracing. </li></ul><ul><li>Powerful set of analysis tools </li></ul><ul><ul><ul><li>With power and the freedom to use them comes responsibility </li></ul></ul></ul>
  31. 35. Questions?

×