9
Getting Started Newsletters Store Products Services & Support About SCN Downloads Industries Training & Education Partnership Developer Center Lines of Business University Alliances Events & Webinars Innovation Log On Join Us Hi, Guest Search the Community Activity Communications Actions Browse SAP ERP Financials Controlling 0 Tweet 1 Performance Problem Guide Tips and Tricks Purpose Performance problem always happen during CO period end closing. It’s always not clear what to do when we meet performance problem. This blog will guide you what to do with detailed steps. Initial Analysis Necessary Information After you get a incident of performance issue, first you need to know below information: –What is the program/Tcode used? –What’s the status of the job? Is it still running? How long have it been running? What’s the normal finish time? –Have this issue happened before? If yes, how was it solved? –Is there any DB update, Kernel update, support package update recently? –Is the performance problem for this job only or system level? Check Job with SM37 First of all, of course, you need to log on to the system. Step1. Tcode: SM37 to check the job The easy way to find the job is to use Job name. You can also select the job according to status. Sometimes the job names are identical, we need to find the exact job by select the start condition. Step1. Tcode: SM37 to check the job The Duration time is the most important figure in this page. Click this button to show the log. You can check whether there are any error messages. How to analyze performance problem Posted by Owen Liu in SAP ERP Financials Controlling on Apr 21, 2015 4:15:51 PM Share 2 0 Like

How to Analyze Performance Problem _ SCN

Embed Size (px)

DESCRIPTION

How to Analyze Performance Problem

Citation preview

Page 1: How to Analyze Performance Problem _ SCN

4/21/2015 How to analyze performance problem | SCN

http://scn.sap.com/community/erp/financials/controlling/blog/2015/04/21/howtoanalyzeperformanceproblem 1/9

Getting Started Newsletters Store

Products Services & Support About SCN Downloads

Industries Training & Education Partnership Developer Center

Lines of Business University Alliances Events & Webinars Innovation

Log On Join UsHi, Guest Search the Community

Activity Communications Actions

Browse

SAP ERP Financials Controlling

0 Tweet 1

Performance Problem Guide Tips and Tricks PurposePerformance problem always happen during CO period end closing.It’s always not clear what to do when we meet performance problem.This blog will guide you what to do with detailed steps. Initial Analysis Necessary InformationAfter you get a incident of performance issue, first you need to know below information:

–What is the program/Tcode used?–What’s the status of the job? Is it still running? How long have it been running? What’s the normal finish time?–Have this issue happened before? If yes, how was it solved?–Is there any DB update, Kernel update, support package update recently?–Is the performance problem for this job only or system level? Check Job with SM37First of all, of course, you need to log on to the system.

Step1. Tcode: SM37 to check the jobThe easy way to find the job is to use Job name.You can also select the job according to status.Sometimes the job names are identical, we need to find the exact job by select the start condition.

Step1. Tcode: SM37 to check the jobThe Duration time is the most important figure in this page.Click this button to show the log. You can check whether there are any error messages.

How to analyze performance problemPosted by Owen Liu in SAP ERP Financials Controlling on Apr 21, 2015 4:15:51 PM

Share 2 0Like

Page 2: How to Analyze Performance Problem _ SCN

4/21/2015 How to analyze performance problem | SCN

http://scn.sap.com/community/erp/financials/controlling/blog/2015/04/21/howtoanalyzeperformanceproblem 2/9

Click Parameter, then click MENUGotoVariant to check the variant this job is using. See next screen>Here is the program name.

Here you can see all the parameters for the job.

Background Trace with ST12 Background trace with ST12If the performance issue is reproducible, this will be the best. Since we can start a ST12 trace for the job. Theperformance data collected will be more accurate and easy to analyze. You need to make settings for ST12 first.

Page 3: How to Analyze Performance Problem _ SCN

4/21/2015 How to analyze performance problem | SCN

http://scn.sap.com/community/erp/financials/controlling/blog/2015/04/21/howtoanalyzeperformanceproblem 3/9

Check current system timeThen check the current time for the system (sometimes the system you are using is with different time zone)Click MENUSystemStatus..

Here is the current system time.

Schedule the jobOpen a new session, and go to the Tcode you want to trace and schedule the job.

Remember to use background processing.Set the execution time. (According to current system time)Click Confirm.

Schedule ST12 traceGo back to ST12Click MENUUtilitiesSchedule traceFor Batchjob or workprocess

Input the job name in the last page.If the job name is not identical, you can use “user name” and program name to

Page 4: How to Analyze Performance Problem _ SCN

4/21/2015 How to analyze performance problem | SCN

http://scn.sap.com/community/erp/financials/controlling/blog/2015/04/21/howtoanalyzeperformanceproblem 4/9

We need to set the “From” time according to the job start time. “To” time, set it to one hour later.Change Interval to 10 secInput a meaningful CommentAt last, press “Schedule trace”

