SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
ASH Outliers: 
Detecting Unusual Events in Active Session History 
John Beresniewicz, Oracle USA
Agenda 
• ASH Fundamentals 
• Wait Events and ASH 
• Event Histograms 
• Event Significance Levels 
• SQL to Find Outliers in ASH 
• Handling the GV$ problem
Motivating Use Case 
• Unusually long wait events (outliers) suspected to 
trigger cascade-effect performance incidents 
! 
• RAC performance experts claim EM Top Activity not 
helpful as aggregation masks outlier events 
! 
• Can we see if ASH has sampled any such events? 
• If none observed does not mean they have not happened 
• However ASH sampling is biased to longer events
ASH Fundamentals
ASH and DB Time
ASH Fact Table Dimensions
ASH Math 
• COUNT(*) = DB TIME (secs) 
• Basic in-memory (V$ASH) formula 
! 
• The Kurtz Construct is nice 
• SUM(1) = DB Time (secs) for in-memory 
• SUM(10) = DB TIME (secs) for on-disk 
! 
• DB Time Method analysis: 
• Dimensional GROUP BY over COUNT(*)
Good ASH Math: ASH Analytics
Group by Wait Event within Wait Class
Add SQL_ID Grouping Dimension
Bad ASH Math 
• SQL observed using 9 secs of CPU every 10 secs
Wait Events and ASH 
• ASH samples actively waiting sessions 
• Wait time is unknown at sample time 
• The “fix up” writes actual wait time into TIME_WAITED 
! 
• ASH is a biased sampler of wait events 
• Longer events have higher probability of being sampled 
! 
• Avoid the temptation of TIME_WAITED 
• AVG(time_waited) DOES NOT estimate avg wait times 
• MIN and MAX do not work either 
• Except when MAX exceeds 1-second
The ASH “fix up” 
• ASH columns may be unknown at sampling time 
• TIME_WAITED: session is still waiting 
• PLAN_HASH: session is still optimizing SQL 
• GC events: event details unknown at event initiation 
• Certain time model bit vector columns 
! 
• ASH “fixes up” missing data during subsequent 
sample processing 
• TIME_WAITED fixed up in last event sample 
! 
• Querying current ASH may return un-fixed rows 
• Should not be a problem generally
ON CPU and ASH 
• ASH row status “ON CPU” derived, not observed 
• Session is in a database call 
• Session is NOT in a wait event (idle or non-idle) 
! 
• Un-instrumented waits => “ON CPU” 
• These are bugs and should be rare, but have happened 
! 
• Session on run queue may be WAITING or ON CPU 
• Depends on state prior to going onto run queue
V$EVENT_HISTOGRAM 
• Histogram buckets of event wait times 
! 
• Captures statistical distribution of wait times 
! 
• All events since instance startup counted in some 
bucket 
! 
• Exponential time bucketing scheme captures long-tail 
distributions efficiently
V$EVENT_HISTOGRAM 
SQL> desc v$event_histogram 
Name Type 
---------------------------- ---------------------------- 
EVENT# NUMBER 
EVENT VARCHAR2(64) 
WAIT_TIME_MILLI NUMBER 
WAIT_COUNT NUMBER 
LAST_UPDATE_TIME VARCHAR2(64)
Event Histogram Time Buckets 
SQL> select distinct 
wait_time_milli 
,log(2,wait_time_milli) 
from 
v$event_histogram 
order by 1; 
WAIT_TIME_MILLI LOG(2,WAIT_TIME_MILLI) 
--------------- ---------------------- 
1 0 
2 1 
4 2 
8 3 
16 4 
32 5 
64 6 
128 7 
256 8 
512 9 
1024 10
I/O Event Histogram
Latch Wait Event Histogram
Histogram Math 
• Histograms capture probability distribution of 
TIME_WAITED by event over this startup cycle 
Σ 
Σ 
WaitCount 
Pr(time _ waited bucket ) 
< = < 
allbuckets 
bucket N 
N WaitCount
Significance of Histogram Buckets 
# 
! ! ! 
" 
& 
$ $ $ % 
bucket >= 
N 
Σ 
WaitCount 
Significance 1 
= − Σ 
bucketN WaitCount 
allbuckets 
• Measures the cumulative distribution function of 
TIME_WAITED probabilities represented by the 
histograms (per bucket) 
! 
• Every event in the bucket has at least this significance
Defining “Outlier Events” 
• Events with low probability of occurrence 
! 
• Events with high significance value 
! 
• Q: Has ASH sampled any such events?
“Outlier” = “Unusual”
Finding Outlier Events in ASH 
• Which ASH rows (if any) represent wait events with 
significantly long TIME_WAITED against the event 
histogram record? 
! 
• Two step process: 
! 
1. Compute event histogram bucket significance 
2. Join ASH to histograms and filter by significance
Step 1: Compute Bucket Significance 
WITH EH$stats 
as 
(select 
EH.* 
,ROUND(1 - (tot_count - bucket_tot_count + wait_count) / tot_count,6) 
as event_bucket_siglevel 
from 
(select event# 
,event 
,wait_time_milli 
,wait_count 
,ROUND(LOG(2,wait_time_milli)) as event_bucket 
,SUM(wait_count) OVER (PARTITION BY event#) as tot_count 
,SUM(wait_count) OVER (PARTITION BY event# ORDER BY wait_time_milli 
RANGE UNBOUNDED PRECEDING) 
as bucket_tot_count 
from v$event_histogram 
) EH 
)
Step 2: Join ASH to Buckets and Filter 
select 
EH.event_bucket 
,ASH.sample_id 
,ASH.session_id 
,EH.event_bucket_siglevel as bucket_siglevel 
,ASH.event 
,ASH.time_waited/1000 ASH_time_waited_milli 
,ASH.sql_id 
from 
EH$stats EH 
,v$active_session_history ASH 
where 
EH.event# = ASH.event# 
and EH.event_bucket_siglevel > &siglevel 
and EH.event_bucket = CASE ASH.time_waited 
WHEN 0 THEN null 
ELSE TRUNC(LOG(2,ASH.time_waited/1000))+1 
END 
order by 
sample_id, event, session_id 
;
DEMO?
The GV$ Problem 
• Motivating use case is for RAC 
! 
• Execute V$ query on all instances? 
• Too much effort 
! 
• Convert V$ query to GV$ query? 
• GV$ remote joins not optimized 
• QC will pull V$ASH and V$EVENT_HISTOGRAM and join locally 
! 
• Neither of these “solutions” is acceptable
GV$ Table Function 
• Table function distributes V$ cursor across RAC 
nodes and marshals result sets 
! 
• Perfect solution for this use case 
SELECT … FROM TABLE GV$( (CURSOR( SELECT FROM V$)))
DEMO?
Comments and Caveats 
• Highly significant events may not be sampled 
! 
• Works best for long-tailed distributions 
• Bi-modal, single-bucket, timeout events not well-behaved 
! 
• Exponential bucket sizing gets coarse quickly 
• Significance levels increase in big jumps 
• Important distinctions may hide inside large buckets 
! 
• An interesting and unusual application of ASH where 
TIME_WAITED is the key 
• Does it help with the motivating use case?
Ash Outliers UKOUG2011

Contenu connexe

Tendances

Awr + 12c performance tuning
Awr + 12c performance tuningAwr + 12c performance tuning
Awr + 12c performance tuningAiougVizagChapter
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWRpasalapudi
 
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
 
VirtaThon 2011 - Mining the AWR
VirtaThon 2011 - Mining the AWRVirtaThon 2011 - Mining the AWR
VirtaThon 2011 - Mining the AWRKristofferson A
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015Yury Velikanov
 
Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014John Beresniewicz
 
Advanced tips for making Oracle databases faster
Advanced tips for making Oracle databases fasterAdvanced tips for making Oracle databases faster
Advanced tips for making Oracle databases fasterSolarWinds
 
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
 
Whitepaper: Mining the AWR repository for Capacity Planning and Visualization
Whitepaper: Mining the AWR repository for Capacity Planning and VisualizationWhitepaper: Mining the AWR repository for Capacity Planning and Visualization
Whitepaper: Mining the AWR repository for Capacity Planning and VisualizationKristofferson A
 
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And WhatPerformance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And Whatudaymoogala
 
Whitepaper: Where did my CPU go?
Whitepaper: Where did my CPU go?Whitepaper: Where did my CPU go?
Whitepaper: Where did my CPU go?Kristofferson A
 
Earl Shaffer Oracle Performance Tuning pre12c 11g AWR uses
Earl Shaffer Oracle Performance Tuning pre12c 11g AWR usesEarl Shaffer Oracle Performance Tuning pre12c 11g AWR uses
Earl Shaffer Oracle Performance Tuning pre12c 11g AWR usesoramanc
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsfMao Geng
 
OOW Unconference 2010: Mining the AWR repository for Capacity Planning, Visua...
OOW Unconference 2010: Mining the AWR repository for Capacity Planning, Visua...OOW Unconference 2010: Mining the AWR repository for Capacity Planning, Visua...
OOW Unconference 2010: Mining the AWR repository for Capacity Planning, Visua...Kristofferson A
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuningGuy Harrison
 
Oracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptOracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptChien Chung Shen
 
Oracle Database : Addressing a performance issue the drilldown approach
Oracle Database : Addressing a performance issue the drilldown approachOracle Database : Addressing a performance issue the drilldown approach
Oracle Database : Addressing a performance issue the drilldown approachLaurent Leturgez
 
Think Exa!
Think Exa!Think Exa!
Think Exa!Enkitec
 

Tendances (20)

Awr + 12c performance tuning
Awr + 12c performance tuningAwr + 12c performance tuning
Awr + 12c performance tuning
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
 
AWR reports-Measuring CPU
AWR reports-Measuring CPUAWR reports-Measuring CPU
AWR reports-Measuring CPU
 
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
 
Ash and awr deep dive hotsos
Ash and awr deep dive hotsosAsh and awr deep dive hotsos
Ash and awr deep dive hotsos
 
VirtaThon 2011 - Mining the AWR
VirtaThon 2011 - Mining the AWRVirtaThon 2011 - Mining the AWR
VirtaThon 2011 - Mining the AWR
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015
 
Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014
 
Advanced tips for making Oracle databases faster
Advanced tips for making Oracle databases fasterAdvanced tips for making Oracle databases faster
Advanced tips for making Oracle databases faster
 
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, ...
 
Whitepaper: Mining the AWR repository for Capacity Planning and Visualization
Whitepaper: Mining the AWR repository for Capacity Planning and VisualizationWhitepaper: Mining the AWR repository for Capacity Planning and Visualization
Whitepaper: Mining the AWR repository for Capacity Planning and Visualization
 
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And WhatPerformance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
 
Whitepaper: Where did my CPU go?
Whitepaper: Where did my CPU go?Whitepaper: Where did my CPU go?
Whitepaper: Where did my CPU go?
 
Earl Shaffer Oracle Performance Tuning pre12c 11g AWR uses
Earl Shaffer Oracle Performance Tuning pre12c 11g AWR usesEarl Shaffer Oracle Performance Tuning pre12c 11g AWR uses
Earl Shaffer Oracle Performance Tuning pre12c 11g AWR uses
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
 
OOW Unconference 2010: Mining the AWR repository for Capacity Planning, Visua...
OOW Unconference 2010: Mining the AWR repository for Capacity Planning, Visua...OOW Unconference 2010: Mining the AWR repository for Capacity Planning, Visua...
OOW Unconference 2010: Mining the AWR repository for Capacity Planning, Visua...
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
 
Oracle Database Performance Tuning Concept
Oracle Database Performance Tuning ConceptOracle Database Performance Tuning Concept
Oracle Database Performance Tuning Concept
 
Oracle Database : Addressing a performance issue the drilldown approach
Oracle Database : Addressing a performance issue the drilldown approachOracle Database : Addressing a performance issue the drilldown approach
Oracle Database : Addressing a performance issue the drilldown approach
 
Think Exa!
Think Exa!Think Exa!
Think Exa!
 

Similaire à Ash Outliers UKOUG2011

ASH Archit ecture and Advanced Usage.pdf
ASH Archit ecture and Advanced Usage.pdfASH Archit ecture and Advanced Usage.pdf
ASH Archit ecture and Advanced Usage.pdftricantino1973
 
200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DB200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DBcookie1969
 
SQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoSQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoMauro Pagano
 
active_session_history_oracle_performance.ppt
active_session_history_oracle_performance.pptactive_session_history_oracle_performance.ppt
active_session_history_oracle_performance.pptcookie1969
 
OTN tour 2015 AWR data mining
OTN tour 2015 AWR data miningOTN tour 2015 AWR data mining
OTN tour 2015 AWR data miningAndrejs Vorobjovs
 
Azure stream analytics by Nico Jacobs
Azure stream analytics by Nico JacobsAzure stream analytics by Nico Jacobs
Azure stream analytics by Nico JacobsITProceed
 
Empower my sql server administration with 5.7 instruments
Empower my sql server administration with 5.7 instrumentsEmpower my sql server administration with 5.7 instruments
Empower my sql server administration with 5.7 instrumentsMarco Tusa
 
Deep Dive: Amazon Redshift (March 2017)
Deep Dive: Amazon Redshift (March 2017)Deep Dive: Amazon Redshift (March 2017)
Deep Dive: Amazon Redshift (March 2017)Julien SIMON
 
Deep Dive Redshift, with a focus on performance
Deep Dive Redshift, with a focus on performanceDeep Dive Redshift, with a focus on performance
Deep Dive Redshift, with a focus on performanceAmazon Web Services
 
IMCSummit 2015 - Day 2 Developer Track - A Reference Architecture for the Int...
IMCSummit 2015 - Day 2 Developer Track - A Reference Architecture for the Int...IMCSummit 2015 - Day 2 Developer Track - A Reference Architecture for the Int...
IMCSummit 2015 - Day 2 Developer Track - A Reference Architecture for the Int...In-Memory Computing Summit
 
What are you waiting for? (#SQLSat211)
What are you waiting for? (#SQLSat211)What are you waiting for? (#SQLSat211)
What are you waiting for? (#SQLSat211)Jason Strate
 
Reference architecture for Internet of Things
Reference architecture for Internet of ThingsReference architecture for Internet of Things
Reference architecture for Internet of ThingsSujee Maniyam
 
Reference architecture for Internet Of Things
Reference architecture for Internet Of ThingsReference architecture for Internet Of Things
Reference architecture for Internet Of Thingselephantscale
 
ASH and AWR Performance Data by Kellyn Pot'Vin
ASH and AWR Performance Data by Kellyn Pot'VinASH and AWR Performance Data by Kellyn Pot'Vin
ASH and AWR Performance Data by Kellyn Pot'VinEnkitec
 
A gentle introduction into AKKA and the actor model
A gentle introduction into AKKA and the actor modelA gentle introduction into AKKA and the actor model
A gentle introduction into AKKA and the actor modelMykhailo Kotsur
 

Similaire à Ash Outliers UKOUG2011 (20)

ASH Archit ecture and Advanced Usage.pdf
ASH Archit ecture and Advanced Usage.pdfASH Archit ecture and Advanced Usage.pdf
ASH Archit ecture and Advanced Usage.pdf
 
200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DB200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DB
 
ASH and AWR on DB12c
ASH and AWR on DB12cASH and AWR on DB12c
ASH and AWR on DB12c
 
SQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoSQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tango
 
active_session_history_oracle_performance.ppt
active_session_history_oracle_performance.pptactive_session_history_oracle_performance.ppt
active_session_history_oracle_performance.ppt
 
Rmoug ashmaster
Rmoug ashmasterRmoug ashmaster
Rmoug ashmaster
 
OTN tour 2015 AWR data mining
OTN tour 2015 AWR data miningOTN tour 2015 AWR data mining
OTN tour 2015 AWR data mining
 
Ash and awr performance data2
Ash and awr performance data2Ash and awr performance data2
Ash and awr performance data2
 
Azure stream analytics by Nico Jacobs
Azure stream analytics by Nico JacobsAzure stream analytics by Nico Jacobs
Azure stream analytics by Nico Jacobs
 
Empower my sql server administration with 5.7 instruments
Empower my sql server administration with 5.7 instrumentsEmpower my sql server administration with 5.7 instruments
Empower my sql server administration with 5.7 instruments
 
Deep Dive: Amazon Redshift (March 2017)
Deep Dive: Amazon Redshift (March 2017)Deep Dive: Amazon Redshift (March 2017)
Deep Dive: Amazon Redshift (March 2017)
 
Deep Dive Redshift, with a focus on performance
Deep Dive Redshift, with a focus on performanceDeep Dive Redshift, with a focus on performance
Deep Dive Redshift, with a focus on performance
 
IMCSummit 2015 - Day 2 Developer Track - A Reference Architecture for the Int...
IMCSummit 2015 - Day 2 Developer Track - A Reference Architecture for the Int...IMCSummit 2015 - Day 2 Developer Track - A Reference Architecture for the Int...
IMCSummit 2015 - Day 2 Developer Track - A Reference Architecture for the Int...
 
What are you waiting for? (#SQLSat211)
What are you waiting for? (#SQLSat211)What are you waiting for? (#SQLSat211)
What are you waiting for? (#SQLSat211)
 
Reference architecture for Internet of Things
Reference architecture for Internet of ThingsReference architecture for Internet of Things
Reference architecture for Internet of Things
 
Reference architecture for Internet Of Things
Reference architecture for Internet Of ThingsReference architecture for Internet Of Things
Reference architecture for Internet Of Things
 
Sql Server Statistics
Sql Server StatisticsSql Server Statistics
Sql Server Statistics
 
ASH and AWR Performance Data by Kellyn Pot'Vin
ASH and AWR Performance Data by Kellyn Pot'VinASH and AWR Performance Data by Kellyn Pot'Vin
ASH and AWR Performance Data by Kellyn Pot'Vin
 
Sherlock holmes for dba’s
Sherlock holmes for dba’sSherlock holmes for dba’s
Sherlock holmes for dba’s
 
A gentle introduction into AKKA and the actor model
A gentle introduction into AKKA and the actor modelA gentle introduction into AKKA and the actor model
A gentle introduction into AKKA and the actor model
 

Plus de John Beresniewicz

ASHviz - Dats visualization research experiments using ASH data
ASHviz - Dats visualization research experiments using ASH dataASHviz - Dats visualization research experiments using ASH data
ASHviz - Dats visualization research experiments using ASH dataJohn Beresniewicz
 
JB Design CV: products / mockups / experiments
JB Design CV: products / mockups / experiments JB Design CV: products / mockups / experiments
JB Design CV: products / mockups / experiments John Beresniewicz
 
Proactive performance monitoring with adaptive thresholds
Proactive performance monitoring with adaptive thresholdsProactive performance monitoring with adaptive thresholds
Proactive performance monitoring with adaptive thresholdsJohn Beresniewicz
 
Contract-oriented PLSQL Programming
Contract-oriented PLSQL ProgrammingContract-oriented PLSQL Programming
Contract-oriented PLSQL ProgrammingJohn Beresniewicz
 

Plus de John Beresniewicz (6)

ASHviz - Dats visualization research experiments using ASH data
ASHviz - Dats visualization research experiments using ASH dataASHviz - Dats visualization research experiments using ASH data
ASHviz - Dats visualization research experiments using ASH data
 
NoSQL is Anti-relational
NoSQL is Anti-relationalNoSQL is Anti-relational
NoSQL is Anti-relational
 
AAS Deeper Meaning
AAS Deeper MeaningAAS Deeper Meaning
AAS Deeper Meaning
 
JB Design CV: products / mockups / experiments
JB Design CV: products / mockups / experiments JB Design CV: products / mockups / experiments
JB Design CV: products / mockups / experiments
 
Proactive performance monitoring with adaptive thresholds
Proactive performance monitoring with adaptive thresholdsProactive performance monitoring with adaptive thresholds
Proactive performance monitoring with adaptive thresholds
 
Contract-oriented PLSQL Programming
Contract-oriented PLSQL ProgrammingContract-oriented PLSQL Programming
Contract-oriented PLSQL Programming
 

Dernier

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Dernier (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Ash Outliers UKOUG2011

  • 1. ASH Outliers: Detecting Unusual Events in Active Session History John Beresniewicz, Oracle USA
  • 2. Agenda • ASH Fundamentals • Wait Events and ASH • Event Histograms • Event Significance Levels • SQL to Find Outliers in ASH • Handling the GV$ problem
  • 3. Motivating Use Case • Unusually long wait events (outliers) suspected to trigger cascade-effect performance incidents ! • RAC performance experts claim EM Top Activity not helpful as aggregation masks outlier events ! • Can we see if ASH has sampled any such events? • If none observed does not mean they have not happened • However ASH sampling is biased to longer events
  • 5. ASH and DB Time
  • 6. ASH Fact Table Dimensions
  • 7. ASH Math • COUNT(*) = DB TIME (secs) • Basic in-memory (V$ASH) formula ! • The Kurtz Construct is nice • SUM(1) = DB Time (secs) for in-memory • SUM(10) = DB TIME (secs) for on-disk ! • DB Time Method analysis: • Dimensional GROUP BY over COUNT(*)
  • 8. Good ASH Math: ASH Analytics
  • 9. Group by Wait Event within Wait Class
  • 10. Add SQL_ID Grouping Dimension
  • 11. Bad ASH Math • SQL observed using 9 secs of CPU every 10 secs
  • 12. Wait Events and ASH • ASH samples actively waiting sessions • Wait time is unknown at sample time • The “fix up” writes actual wait time into TIME_WAITED ! • ASH is a biased sampler of wait events • Longer events have higher probability of being sampled ! • Avoid the temptation of TIME_WAITED • AVG(time_waited) DOES NOT estimate avg wait times • MIN and MAX do not work either • Except when MAX exceeds 1-second
  • 13. The ASH “fix up” • ASH columns may be unknown at sampling time • TIME_WAITED: session is still waiting • PLAN_HASH: session is still optimizing SQL • GC events: event details unknown at event initiation • Certain time model bit vector columns ! • ASH “fixes up” missing data during subsequent sample processing • TIME_WAITED fixed up in last event sample ! • Querying current ASH may return un-fixed rows • Should not be a problem generally
  • 14. ON CPU and ASH • ASH row status “ON CPU” derived, not observed • Session is in a database call • Session is NOT in a wait event (idle or non-idle) ! • Un-instrumented waits => “ON CPU” • These are bugs and should be rare, but have happened ! • Session on run queue may be WAITING or ON CPU • Depends on state prior to going onto run queue
  • 15. V$EVENT_HISTOGRAM • Histogram buckets of event wait times ! • Captures statistical distribution of wait times ! • All events since instance startup counted in some bucket ! • Exponential time bucketing scheme captures long-tail distributions efficiently
  • 16. V$EVENT_HISTOGRAM SQL> desc v$event_histogram Name Type ---------------------------- ---------------------------- EVENT# NUMBER EVENT VARCHAR2(64) WAIT_TIME_MILLI NUMBER WAIT_COUNT NUMBER LAST_UPDATE_TIME VARCHAR2(64)
  • 17. Event Histogram Time Buckets SQL> select distinct wait_time_milli ,log(2,wait_time_milli) from v$event_histogram order by 1; WAIT_TIME_MILLI LOG(2,WAIT_TIME_MILLI) --------------- ---------------------- 1 0 2 1 4 2 8 3 16 4 32 5 64 6 128 7 256 8 512 9 1024 10
  • 19. Latch Wait Event Histogram
  • 20. Histogram Math • Histograms capture probability distribution of TIME_WAITED by event over this startup cycle Σ Σ WaitCount Pr(time _ waited bucket ) < = < allbuckets bucket N N WaitCount
  • 21. Significance of Histogram Buckets # ! ! ! " & $ $ $ % bucket >= N Σ WaitCount Significance 1 = − Σ bucketN WaitCount allbuckets • Measures the cumulative distribution function of TIME_WAITED probabilities represented by the histograms (per bucket) ! • Every event in the bucket has at least this significance
  • 22. Defining “Outlier Events” • Events with low probability of occurrence ! • Events with high significance value ! • Q: Has ASH sampled any such events?
  • 24. Finding Outlier Events in ASH • Which ASH rows (if any) represent wait events with significantly long TIME_WAITED against the event histogram record? ! • Two step process: ! 1. Compute event histogram bucket significance 2. Join ASH to histograms and filter by significance
  • 25. Step 1: Compute Bucket Significance WITH EH$stats as (select EH.* ,ROUND(1 - (tot_count - bucket_tot_count + wait_count) / tot_count,6) as event_bucket_siglevel from (select event# ,event ,wait_time_milli ,wait_count ,ROUND(LOG(2,wait_time_milli)) as event_bucket ,SUM(wait_count) OVER (PARTITION BY event#) as tot_count ,SUM(wait_count) OVER (PARTITION BY event# ORDER BY wait_time_milli RANGE UNBOUNDED PRECEDING) as bucket_tot_count from v$event_histogram ) EH )
  • 26. Step 2: Join ASH to Buckets and Filter select EH.event_bucket ,ASH.sample_id ,ASH.session_id ,EH.event_bucket_siglevel as bucket_siglevel ,ASH.event ,ASH.time_waited/1000 ASH_time_waited_milli ,ASH.sql_id from EH$stats EH ,v$active_session_history ASH where EH.event# = ASH.event# and EH.event_bucket_siglevel > &siglevel and EH.event_bucket = CASE ASH.time_waited WHEN 0 THEN null ELSE TRUNC(LOG(2,ASH.time_waited/1000))+1 END order by sample_id, event, session_id ;
  • 27. DEMO?
  • 28. The GV$ Problem • Motivating use case is for RAC ! • Execute V$ query on all instances? • Too much effort ! • Convert V$ query to GV$ query? • GV$ remote joins not optimized • QC will pull V$ASH and V$EVENT_HISTOGRAM and join locally ! • Neither of these “solutions” is acceptable
  • 29. GV$ Table Function • Table function distributes V$ cursor across RAC nodes and marshals result sets ! • Perfect solution for this use case SELECT … FROM TABLE GV$( (CURSOR( SELECT FROM V$)))
  • 30. DEMO?
  • 31. Comments and Caveats • Highly significant events may not be sampled ! • Works best for long-tailed distributions • Bi-modal, single-bucket, timeout events not well-behaved ! • Exponential bucket sizing gets coarse quickly • Significance levels increase in big jumps • Important distinctions may hide inside large buckets ! • An interesting and unusual application of ASH where TIME_WAITED is the key • Does it help with the motivating use case?