SlideShare a Scribd company logo
1 of 45
Frequently Misused Metrics in Oracle
Steve Karam
 Technical Manager at Delphix
 Oracle Certified Master, ACE, and other
acronyms
 Just a little social
 Blog: http://www.oraclealchemist.com
 Twitter: @OracleAlchemist
 Google Plus: +SteveKaram
 Facebook: OracleAlchemist
Hunting for Metrics
 Oracle has more metrics than you can
shake a stick at
 Automatic Workload Repository (AWR)
 Active Session History (ASH)
 STATSPACK
 V$ and X$ views
These Aren‘t the Metrics You‘re
Looking For
The problem is not a
lack of data, it‘s
knowing how—and
when—to use it.
The Database is…
 Broken
 Slow
 Down
 Not working
 Giving me errors
Step 1: What is the actual problem?
I‘m going to…
 Gather stats
 Add an index to something
 Bounce the database
 Blame the SysAdmins
 Blame the code
 Kill the backup
Step 2: Don‘t be hasty. Suppress kneejerk
reactions. They have no place in problem
analysis.
I think I know what to do!
That‘s great! Thinking is good. But if you only
think you found a solution, chances are good
that there‘s more to it.
Step 3: Don‘t immediately think in terms of
fixes. Think in terms of findings and
recommendations.
Gathering Stats
Just like the optimizer needs to gather stats for proper query
analysis, you need to gather stats for problem analysis.
Think of it like a popular TV medical drama:
 Your database is the patient. It‘s their job to be sick.
 Your end users are the concerned family and friends.
It‘s their job to be panicky.
 You are the doctor and team. It‘s your job to be brilliant.
Step 4. Be brilliant.
Problem Analysis
Okay, so ―Be Brilliant‖ isn‘t a good step. At
this point, what you really need to do is
choose a path to solving the issue at hand.
There are a few methods for doing this:
 Top down: Review events and waits at a
global level and drill down from there.
 Scientific Method: Do background
research, form a hypothesis, test your
hypothesis, analyze the outcome.
 Differential Diagnosis: shrink the
probability of various issues using the
process of elimination.
The Top Down Approach
Top down tuning is a viable
method, and is almost always
preferable to bottom up tuning.
This is very useful when you
know the issue is global and
you need to drill down into a
root cause. It‘s good when
things suddenly go wrong;
however, it can be difficult when
there are multiple root causes.
Scientific Method
This method is highly
effective at ensuring
factual resolutions to
problems. While it may
not always be suitable
for quickly resolving a
critical issue, it‘s always
suitable for case studies
and post-fix root cause
analysis.
Differential Diagnosis (DDX)
This method is great for global issues where the
root cause is unknown and no significant change
has occurred.
 Gather information
 List symptoms
 List possible conditions
based on the symptoms
 Test Test Test
 Eliminate conditions
 Don‘t kill the patient
Speaking of House
In the show ―House‖, the main character
has a saying: Everybody lies.
DBA: So everyone, what
changed?
Developer: Nothing.
SysAdmin: Nothing.
Network Admin: Nothing.
Project Manager: Nothing.
You never told us the real Step
4
Step 4 is simple.
Solve the problem.
Well sure, but how?
The methods we‘ve discussed are all well
and good for looking into problems and
figuring out how the cause and a solution.
For the most part, it will be up to you to:
 Gather the right metrics
 Synthesize your data
 Create findings and recommendations
 Test for success
What are the right metrics?
There are tons of papers and articles out
there on wait events, metrics, and other
metadata you should look for. We‘re not
here for that.
There are guides on how to use the
metrics you find. We‘re not here for that
either.
No, we‘re here to discuss…
And how we can fix that
#5: db file scattered read
What it is:
 An indication of a multiblock I/O
What it is not:
 A full table scan
 A reason to panic
 The culprit (not always, anyways)
#5: db file scattered read
The ‗db file scattered read‘ event happens
when Oracle performs a multiblock I/O;
for instance, when a full table scan occurs.
Index full scans and fast full scans also
result in multiblock I/O. But those don‘t
sound so horrible, now do they?
Why is that?
#5: db file scattered read
Over the years, DBAs and developers have
cultivated a mortal terror of full table scans. Of
course, they can be a problem, but are they
always the problem? Of course not.
Some facts about db file scattered reads:
 They are an incredibly optimal way to utilize
