SlideShare a Scribd company logo
1 of 4
AWR reports: Measuring CPU
Introduction
AWR is a wonderful tool oracle has provided for database health checkup. It deals with a
lot of things necessary to tune the database like TOP 5 wait events, SQL ordered by
elapsed time/CPU time/Buffer gets/Physical reads etc. Among other things, the most
crucial information in AWR is the amount of CPU used by the system i.e. how much of
the CPU time oracle processes took for the elapsed time. When AWR deals with time, it
deals with several kinds of time.
ELAPSED TIME: This is the time between start and end snapshots time of AWR.
Here the elapsed time is 30 mins.
DB TIME: This is the time Oracle has spent responding user calls. On a busy system,
this time usually greater than ELAPSED TIME. This time is the sum of total time spent
in CPU and total time waiting for various non-idle events such as I/O, Enqueue etc
DB Time in the AWR printed above is 8488 mins.
CPU TIME: This is the time Oracle spent on CPU i.e. using the CPU. This can also
exceed ELAPSED TIME as if we have many CPUs then oracle can use each of them. For
46 CPUs, we have 46s of CPU time per sec elapsed time.
When it comes to CPU time, AWR refers to it by three different names:
1) CPU TIME
2) DB CPU
3) CPU USED BY THIS SESSION
Measuring CPU
If the CPU TIME occurs in the TOP 5 wait event, this does not necessarily indicate a
problem. For example:
Here the CPU TIME is 35938s which is just 7.1 % of DB TIME. Even if it was high, this
might not indicate a problem. It could be that the database is busy in utilizing the CPU.
To know whether CPU TIME is a problem, we need to compare it with the available
CPU power we have. If the usage is high in comparison to total CPU power, then it is
serious problem and need to be addressed.
The formula to calculate total CPU power in seconds is:
TOTAL CPU= NUM_CPUS*ELAPSED_TIME*60, where NUM_CPUs can be found
from Operative system statistics section.
If we use this formula in our current scenario, we have:
Total CPU=46 *30*60=82800s.
So, we have 82800 seconds of CPU time for 1800 seconds of DB TIME.
Therefore, % of CPU used by Oracle processes= 35938/82800*100=43%.
This means oracle processes used 43% of total CPU power available in the system.
AWR also provides CPU consumption from OS perspective. In the Operating System
Statistics, we have BUSY TIME AND IDLE TIME.
We can calculate the % CPU busy time by the formula:
% BUSY TIME= {BUSY_TIME/ (BUSY_TIME+IDLE_TIME)}*100
= {5788280/8365936}*100
= 69%
This means that the system was overall 69% was busy utilizing the CPU.
BUSY_TIME can further be divided into SYS_TIME+USER_TIME.
BUSY_TIME=SYS_TIME+USER_TIME
We can also calculate % of SYS_TIME and % of USER_TIME.
% SYS_TIME = (SYS_TIME/BUSY_TIME)*100
%USER_TIME = (USER_TIME/BUSY_TIME)*100
Applying the above formula in our present case, we have:
%SYS_TIME = (1487507/5788280)*100
= 25.7%
%USER_TIME = (4300773/5788280)*100
= 74%
As we can see approx 74% of CPU was accounted for USER_TIME. But this 74% is
actually 74% of %BUSY_TIME ie 69%.
Therefore, 74% of 69% = 51%
This is the actual USER_TIME.
Similarly, for SYS_TIME 25.7% of 69%= 17.7%
This is the actual SYS_TIME.
Now if we see, CPU_TIME and USER_TIME differ by 51-43=8%.
This means, apart from oracle processes, 8% of CPU was utilized by non oracle non
system processes. It could also be that 8% of time was spent in runqueue ie waiting for
CPU
Once we find out High CPU usage is the issue, we need to find out where the maximum
CPU time is getting used. If there is high CPU, then essentially, we will have to find
where the CPU is spent, either in SQL execution or SQL Parsing.
The first thing to look at is parsing because this is a CPU-intensive operation. If the
database is doing lots of hard parse it means lack of cursor sharing resulting in thousands
of statements spreading across shared pool which only differ with literal values.
We can look for SQL statements consuming High CPU.
We can look in SQL statements ordered by CPU, SQL statements ordered by Buffer gets.
However, while examining sql statements our metric value should be per execution basis.
Once the SQL is identified then it’s easy to tune it.
A couple of caveats
Analyzing CPU usage from AWR can be tricky as well. For example, if we need to
calculate the CPU usage for a particular time lets say from 7:15 to 7:30, then to gather
CPU information from a 60 minute report is useless. Fortunately, in 10g and above,
oracle provides us with another amazing utility, the ASH which stands for active session
history. By using ASH, we can go to any time period we want and see how much of the
CPU was consumed for that time period.
Conclusion
AWR provides a lot of information regarding CPU utilization. But it can be tricky to get
the exact details of time spent in CPU.AWR in coordination with ASH becomes power
pact performance analyzer tool that put before us all the artifacts necessary to
troubleshoot CPU utilization issues. What differentiates CPU TIME from other wait
events is that other wait events can be measured with respect to DB TIME but CPU
TIME should be measured w .r .t. the total CPU capacity of the system.
References:
http://docs.oracle.com/cd/B19306_01/server.102/b14211/toc.htm
http://savvinov.com/2012/04/06/awr-reports-interpreting-cpu-usage/
http://dboptimizer.com/2011/07/21/oracle-cpu-time/