Schedule ST12 traceIf the trace is successfully collected, you should be able to see below status in the trace list:

Go back to the initial screen of ST12, on the bottom of the page, you should be able to select and check the traceresult:

Check Trace ResultNow click the “ABAP trace” button, below screen will show up:Please check next screen for detail explanation.

Advanced Analysis Check Trace ResultFirst, please check the time percentage bar.

Page 5: How to Analyze Performance Problem _ SCN

4/21/2015 How to analyze performance problem | SCN

http://scn.sap.com/community/erp/financials/controlling/blog/2015/04/21/howtoanalyzeperformanceproblem 5/9

–If ABAP takes the most time, it should be program problem, which should be analyzed by the team that owns theprogram. But for performance issues which take long time, 90% of the issues are caused by DB.–So most of the time Database will take the most time. Normally Database will show above 75% of the total time. Infact, if you get this result.If you want to continue the analysis:

–First you can sort descending by Net time, then you can see the first line shows the Call which takes the most time.Normally this should be the cause for the performance problem.–As you can see in the example, the time accessing table KEKO takes the most time. So first you can try to searchNotes with key words “Program Name” + “Table Name” +”Performance”.–You can click “DB>” to check more detail.

Check Execution PlanYou can see here are the list of relevant statements accessing table KEKO.You can select the most expensive one and click button “Explain”.

Check Execution PlanHere you can see the execution plan for this SQL statement:

IndexFirst we need to understand what is Index:

–When you look up businesses in a Yellow Pages telephone book, you probably never consider reading the entiretelephone book from cover to cover. You more likely open the book somewhere in the middle and zero in on therequired business by searching back and forth a few times, using the fact that the names are sorted alphabetically.–One way for the database to deal with an unsorted table is by using a timeconsuming sequential read record byrecord. To save the database from having to perform a sequential read for every SQL statement query, each databasetable has a corresponding primary index.Then we need to understand the difference between Primary Index and Secondary Index:

–We can consider the key fields combination of a table is the Primary Index. You can check with SE11 for each table tofind it’s key fields.–A primary index is always unique; that is, for each combination of index fields, there is only one table entry.–Sometimes the Primary Index is not sufficient. We need to define a Secondary Index that contains the fields we need.You can also check Secondary Index with SE11 by clicking button “Indexes…”.–For example, Material Number is not a key field of table KEKO. If we want to search by Material Number, we candefine a Secondary Index on the field Material Number. We can check in SE11, KEKO~A is the Secondary Index wetalked about.

Page 6: How to Analyze Performance Problem _ SCN

4/21/2015 How to analyze performance problem | SCN

http://scn.sap.com/community/erp/financials/controlling/blog/2015/04/21/howtoanalyzeperformanceproblem 6/9

Root CauseWe have known how to check the execution plan and the use of indexes. Now let’s discuss the causes of

performance issue.Basically there are 2 kinds of issues:

–Index is missing.–Wrong Index is used.(Testing can be performed via ST05 Enter SQL Statement) •Index is missing.•For example, when search KEKO with ZIFFR, since it’s not in Primary Index and no Secondary Index created, systemneed to make full table scan.•If the field ZIFFR contains a lot of unique values, this full table scan will be very time consuming.

Solution: Define new Secondary Index for the table. Wrong Index is used.

–Sometimes, although the correct index exists, due to some reasons, the optimizer still chooses the wrong index.oThis might be cause by obsolete table statistics. When there are changes to the table indexes, table statistics need tobe updated manually.oWith some database (e.g. MSSQLServer), the execution plan doesn’t change per each call, sometimes it follows thelast call’s execution plan. So there the wrong index might be used.Solutions:–Update table statistics.–Create DB hints (Reference Note 2006946) How to update table statisticsTcode: DB02

Page 7: How to Analyze Performance Problem _ SCN

4/21/2015 How to analyze performance problem | SCN

http://scn.sap.com/community/erp/financials/controlling/blog/2015/04/21/howtoanalyzeperformanceproblem 7/9

When Job is still running or not reproducible Job is still running.Analyze with SM50

–Normally issue happens on one or two tables, when you keep refresh the screen, the table remains the same. Thenyou should find out the statement and check the execution plan.–Via MENUAdministrationProgramDebugging, you can start debugging and find out the statement which is currentlybeing read.

Trace with ST12If the job is running for a long time and is still running. You can do ST12 trace for the job for a period like we did in

part I.You can get the job details from SM37.

Page 8: How to Analyze Performance Problem _ SCN

4/21/2015 How to analyze performance problem | SCN

http://scn.sap.com/community/erp/financials/controlling/blog/2015/04/21/howtoanalyzeperformanceproblem 8/9

Check with STADIf can’t reproduce the issue again. We can check the status during job running time via STAD.

You can check the result for “Database request time”.