disk to gather large amounts of unordered
data
 They aren‘t the only indication of full scans or
multiblock I/O. direct path read and db file
parallel read events also are.
#5: db file scattered read
Before you go off on a witch hunt
because of a ‗db file scattered read‘
event, consider the following:
 Are there any indications that full
scans are actually the problem?
 Are you sure that an index read
would be more efficient in this
case?
 Do your other symptoms match
up with the conclusion that a
query performing a full table scan
is your culprit?
Full table scans
are the devil!
#4: Parse to Execute Ratio
What it is:
 An indication of how often you‘re parsing
vs. executing queries
What it is not:
 An indication of how often you‘re hard
parsing vs. executing queries
#4: Parse to Execute Ratio
Based on this formula:
round(100*(1-:parse/:execute),2)
If you hard parse a query and then
execute it, your Execute to Parse % is 0.
If you soft parse a query and then execute
it, your Execute to Parse % is 0.
#4: Parse to Execute Ratio
What about all those articles and forum
posts that say adding bind variables will
improve your Execute to Parse %?
They‘re not wrong, but incomplete. Adding
bind variables will improve your Execute
to Parse %... IF you have some form of
statement caching enabled.
#4: Parse to Execute Ratio
 Hard Parses can take up valuable CPU cycles
 Soft Parses can still cripple your Oracle
instance
 The best way to reduce library cache
contention is to not touch it at all!
#4: Parse to Execute Ratio
Tom Kyte said it best:
there are three types of parses (well, maybe four) in Oracle...
 there is the dreaded hard parse - they are VERY VERY
VERY bad.
 there is the hurtful soft parse - they are VERY VERY very
bad.
 there is the hated softer soft parse you might be able to
achieve with session cached cursors - they are VERY very
very bad.
 then there is the absence of a parse, no parse, silence. This
is golden, this is perfect, this is the goal.
“
#4: Parse to Execute Ratio
 To see hard parses vs. soft parses, check
out the Parse Count (total) and Parse
Count (hard) in an AWR report or V$ views
 To reduce parsing as a whole (the actual
goal), make sure the code does not
explicitly parse per execution OR that the
client software has statement caching
enabled.
 For example, in JBoss, you can set the
prepared-statement-cache-size parameter
 SESSION_CACHED_CURSORS is not the
same thing!
#3: Buffer Hit Ratio
What it is:
 Another ratio
 A proportional view of LIOs to PIOs
What it is not:
 A silver bullet
 A magic ratio
 A valuable performance indicator
#3: Buffer Hit Ratio
Wait, buffer hit ratio isn‘t valuable?
Okay, maybe that was a little heavy
handed. It can be valuable as an ―at-a-
glance‖ metric to see if something is
absolutely abysmal.
#3: Buffer Hit Ratio
It is important to remember
that a high buffer hit ratio
doesn‘t necessarily mean
the data you needed was
available in cache when it
was needed. It also doesn‘t
mean the queries you‘re
running are optimal…they
just happen to be getting
their data from cache.
100% of crap in RAM is still
crap. It‘s just logical crap.
#3: Buffer Hit Ratio
So what is it good for?
 If you know your queries are perfect
(lolright) then it can indicate that you
don‘t have enough RAM allocated to
your buffer cache.
 That‘s it, I just have a second bullet here
to keep the other one company.
#2: CPU %
What it is:
 CPU Usage per CPU
What it is not:
 Equivalent to your laptop‘s CPU %
 A viable measure of CPU usage (alone)
 A way to diagnose performance
#2: CPU %
This isn‘t your Windows
laptop.
When your PC shows 99%
or 100% CPU usage, you
panic. That‘s because you
only have one CPU
(usually), and 99% means
you can barely drag a
window from one side of
the screen to the other.
#2: CPU %
In the multi-processor world, it‘s not as big of
a problem. In fact, it can be a huge benefit.
 You have multiple CPUs on your servers.