More Related Content

What's hot

Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsZohar Elkayam
 
Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014John Beresniewicz
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the TradeCarlos Sierra
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsJohn Beresniewicz
 
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTanel Poder
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsEnkitec
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data miningYury Velikanov
 
Deep review of LMS process
Deep review of LMS processDeep review of LMS process
Deep review of LMS processRiyaj Shamsudeen
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
OOUG: Oracle transaction locking
OOUG: Oracle transaction lockingOOUG: Oracle transaction locking
OOUG: Oracle transaction lockingKyle Hailey
 
DB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerDB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerAndrejs Vorobjovs
 
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~Ryota Watabe
 
Understanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginnersUnderstanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginnersCarlos Sierra
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder
 

What's hot (20)

Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
 
Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the Trade
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
 
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata Migrations
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data mining
 
Deep review of LMS process
Deep review of LMS processDeep review of LMS process
Deep review of LMS process
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools short
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
Using Statspack and AWR for Memory Monitoring and Tuning
Using Statspack and AWR for Memory Monitoring and TuningUsing Statspack and AWR for Memory Monitoring and Tuning
Using Statspack and AWR for Memory Monitoring and Tuning
 
OOUG: Oracle transaction locking
OOUG: Oracle transaction lockingOOUG: Oracle transaction locking
OOUG: Oracle transaction locking
 
ASH and AWR on DB12c
ASH and AWR on DB12cASH and AWR on DB12c
ASH and AWR on DB12c
 
AWR & ASH Analysis
AWR & ASH AnalysisAWR & ASH Analysis
AWR & ASH Analysis
 
DB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerDB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource Manager
 
Ash and awr deep dive hotsos
Ash and awr deep dive hotsosAsh and awr deep dive hotsos
Ash and awr deep dive hotsos
 
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~
 
Understanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginnersUnderstanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginners
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
 

Viewers also liked

OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersConnor McDonald
 
RMOUG 2012 - Mining the AWR
RMOUG 2012 - Mining the AWRRMOUG 2012 - Mining the AWR
RMOUG 2012 - Mining the AWRKristofferson A
 
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Kristofferson A
 
Awr1page - Sanity checking time instrumentation in AWR reports
Awr1page - Sanity checking time instrumentation in AWR reportsAwr1page - Sanity checking time instrumentation in AWR reports
Awr1page - Sanity checking time instrumentation in AWR reportsJohn Beresniewicz
 
How to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problemHow to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problemCary Millsap
 
Feb14 successful development
Feb14 successful developmentFeb14 successful development
Feb14 successful developmentConnor McDonald
 