99% usage of one or more is probably not
a big deal.
 CPU is the processor, and the part of the
system that performs work (as opposed to
wait). You want this to be heavily utilized.
#2: CPU %
What do you pay licensing
based on?
Number of CPUs.
So what do you actually
want to be as fully utilized
as possible?
#2: CPU %
Instead, we should be looking at:
 Runqueue length – Provided by
vmstat, uptime, top, and other tools.
Shows the number of processes
actively waiting or working on CPU
at any given time.
 Oracle Average Active Sessions –
This metric is usually more pertinent
from the DBA side, as it shows the
number of sessions actively waiting
or working at any given time.
#2: CPU %
 The focus should be on concurrency
 Using a single CPU heavily is only a
problem if the other CPUs are fairly
dormant…but that‘s another issue
entirely.
 Even run queue is not a perfect metric—
some things, like uninterruptable I/O
wait, can skew the results.
 I/O wait should be part of the bigger picture
along with run queue length.
#1: Cost
What it is:
 A numerical estimation proportional to
the expected resources necessary to
execute a statement with a given plan.
What it is not:
 Anything else.
#1: Cost
This one comes up
all. the. time.
Here‘s a simple thing
to keep in mind:
 Oracle‘s optimizer
is cost based
 Your tuning
practices are not
#1: Cost
 Cost is good to understand, so you can
understand why Oracle chose the plan it
did.
 However, you shouldn‘t try to tune
specifically to reduce cost.
 Cost is not proportional to time. A high or
low cost doesn‘t necessarily mean a
query will be slower or faster.
#1: Cost
Why is cost misused?
 ―Gather stats‖ is like the
―restart Windows‖ of the
Oracle world. Gathering
stats changes plans.
Plans have costs. I
should tune costs.
 The cost based
optimizer changed my
plan. It‘s cost based. I‘m
cost based.
#1: Cost
 Cost is not a bottleneck, nor is it
indicative of actual work. It‘s indicative of
relative work based on parameters that
exist purely in the calculations of your
particular Oracle instance.
 Instead of tuning to reduce cost, tune to
reduce bottlenecks. Those are real
things that cause real wait.
#1: Cost
 Real things to tune
 Reduce block touches (both physical and
logical) by improving your query selectivity,
join order, index usage, etc.
 Reduce parses, both hard and soft.
 Investigate execution plans and use
statistics, hints, or other methods to improve
Oracle‘s costing—just don‘t try to ‗tune down
cost‘ directly.
Step 4…
Step 4, if you remember, was ―solve the
problem.‖
That advice still stands.
But make sure you use
the right metrics to do it.
And good luck!
Q&A
?

More Related Content

What's hot

LKNA 2014 Risk and Impediment Analysis and Analytics - Troy Magennis
LKNA 2014 Risk and Impediment Analysis and Analytics - Troy MagennisLKNA 2014 Risk and Impediment Analysis and Analytics - Troy Magennis
LKNA 2014 Risk and Impediment Analysis and Analytics - Troy MagennisTroy Magennis
 
More Aim, Less Blame: How to use postmortems to turn failures into something ...
More Aim, Less Blame: How to use postmortems to turn failures into something ...More Aim, Less Blame: How to use postmortems to turn failures into something ...
More Aim, Less Blame: How to use postmortems to turn failures into something ...Daniel Kanchev
 
Prevalence Of Spreadsheet Errors
Prevalence Of Spreadsheet ErrorsPrevalence Of Spreadsheet Errors
Prevalence Of Spreadsheet Errorshetupatel
 
Root Cause Analysis
Root  Cause  AnalysisRoot  Cause  Analysis
Root Cause Analysispuspaltamuli
 
Fishbone and 5 Why webinar 02 11-21
Fishbone and 5 Why webinar 02 11-21Fishbone and 5 Why webinar 02 11-21
Fishbone and 5 Why webinar 02 11-21Darren Dolcemascolo
 
Probabilistic Programming: Why, What, How, When?
Probabilistic Programming: Why, What, How, When?Probabilistic Programming: Why, What, How, When?
Probabilistic Programming: Why, What, How, When?Salesforce Engineering
 