12c for Developers - Feb 2014
12c for Developers - Feb 201412c for Developers - Feb 2014
12c for Developers - Feb 2014Connor McDonald
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writerKyle Hailey
 
Oracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersOracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersKyle Hailey
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013Connor McDonald
 
OakTable World Sep14 clonedb
OakTable World Sep14 clonedb OakTable World Sep14 clonedb
OakTable World Sep14 clonedb Connor McDonald
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsJohn Kanagaraj
 
Enterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLIEnterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLIGokhan Atil
 
Reading AWR or Statspack Report - Straight to the Goal
Reading AWR or Statspack Report - Straight to the GoalReading AWR or Statspack Report - Straight to the Goal
Reading AWR or Statspack Report - Straight to the GoalFranck Pachot
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsGokhan Atil
 
The Most Important Things You Should Know about Oracle®
The Most Important Things You Should Know about Oracle®The Most Important Things You Should Know about Oracle®
The Most Important Things You Should Know about Oracle®Cary Millsap
 

Viewers also liked (20)

OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
 
RMOUG 2012 - Mining the AWR
RMOUG 2012 - Mining the AWRRMOUG 2012 - Mining the AWR
RMOUG 2012 - Mining the AWR
 
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
 
Ash and awr performance data2
Ash and awr performance data2Ash and awr performance data2
Ash and awr performance data2
 
AWR, ASH with EM13 at HotSos 2016
AWR, ASH with EM13 at HotSos 2016AWR, ASH with EM13 at HotSos 2016
AWR, ASH with EM13 at HotSos 2016
 
Awr1page - Sanity checking time instrumentation in AWR reports
Awr1page - Sanity checking time instrumentation in AWR reportsAwr1page - Sanity checking time instrumentation in AWR reports
Awr1page - Sanity checking time instrumentation in AWR reports
 
Intro to ASH
Intro to ASHIntro to ASH
Intro to ASH
 
How to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problemHow to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problem
 
Analytic SQL Sep 2013
Analytic SQL Sep 2013Analytic SQL Sep 2013
Analytic SQL Sep 2013
 
Feb14 successful development
Feb14 successful developmentFeb14 successful development
Feb14 successful development
 
12c for Developers - Feb 2014
12c for Developers - Feb 201412c for Developers - Feb 2014
12c for Developers - Feb 2014
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writer
 
Oracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersOracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmasters
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013
 
OakTable World Sep14 clonedb
OakTable World Sep14 clonedb OakTable World Sep14 clonedb
OakTable World Sep14 clonedb
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
 
Enterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLIEnterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLI
 
Reading AWR or Statspack Report - Straight to the Goal
Reading AWR or Statspack Report - Straight to the GoalReading AWR or Statspack Report - Straight to the Goal
Reading AWR or Statspack Report - Straight to the Goal
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAs
 
The Most Important Things You Should Know about Oracle®
The Most Important Things You Should Know about Oracle®The Most Important Things You Should Know about Oracle®
The Most Important Things You Should Know about Oracle®
 

Similar to AWR reports-Measuring CPU

Oracle Performance Tuning DE(v1.2)-part2.ppt
Oracle Performance Tuning DE(v1.2)-part2.pptOracle Performance Tuning DE(v1.2)-part2.ppt
Oracle Performance Tuning DE(v1.2)-part2.pptVenugopalChattu1
 
Analyze database system using a 3 d method
Analyze database system using a 3 d methodAnalyze database system using a 3 d method
Analyze database system using a 3 d methodAjith Narayanan
 
Awr + 12c performance tuning
Awr + 12c performance tuningAwr + 12c performance tuning
Awr + 12c performance tuningAiougVizagChapter
 
Automation system performance myths
Automation system performance mythsAutomation system performance myths
Automation system performance mythspaulguerin
 
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docxSheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docxbagotjesusa
 
Guide to alfresco monitoring
Guide to alfresco monitoringGuide to alfresco monitoring
Guide to alfresco monitoringMiguel Rodriguez
 
CPU scheduling in Operating System Explanation
CPU scheduling in Operating System ExplanationCPU scheduling in Operating System Explanation
CPU scheduling in Operating System ExplanationAnitaSofiaKeyser
 