What's hot (6)

LKNA 2014 Risk and Impediment Analysis and Analytics - Troy Magennis
LKNA 2014 Risk and Impediment Analysis and Analytics - Troy MagennisLKNA 2014 Risk and Impediment Analysis and Analytics - Troy Magennis
LKNA 2014 Risk and Impediment Analysis and Analytics - Troy Magennis
 
More Aim, Less Blame: How to use postmortems to turn failures into something ...
More Aim, Less Blame: How to use postmortems to turn failures into something ...More Aim, Less Blame: How to use postmortems to turn failures into something ...
More Aim, Less Blame: How to use postmortems to turn failures into something ...
 
Prevalence Of Spreadsheet Errors
Prevalence Of Spreadsheet ErrorsPrevalence Of Spreadsheet Errors
Prevalence Of Spreadsheet Errors
 
Root Cause Analysis
Root  Cause  AnalysisRoot  Cause  Analysis
Root Cause Analysis
 
Fishbone and 5 Why webinar 02 11-21
Fishbone and 5 Why webinar 02 11-21Fishbone and 5 Why webinar 02 11-21
Fishbone and 5 Why webinar 02 11-21
 
Probabilistic Programming: Why, What, How, When?
Probabilistic Programming: Why, What, How, When?Probabilistic Programming: Why, What, How, When?
Probabilistic Programming: Why, What, How, When?
 

Similar to Metric Abuse: Frequently Misused Metrics in Oracle

Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)Revelation Technologies
 
scale_perf_best_practices
scale_perf_best_practicesscale_perf_best_practices
scale_perf_best_practiceswebuploader
 
data science chapter-4,5,6
data science chapter-4,5,6data science chapter-4,5,6
data science chapter-4,5,6varshakumar21
 
My Article on MySQL Magazine
My Article on MySQL MagazineMy Article on MySQL Magazine
My Article on MySQL MagazineJonathan Levin
 
White Paper, How to improve your Oracle career
White Paper, How to improve your Oracle careerWhite Paper, How to improve your Oracle career
White Paper, How to improve your Oracle careerFrancisco Alvarez
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzQA or the Highway
 
The Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig StuntzThe Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig StuntzQA or the Highway
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flexmichael.labriola
 
Prometheus - Open Source Forum Japan
Prometheus  - Open Source Forum JapanPrometheus  - Open Source Forum Japan
Prometheus - Open Source Forum JapanBrian Brazil
 
The "Evils" of Optimization
The "Evils" of OptimizationThe "Evils" of Optimization
The "Evils" of OptimizationBlackRabbitCoder
 
The View - 30 proven Lotuscript tips
The View - 30 proven Lotuscript tipsThe View - 30 proven Lotuscript tips
The View - 30 proven Lotuscript tipsBill Buchan
 
Top 30 Scalability Mistakes
Top 30 Scalability MistakesTop 30 Scalability Mistakes
Top 30 Scalability MistakesJohn Coggeshall
 
How to Monitoring the SRE Golden Signals (E-Book)
How to Monitoring the SRE Golden Signals (E-Book)How to Monitoring the SRE Golden Signals (E-Book)
How to Monitoring the SRE Golden Signals (E-Book)Siglos
 
Put Some SRE in Your Shipped Software
Put Some SRE in Your Shipped SoftwarePut Some SRE in Your Shipped Software
Put Some SRE in Your Shipped SoftwareTheo Schlossnagle
 

Similar to Metric Abuse: Frequently Misused Metrics in Oracle (20)

DBA Best Practices.ppt
DBA Best Practices.pptDBA Best Practices.ppt
DBA Best Practices.ppt
 
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
 
scale_perf_best_practices
scale_perf_best_practicesscale_perf_best_practices
scale_perf_best_practices
 
35 dbatune3
35 dbatune335 dbatune3
35 dbatune3
 
data science chapter-4,5,6
data science chapter-4,5,6data science chapter-4,5,6
data science chapter-4,5,6
 
My Article on MySQL Magazine
My Article on MySQL MagazineMy Article on MySQL Magazine
My Article on MySQL Magazine
 
Let's get along
Let's get alongLet's get along
Let's get along
 
Data science unit2
Data science unit2Data science unit2
Data science unit2
 
White Paper, How to improve your Oracle career
White Paper, How to improve your Oracle careerWhite Paper, How to improve your Oracle career
White Paper, How to improve your Oracle career
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig Stuntz
 
The Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig StuntzThe Limits of Unit Testing by Craig Stuntz
The Limits of Unit Testing by Craig Stuntz
 
Performance Tuning with XHProf
Performance Tuning with XHProfPerformance Tuning with XHProf
Performance Tuning with XHProf
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
Prometheus - Open Source Forum Japan
Prometheus  - Open Source Forum JapanPrometheus  - Open Source Forum Japan
Prometheus - Open Source Forum Japan
 
Dev ops
Dev opsDev ops
Dev ops
 
The "Evils" of Optimization
The "Evils" of OptimizationThe "Evils" of Optimization
The "Evils" of Optimization
 
The View - 30 proven Lotuscript tips
The View - 30 proven Lotuscript tipsThe View - 30 proven Lotuscript tips
The View - 30 proven Lotuscript tips
 
Top 30 Scalability Mistakes
Top 30 Scalability MistakesTop 30 Scalability Mistakes
Top 30 Scalability Mistakes
 
How to Monitoring the SRE Golden Signals (E-Book)
How to Monitoring the SRE Golden Signals (E-Book)How to Monitoring the SRE Golden Signals (E-Book)
How to Monitoring the SRE Golden Signals (E-Book)
 
Put Some SRE in Your Shipped Software
Put Some SRE in Your Shipped SoftwarePut Some SRE in Your Shipped Software
Put Some SRE in Your Shipped Software
 