empirical masurements
empirical masurementsempirical masurements
empirical masurementsRajendran
 
20118016 aryan sabat study and analysis of scheduler design
20118016 aryan sabat study and analysis of scheduler design20118016 aryan sabat study and analysis of scheduler design
20118016 aryan sabat study and analysis of scheduler design8016AryanSabat
 
How to find what is making your Oracle database slow
How to find what is making your Oracle database slowHow to find what is making your Oracle database slow
How to find what is making your Oracle database slowSolarWinds
 
An eternal question of timing
An eternal question of timingAn eternal question of timing
An eternal question of timingPVS-Studio
 
200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DB200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DBcookie1969
 

Similar to AWR reports-Measuring CPU (20)

Oracle Performance Tuning DE(v1.2)-part2.ppt
Oracle Performance Tuning DE(v1.2)-part2.pptOracle Performance Tuning DE(v1.2)-part2.ppt
Oracle Performance Tuning DE(v1.2)-part2.ppt
 
Analyze database system using a 3 d method
Analyze database system using a 3 d methodAnalyze database system using a 3 d method
Analyze database system using a 3 d method
 
Awr + 12c performance tuning
Awr + 12c performance tuningAwr + 12c performance tuning
Awr + 12c performance tuning
 
Analyzing awr report
Analyzing awr reportAnalyzing awr report
Analyzing awr report
 
Unit 2 notes
Unit 2 notesUnit 2 notes
Unit 2 notes
 
Automation system performance myths
Automation system performance mythsAutomation system performance myths
Automation system performance myths
 
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docxSheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
 
Guide to alfresco monitoring
Guide to alfresco monitoringGuide to alfresco monitoring
Guide to alfresco monitoring
 
1.prallelism
1.prallelism1.prallelism
1.prallelism
 
1.prallelism
1.prallelism1.prallelism
1.prallelism
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
CPU scheduling in Operating System Explanation
CPU scheduling in Operating System ExplanationCPU scheduling in Operating System Explanation
CPU scheduling in Operating System Explanation
 
empirical masurements
empirical masurementsempirical masurements
empirical masurements
 
Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
20118016 aryan sabat study and analysis of scheduler design
20118016 aryan sabat study and analysis of scheduler design20118016 aryan sabat study and analysis of scheduler design
20118016 aryan sabat study and analysis of scheduler design
 
How to find what is making your Oracle database slow
How to find what is making your Oracle database slowHow to find what is making your Oracle database slow
How to find what is making your Oracle database slow
 
An eternal question of timing
An eternal question of timingAn eternal question of timing
An eternal question of timing
 
200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DB200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DB
 
Operating System.pptx
Operating System.pptxOperating System.pptx
Operating System.pptx
 
exp 3.docx
exp 3.docxexp 3.docx
exp 3.docx
 