Recently uploaded

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Metric Abuse: Frequently Misused Metrics in Oracle

  • 2. Steve Karam  Technical Manager at Delphix  Oracle Certified Master, ACE, and other acronyms  Just a little social  Blog: http://www.oraclealchemist.com  Twitter: @OracleAlchemist  Google Plus: +SteveKaram  Facebook: OracleAlchemist
  • 3. Hunting for Metrics  Oracle has more metrics than you can shake a stick at  Automatic Workload Repository (AWR)  Active Session History (ASH)  STATSPACK  V$ and X$ views
  • 4. These Aren‘t the Metrics You‘re Looking For The problem is not a lack of data, it‘s knowing how—and when—to use it.
  • 5. The Database is…  Broken  Slow  Down  Not working  Giving me errors Step 1: What is the actual problem?
  • 6. I‘m going to…  Gather stats  Add an index to something  Bounce the database  Blame the SysAdmins  Blame the code  Kill the backup Step 2: Don‘t be hasty. Suppress kneejerk reactions. They have no place in problem analysis.
  • 7. I think I know what to do! That‘s great! Thinking is good. But if you only think you found a solution, chances are good that there‘s more to it. Step 3: Don‘t immediately think in terms of fixes. Think in terms of findings and recommendations.
  • 8. Gathering Stats Just like the optimizer needs to gather stats for proper query analysis, you need to gather stats for problem analysis. Think of it like a popular TV medical drama:  Your database is the patient. It‘s their job to be sick.  Your end users are the concerned family and friends. It‘s their job to be panicky.  You are the doctor and team. It‘s your job to be brilliant. Step 4. Be brilliant.
  • 9. Problem Analysis Okay, so ―Be Brilliant‖ isn‘t a good step. At this point, what you really need to do is choose a path to solving the issue at hand. There are a few methods for doing this:  Top down: Review events and waits at a global level and drill down from there.  Scientific Method: Do background research, form a hypothesis, test your hypothesis, analyze the outcome.  Differential Diagnosis: shrink the probability of various issues using the process of elimination.
  • 10. The Top Down Approach Top down tuning is a viable method, and is almost always preferable to bottom up tuning. This is very useful when you know the issue is global and you need to drill down into a root cause. It‘s good when things suddenly go wrong; however, it can be difficult when there are multiple root causes.
  • 11. Scientific Method This method is highly effective at ensuring factual resolutions to problems. While it may not always be suitable for quickly resolving a critical issue, it‘s always suitable for case studies and post-fix root cause analysis.
  • 12. Differential Diagnosis (DDX) This method is great for global issues where the root cause is unknown and no significant change has occurred.  Gather information  List symptoms  List possible conditions based on the symptoms  Test Test Test  Eliminate conditions  Don‘t kill the patient
  • 13. Speaking of House In the show ―House‖, the main character has a saying: Everybody lies. DBA: So everyone, what changed? Developer: Nothing. SysAdmin: Nothing. Network Admin: Nothing. Project Manager: Nothing.
  • 14. You never told us the real Step 4 Step 4 is simple. Solve the problem.
  • 15. Well sure, but how? The methods we‘ve discussed are all well and good for looking into problems and figuring out how the cause and a solution. For the most part, it will be up to you to:  Gather the right metrics  Synthesize your data  Create findings and recommendations  Test for success
  • 16. What are the right metrics? There are tons of papers and articles out there on wait events, metrics, and other metadata you should look for. We‘re not here for that. There are guides on how to use the metrics you find. We‘re not here for that either. No, we‘re here to discuss…
  • 17. And how we can fix that
  • 18. #5: db file scattered read What it is:  An indication of a multiblock I/O What it is not:  A full table scan  A reason to panic  The culprit (not always, anyways)
  • 19. #5: db file scattered read The ‗db file scattered read‘ event happens when Oracle performs a multiblock I/O; for instance, when a full table scan occurs. Index full scans and fast full scans also result in multiblock I/O. But those don‘t sound so horrible, now do they? Why is that?
  • 20. #5: db file scattered read Over the years, DBAs and developers have cultivated a mortal terror of full table scans. Of course, they can be a problem, but are they always the problem? Of course not. Some facts about db file scattered reads:  They are an incredibly optimal way to utilize disk to gather large amounts of unordered data  They aren‘t the only indication of full scans or multiblock I/O. direct path read and db file parallel read events also are.
  • 21. #5: db file scattered read Before you go off on a witch hunt because of a ‗db file scattered read‘ event, consider the following:  Are there any indications that full scans are actually the problem?  Are you sure that an index read would be more efficient in this case?  Do your other symptoms match up with the conclusion that a query performing a full table scan is your culprit? Full table scans are the devil!
  • 22. #4: Parse to Execute Ratio What it is:  An indication of how often you‘re parsing vs. executing queries What it is not:  An indication of how often you‘re hard parsing vs. executing queries
  • 23. #4: Parse to Execute Ratio Based on this formula: round(100*(1-:parse/:execute),2) If you hard parse a query and then execute it, your Execute to Parse % is 0. If you soft parse a query and then execute it, your Execute to Parse % is 0.
  • 24. #4: Parse to Execute Ratio What about all those articles and forum posts that say adding bind variables will improve your Execute to Parse %? They‘re not wrong, but incomplete. Adding bind variables will improve your Execute to Parse %... IF you have some form of statement caching enabled.
  • 25. #4: Parse to Execute Ratio  Hard Parses can take up valuable CPU cycles  Soft Parses can still cripple your Oracle instance  The best way to reduce library cache contention is to not touch it at all!
  • 26. #4: Parse to Execute Ratio Tom Kyte said it best: there are three types of parses (well, maybe four) in Oracle...  there is the dreaded hard parse - they are VERY VERY VERY bad.  there is the hurtful soft parse - they are VERY VERY very bad.  there is the hated softer soft parse you might be able to achieve with session cached cursors - they are VERY very very bad.  then there is the absence of a parse, no parse, silence. This is golden, this is perfect, this is the goal. “
  • 27. #4: Parse to Execute Ratio  To see hard parses vs. soft parses, check out the Parse Count (total) and Parse Count (hard) in an AWR report or V$ views  To reduce parsing as a whole (the actual goal), make sure the code does not explicitly parse per execution OR that the client software has statement caching enabled.  For example, in JBoss, you can set the prepared-statement-cache-size parameter  SESSION_CACHED_CURSORS is not the same thing!
  • 28. #3: Buffer Hit Ratio What it is:  Another ratio  A proportional view of LIOs to PIOs What it is not:  A silver bullet  A magic ratio  A valuable performance indicator
  • 29. #3: Buffer Hit Ratio Wait, buffer hit ratio isn‘t valuable? Okay, maybe that was a little heavy handed. It can be valuable as an ―at-a- glance‖ metric to see if something is absolutely abysmal.
  • 30. #3: Buffer Hit Ratio It is important to remember that a high buffer hit ratio doesn‘t necessarily mean the data you needed was available in cache when it was needed. It also doesn‘t mean the queries you‘re running are optimal…they just happen to be getting their data from cache. 100% of crap in RAM is still crap. It‘s just logical crap.
  • 31. #3: Buffer Hit Ratio So what is it good for?  If you know your queries are perfect (lolright) then it can indicate that you don‘t have enough RAM allocated to your buffer cache.  That‘s it, I just have a second bullet here to keep the other one company.
  • 32. #2: CPU % What it is:  CPU Usage per CPU What it is not:  Equivalent to your laptop‘s CPU %  A viable measure of CPU usage (alone)  A way to diagnose performance
  • 33. #2: CPU % This isn‘t your Windows laptop. When your PC shows 99% or 100% CPU usage, you panic. That‘s because you only have one CPU (usually), and 99% means you can barely drag a window from one side of the screen to the other.
  • 34. #2: CPU % In the multi-processor world, it‘s not as big of a problem. In fact, it can be a huge benefit.  You have multiple CPUs on your servers. 99% usage of one or more is probably not a big deal.  CPU is the processor, and the part of the system that performs work (as opposed to wait). You want this to be heavily utilized.
  • 35. #2: CPU % What do you pay licensing based on? Number of CPUs. So what do you actually want to be as fully utilized as possible?
  • 36. #2: CPU % Instead, we should be looking at:  Runqueue length – Provided by vmstat, uptime, top, and other tools. Shows the number of processes actively waiting or working on CPU at any given time.  Oracle Average Active Sessions – This metric is usually more pertinent from the DBA side, as it shows the number of sessions actively waiting or working at any given time.
  • 37. #2: CPU %  The focus should be on concurrency  Using a single CPU heavily is only a problem if the other CPUs are fairly dormant…but that‘s another issue entirely.  Even run queue is not a perfect metric— some things, like uninterruptable I/O wait, can skew the results.  I/O wait should be part of the bigger picture along with run queue length.
  • 38. #1: Cost What it is:  A numerical estimation proportional to the expected resources necessary to execute a statement with a given plan. What it is not:  Anything else.
  • 39. #1: Cost This one comes up all. the. time. Here‘s a simple thing to keep in mind:  Oracle‘s optimizer is cost based  Your tuning practices are not
  • 40. #1: Cost  Cost is good to understand, so you can understand why Oracle chose the plan it did.  However, you shouldn‘t try to tune specifically to reduce cost.  Cost is not proportional to time. A high or low cost doesn‘t necessarily mean a query will be slower or faster.
  • 41. #1: Cost Why is cost misused?  ―Gather stats‖ is like the ―restart Windows‖ of the Oracle world. Gathering stats changes plans. Plans have costs. I should tune costs.  The cost based optimizer changed my plan. It‘s cost based. I‘m cost based.
  • 42. #1: Cost  Cost is not a bottleneck, nor is it indicative of actual work. It‘s indicative of relative work based on parameters that exist purely in the calculations of your particular Oracle instance.  Instead of tuning to reduce cost, tune to reduce bottlenecks. Those are real things that cause real wait.
  • 43. #1: Cost  Real things to tune  Reduce block touches (both physical and logical) by improving your query selectivity, join order, index usage, etc.  Reduce parses, both hard and soft.  Investigate execution plans and use statistics, hints, or other methods to improve Oracle‘s costing—just don‘t try to ‗tune down cost‘ directly.
  • 44. Step 4… Step 4, if you remember, was ―solve the problem.‖ That advice still stands. But make sure you use the right metrics to do it. And good luck!
  • 45. Q&A ?