AWR reports-Measuring CPU

  • 1. AWR reports: Measuring CPU Introduction AWR is a wonderful tool oracle has provided for database health checkup. It deals with a lot of things necessary to tune the database like TOP 5 wait events, SQL ordered by elapsed time/CPU time/Buffer gets/Physical reads etc. Among other things, the most crucial information in AWR is the amount of CPU used by the system i.e. how much of the CPU time oracle processes took for the elapsed time. When AWR deals with time, it deals with several kinds of time. ELAPSED TIME: This is the time between start and end snapshots time of AWR. Here the elapsed time is 30 mins. DB TIME: This is the time Oracle has spent responding user calls. On a busy system, this time usually greater than ELAPSED TIME. This time is the sum of total time spent in CPU and total time waiting for various non-idle events such as I/O, Enqueue etc DB Time in the AWR printed above is 8488 mins. CPU TIME: This is the time Oracle spent on CPU i.e. using the CPU. This can also exceed ELAPSED TIME as if we have many CPUs then oracle can use each of them. For 46 CPUs, we have 46s of CPU time per sec elapsed time. When it comes to CPU time, AWR refers to it by three different names: 1) CPU TIME 2) DB CPU 3) CPU USED BY THIS SESSION Measuring CPU If the CPU TIME occurs in the TOP 5 wait event, this does not necessarily indicate a problem. For example:
  • 2. Here the CPU TIME is 35938s which is just 7.1 % of DB TIME. Even if it was high, this might not indicate a problem. It could be that the database is busy in utilizing the CPU. To know whether CPU TIME is a problem, we need to compare it with the available CPU power we have. If the usage is high in comparison to total CPU power, then it is serious problem and need to be addressed. The formula to calculate total CPU power in seconds is: TOTAL CPU= NUM_CPUS*ELAPSED_TIME*60, where NUM_CPUs can be found from Operative system statistics section. If we use this formula in our current scenario, we have: Total CPU=46 *30*60=82800s. So, we have 82800 seconds of CPU time for 1800 seconds of DB TIME. Therefore, % of CPU used by Oracle processes= 35938/82800*100=43%. This means oracle processes used 43% of total CPU power available in the system. AWR also provides CPU consumption from OS perspective. In the Operating System Statistics, we have BUSY TIME AND IDLE TIME. We can calculate the % CPU busy time by the formula: % BUSY TIME= {BUSY_TIME/ (BUSY_TIME+IDLE_TIME)}*100 = {5788280/8365936}*100 = 69% This means that the system was overall 69% was busy utilizing the CPU. BUSY_TIME can further be divided into SYS_TIME+USER_TIME. BUSY_TIME=SYS_TIME+USER_TIME
  • 3. We can also calculate % of SYS_TIME and % of USER_TIME. % SYS_TIME = (SYS_TIME/BUSY_TIME)*100 %USER_TIME = (USER_TIME/BUSY_TIME)*100 Applying the above formula in our present case, we have: %SYS_TIME = (1487507/5788280)*100 = 25.7% %USER_TIME = (4300773/5788280)*100 = 74% As we can see approx 74% of CPU was accounted for USER_TIME. But this 74% is actually 74% of %BUSY_TIME ie 69%. Therefore, 74% of 69% = 51% This is the actual USER_TIME. Similarly, for SYS_TIME 25.7% of 69%= 17.7% This is the actual SYS_TIME. Now if we see, CPU_TIME and USER_TIME differ by 51-43=8%. This means, apart from oracle processes, 8% of CPU was utilized by non oracle non system processes. It could also be that 8% of time was spent in runqueue ie waiting for CPU Once we find out High CPU usage is the issue, we need to find out where the maximum CPU time is getting used. If there is high CPU, then essentially, we will have to find where the CPU is spent, either in SQL execution or SQL Parsing. The first thing to look at is parsing because this is a CPU-intensive operation. If the database is doing lots of hard parse it means lack of cursor sharing resulting in thousands of statements spreading across shared pool which only differ with literal values. We can look for SQL statements consuming High CPU. We can look in SQL statements ordered by CPU, SQL statements ordered by Buffer gets. However, while examining sql statements our metric value should be per execution basis. Once the SQL is identified then it’s easy to tune it. A couple of caveats Analyzing CPU usage from AWR can be tricky as well. For example, if we need to calculate the CPU usage for a particular time lets say from 7:15 to 7:30, then to gather CPU information from a 60 minute report is useless. Fortunately, in 10g and above, oracle provides us with another amazing utility, the ASH which stands for active session
  • 4. history. By using ASH, we can go to any time period we want and see how much of the CPU was consumed for that time period. Conclusion AWR provides a lot of information regarding CPU utilization. But it can be tricky to get the exact details of time spent in CPU.AWR in coordination with ASH becomes power pact performance analyzer tool that put before us all the artifacts necessary to troubleshoot CPU utilization issues. What differentiates CPU TIME from other wait events is that other wait events can be measured with respect to DB TIME but CPU TIME should be measured w .r .t. the total CPU capacity of the system. References: http://docs.oracle.com/cd/B19306_01/server.102/b14211/toc.htm http://savvinov.com/2012/04/06/awr-reports-interpreting-cpu-usage/ http://dboptimizer.com/2011/07/21/oracle-cpu-time/