SlideShare a Scribd company logo
Architect, Enterprise and Cloud Manageability
Oracle America
John Beresniewicz
Know your performance fundamentals
DB Time, Average Active Sessions, and ASH Math
The following is intended to outline our general product direction. It is intended for information
purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any
material, code, or functionality, and should not be relied upon in making purchasing decisions. The
development, release, timing, and pricing of any features or functionality described for Oracle’s
products may change and remains at the sole discretion of Oracle Corporation.
Safe harbor statement
Copyright © 2020, Oracle and/or its affiliates2
Copyright © 2020, Oracle and/or its affiliates3
4
3
2
1
Issues
ASH Math
Average Active Sessions
Database Time
Agenda
Copyright © 2020, Oracle and/or its affiliates | Confidential: Internal/Restricted/Highly Restricted4
Concepts
• The core ideas
Instrumentation
• Services supporting the core ideas
Visualization
• Presentation of concepts using instrumentation
Approach
Copyright © 2020, Oracle and/or its affiliates5
Database Time
Copyright © 2020, Oracle and/or its affiliates6
Performance is about work and time
Performance measures:
• Throughput = work / time
• Latency (response time) = time / work
Database time is about time spent doing database work
Database time is the foundation of Diagnostic and Tuning Packs:
• ADDM, AWR, SPA, SQL Monitor, EM Perf Page, Top Activity, ASH Analytics
Logic of DB Time
Copyright © 2020, Oracle and/or its affiliates7
Time spent processing database client calls
Specifically:
• Foreground time spent executing database calls (SQL)
• Actively working (on CPU) or waiting to work (in wait)
Note:
• Idle wait time is not included in DB Time
• Background time is not included in DB Time
Definition of DB Time
Copyright © 2020, Oracle and/or its affiliates8
DB Time is spent on CPU or in wait
DB Time clock starts upon client call to DB and stops with response to client
Model of DB Time
CPU WAIT
DB TIME
Copyright © 2020, Oracle and/or its affiliates9
Timers built into code path to measure DB Time spent in certain operations:
• Call begin/exit (total time in call)
• Parsing
• PL/SQL compilation
CPU time fetched from OS
Can be tricky given call stack complexity
• V$SYS_TIME_MODEL
• DBA_HIST_SYS_TIME_MODEL
• V$SYSMETRIC_HISTORY
Instrumentation: Time Model
Copyright © 2020, Oracle and/or its affiliates10
The following are critical Time Model measures:
DB Time
• Clearest and coarsest instrumentation points, highly reliable
• Includes run-queue time on CPU saturated systems
DB CPU
• Fetched from OS counters by foregrounds
• Includes only actual time on CPU, not time on run-queue
Also:
• background cpu time
• background elapsed
Critical Measures
Copyright © 2020, Oracle and/or its affiliates11
DB call execution involves many queueing, serialization, and synchronization mechanisms
• Locks, latches, mutexes
• Cores / CPUs / instance caging
External I/O
DB code is instrumented to time these “wait events”
• V$WAITCLASSMETRIC_HISTORY (???)
• V$EVENT_HISTOGRAM
Instrumentation: Wait Model
DB CPU WAITUser I/O WAIT
DB Time
Copyright © 2020, Oracle and/or its affiliates12
CPU saturation is an apex problem
• Processing capacity exhausted, no more work can be done
Instrumentation distortion
• Wait event timing
• Invisible / missing DB Time
Visibility issues, difficult to measure
Run queue: silent killer
Copyright © 2020, Oracle and/or its affiliates13
Run-queue distortion: wait path
DB file scattered read Run queue CPU
actual event latency
measured event latency
1. Event finishes and foreground queues for CPU
2. End of wait timestamp requires CPU
3. Measured event latency includes run-queue time
end timestampbegin timestamp
Copyright © 2020, Oracle and/or its affiliates14
DB Time exceeds total DB CPU time under CPU saturation
Run-queue not always reliably measured
• Check V$OSSTAT.STAT_NAME = ’RSRC_MGR_CPU_WAIT_TIME’
Run-queue distortion: CPU path
CPU Run queue CPU
DB Time
DB CPU DB CPU
Copyright © 2020, Oracle and/or its affiliates15
Quantifying true CPU capacity increasingly difficult
• Hyper-threading
• Virtualization and hypervisors
• Containers and cloud
Core utilization is the used fraction of raw core time available
• When < 1 system is not CPU saturated
• When > 1 system exceeding raw core capacity through hyper-threading
Core Utilization
!" #$% + '()*+,-./0 )1.
23(1420 5672 ∗ )-,2 )-./5
Copyright © 2020, Oracle and/or its affiliates16
Viz: EM DB Performance Page
Copyright © 2020, Oracle and/or its affiliates17
Average Active Sessions
Copyright © 2020, Oracle and/or its affiliates18
Labeling the Perf Page chart
DB Time per sec = “Centi-users per second”?
Copyright © 2020, Oracle and/or its affiliates19
Over some time interval, e.g. an AWR snapshot
AAS is the rate at which DB Time is accumulates in the system
We also think of AAS as the load on the database
Typically, total sessions >> AAS (due to session idle time)
• However poor session management is a classic performance pitfall
Definition of AAS
!"#$%&# !'()"# *#++),-+ = !!* = /01 2)3#
#4%5+#6 ()3#
Copyright © 2020, Oracle and/or its affiliates20
AAS = rate of change of DB Time over time
Integrating AAS = computing DB Time
Perf Page is literally a picture of DB Time
AAS and DB Time
!"#$%& '&''$()' # =
+ ,- .$/&
+#
0
12
13
!"#$%& '&''$()' # +# = ,- .$/&
#2
#1
Copyright © 2020, Oracle and/or its affiliates21
AAS for comparisons:
• Across time periods – how does load vary?
• Across similar systems – which DB is busiest?
Per-core normalization
• Compare different systems’ profiles
• AWR1page script
Normalization and AAS
!""#(%&'()
*+,- *+./(
!""#(012)
*+,- *+./(
Copyright © 2020, Oracle and/or its affiliates22
Q: Whose time is DB Time?
A: Business entities using database services to accomplish time-bound goals
• Interactive end-users
• Automated business processes
”Enterprise time” is the same regardless of which database or service is being invoked
• One second spent waiting for DB1 response is no different than one waiting for DB2
Enterprise DB Time can be thought of as a fungible quantity
Fungibility of DB Time
Copyright © 2020, Oracle and/or its affiliates23
Viz: EM Enterprise Loadmap
Copyright © 2020, Oracle and/or its affiliates27
Active session state sampled into memory every second (1000 msec)
• Active = in DB call and not in idle wait
Fixes-up values unknown at sampling time
• TIME_WAITED
Sampled session state is either ON CPU or in WAIT event
• Session in WAIT is known
• Session presumed ON CPU if not in WAIT
Wait event samples biased toward longer latency waits
Mechanism design is latch-less, efficient, reliable
Instrumentation: Active Session History
Conforms to the model of DB Time
Copyright © 2020, Oracle and/or its affiliates28
Viz: EM Top Activity Page
Copyright © 2020, Oracle and/or its affiliates |29
ASH Math
Copyright © 2020, Oracle and/or its affiliates30
Decompose DB Time by aggregating ASH sample rows
• Grouped over dimensions, classic fact table query
• Many analysis columns: 30+ in DB 10.2, 110+ in DB 12.2
Filter and Aggregate to isolate and expose how DB Time is spent
Normalize to AAS: divide DB Time by aggregation interval time
Estimating DB Time using ASH
!"#$% ∗ = () *+,- (/-0/)
select trunc(sample_time,'MI’), sql_id
,sum(usecs_per_row)/(60*power(10,6)) as AAS
from v$active_session_history
group by trunc(sample_time,'MI’), sql_id;
Copyright © 2020, Oracle and/or its affiliates31
Summing samples is equivalent to computing Riemann estimate of DB Time integral
• !"#$% &'( )*+,-./ = *!%12.'.))1"$) %
• ∆% = )*+,-1$4 1$%.52*- = 1 ).!
The calculus of ASH Math
∆%
ASH
Sample
count
time
sessions
*!%12.'.))1"$) %
Copyright © 2020, Oracle and/or its affiliates32
Both are literal pictures of DB Time:
• Perf Page is top-down instrumentation:
• Time Model & Wait model
• Top Activity is bottom-up instrumentation
• ASH
It’s the Fundamental Theorem of Calculus!
Perf Page ≡ Top Activity Page
Copyright © 2020, Oracle and/or its affiliates33
Beware: the ASH sampler is biased toward longer latencies
• Higher probability of being sampled
Common mistakes:
• AVG(TIME_WAITED) ≠ average event latency
• SUM(TIME_WAITED) ≠ DB wait time
Bad ASH math
Copyright © 2020, Oracle and/or its affiliates34
Viz: ASH Analytics Loadmap
IN_CONNECTION_MGMT VARCHAR2(1)
IN_PARSE VARCHAR2(1)
IN_HARD_PARSE VARCHAR2(1)
IN_PLSQL_RPC VARCHAR2(1)
IN_PLSQL_COMPILATION VARCHAR2(1)
IN_JAVA_EXECUTION VARCHAR2(1)
IN_BIND VARCHAR2(1)
Copyright © 2020, Oracle and/or its affiliates35
ASH math can estimate DB Time spent in “un-timeable” operations
1. Timestamping may be relatively expensive for very low latency operations
2. Instead, set a session state bit ON when operation begins – very cheap
3. When operations completes, set the bit OFF
4. ASH sampler samples bit vector
5. Using ASH math: COUNT(samples with bit ON) = DB Time in operation
Bit vector magic
Copyright © 2020, Oracle and/or its affiliates36
So what can TIME_WAITED tell us?
Recall: ASH sampling is independent of session activity and on strict schedule
TIME_WAITED: advanced ASH math
time
wait event E CPUCPU
1000 ms
200 ms ASH Sample time
Pr # $%&'()* = ,-./#_12.-#3
4%&'(567 .68)9:%(
Copyright © 2020, Oracle and/or its affiliates37
• Questions:
• If a sampled 200 msec event counts for 1000 msec of DB Time, what about the other 800 msec?
• How can the likelihood of sampling an event provide an estimate for how often it occurs?
Estimated number of occurrences is number required to minimally cover sampling interval
TIME_WAITED: estimating event counts
!"#_%&'(#)*)+, = GREATEST
456789:; 9:<=>?58
#@A!_BC@#!D
, 1
1000 ms
200 ms
time
wait event E wait event E wait event E wait event E wait event E
Copyright © 2020, Oracle and/or its affiliates38
Estimating average latency properly
select wait_class
,TRUNC(DBtime_usecs / est_count) as AvgLatency_usec
,TRUNC(bad_ash_math) as bad_ash_math
from
(select wait_class
,SUM(GREATEST(usecs_per_row / time_waited, 1)) est_count
,SUM(usecs_per_row) DBtime_usecs
,AVG(time_waited) bad_ash_math
from
v$active_session_history
where time_waited > 0
group by wait_class
)
Copyright © 2020, Oracle and/or its affiliates39
Bad ASH math vs. properly estimated average latencies:
Results
WAIT_CLASS AVGLATENCY_USEC BAD_ASH_MATH
Concurrency 702 21139
User I/O 735 18380
Administrative 104910 135946
System I/O 543 855
Other 71 65951
Scheduler 9883 10901
Configuration 254143 330538
Cluster 155 5632
Application 277 26880
Commit 494 927
Network 399 51402
Idle 1004 1006
Copyright © 2020, Oracle and/or its affiliates40
Issues
Copyright © 2020, Oracle and/or its affiliates
Database is only one of many layers in the Enterprise technology stack
Determine how much DB Time contributes to total Enterprise time
Beware of instrumentation infatuation
DB Time is not the only relevant time
Database Storage
Client Services
Micro
services
Database Storage
response time profile
Copyright © 2020, Oracle and/or its affiliates42
Principal Database Engineer, AWS
Kevin Closson
“Everything is a CPU problem”
Copyright © 2020, Oracle and/or its affiliates43
A curious case from @oradiag
Copyright © 2020, Oracle and/or its affiliates44
CPU Wait on Performance Page is derived not measured
Time model instrumentation:
• Total DB Time
• Total DB CPU
Wait model instrumentation:
• Non-idle wait (I/O and everything else)
CPU Wait: estimating run-queue time
!"# $%&' = )* +&,- − )* !"# + $01+ DB CPU
I/O WAIT
WAIT
DB TIME
CPU Wait
Copyright © 2020, Oracle and/or its affiliates45
Always some “CPU bleed” into measured wait time
• Timestamps
• Call stack traversal
CPU time under wait double-counted
• DB Time
• DB CPU
Shrinking event latencies exacerbate the problem
• May require instrumentation adjustments
CPU under wait
CPUWAIT
CPUWAIT
CPU under wait
Copyright © 2020, Oracle and/or its affiliates46
AWR report from @kevinclosson
• “What’s up with % DB Time greater than 100?”
Close and painful scrutiny revealed CPU under wait
• 50% of I/O wait was CPU time
• AWR1page script developed
Identifying CPU under wait
Top 10 Foreground Events by Total Wait Time
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Total Wait Wait % DB Wait
Event Waits Time (sec) Avg(ms) time Class
------------------------------ ----------- ---------- ---------- ------ --------
db file parallel read 139,819 469.8 3.36 78.1 User I/O
DB CPU 243 40.4
db file sequential read 201,921 52.4 0.26 8.7 User I/O
DB Time << CPU + Wait
47
End
Copyright © 2020, Oracle and/or its affiliates48
@JBeresniewicz
john.beresniewicz@oracle.com
Thank you
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
Ad

More Related Content

What's hot (20)

Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Tanel Poder
 
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
John Kanagaraj
 
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
Tanel Poder
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
Simon Huang
 
Adapting and adopting spm v04
Adapting and adopting spm v04Adapting and adopting spm v04
Adapting and adopting spm v04
Carlos Sierra
 
Ash and awr deep dive hotsos
Ash and awr deep dive hotsosAsh and awr deep dive hotsos
Ash and awr deep dive hotsos
Kellyn Pot'Vin-Gorman
 
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Aaron Shilo
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
Carlos Sierra
 
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Carlos Sierra
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
Satishbabu Gunukula
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuning
Abishek V S
 
Same plan different performance
Same plan different performanceSame plan different performance
Same plan different performance
Mauro Pagano
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
Guy Harrison
 
AWR & ASH Analysis
AWR & ASH AnalysisAWR & ASH Analysis
AWR & ASH Analysis
aioughydchapter
 
SQLd360
SQLd360SQLd360
SQLd360
Mauro Pagano
 
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
Tanel Poder
 
Online index rebuild automation
Online index rebuild automationOnline index rebuild automation
Online index rebuild automation
Carlos Sierra
 
Awr + 12c performance tuning
Awr + 12c performance tuningAwr + 12c performance tuning
Awr + 12c performance tuning
AiougVizagChapter
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
pasalapudi
 
SQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12cSQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12c
Tanel Poder
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Tanel Poder
 
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
John Kanagaraj
 
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
Tanel Poder
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
Simon Huang
 
Adapting and adopting spm v04
Adapting and adopting spm v04Adapting and adopting spm v04
Adapting and adopting spm v04
Carlos Sierra
 
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Aaron Shilo
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
Carlos Sierra
 
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Survey of some free Tools to enhance your SQL Tuning and Performance Diagnost...
Carlos Sierra
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
Satishbabu Gunukula
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuning
Abishek V S
 
Same plan different performance
Same plan different performanceSame plan different performance
Same plan different performance
Mauro Pagano
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
Guy Harrison
 
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
Tanel Poder
 
Online index rebuild automation
Online index rebuild automationOnline index rebuild automation
Online index rebuild automation
Carlos Sierra
 
Awr + 12c performance tuning
Awr + 12c performance tuningAwr + 12c performance tuning
Awr + 12c performance tuning
AiougVizagChapter
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
pasalapudi
 
SQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12cSQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12c
Tanel Poder
 

Similar to DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals (20)

Collaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportCollaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR Report
Alfredo Krieg
 
Average Active Sessions RMOUG2007
Average Active Sessions RMOUG2007Average Active Sessions RMOUG2007
Average Active Sessions RMOUG2007
John Beresniewicz
 
In-memory ColumnStore Index
In-memory ColumnStore IndexIn-memory ColumnStore Index
In-memory ColumnStore Index
SolidQ
 
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
Amazon Web Services Korea
 
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Cloudera, Inc.
 
PASS Summit 2020
PASS Summit 2020PASS Summit 2020
PASS Summit 2020
Kellyn Pot'Vin-Gorman
 
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Databricks
 
Spark Summit EU talk by Mike Percy
Spark Summit EU talk by Mike PercySpark Summit EU talk by Mike Percy
Spark Summit EU talk by Mike Percy
Spark Summit
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next Frontier
Kellyn Pot'Vin-Gorman
 
AWR and ASH Advanced Usage with DB12c
AWR and ASH Advanced Usage with DB12cAWR and ASH Advanced Usage with DB12c
AWR and ASH Advanced Usage with DB12c
Kellyn Pot'Vin-Gorman
 
What's New in Apache Hive
What's New in Apache HiveWhat's New in Apache Hive
What's New in Apache Hive
DataWorks Summit
 
MySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMySQL Performance Metrics that Matter
MySQL Performance Metrics that Matter
Morgan Tocker
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaa
Cuneyt Goksu
 
pdf-download-db-time-based-oracle-performance-tuning-theory-and.pdf
pdf-download-db-time-based-oracle-performance-tuning-theory-and.pdfpdf-download-db-time-based-oracle-performance-tuning-theory-and.pdf
pdf-download-db-time-based-oracle-performance-tuning-theory-and.pdf
cookie1969
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
Alfredo Abate
 
Challenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineChallenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop Engine
Nicolas Morales
 
Copy Data Management for the DBA
Copy Data Management for the DBACopy Data Management for the DBA
Copy Data Management for the DBA
Kellyn Pot'Vin-Gorman
 
Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov...
 Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov... Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov...
Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov...
Databricks
 
Apouc 2014-enterprise-manager-12c
Apouc 2014-enterprise-manager-12cApouc 2014-enterprise-manager-12c
Apouc 2014-enterprise-manager-12c
OUGTH Oracle User Group in Thailand
 
What's New in Apache Hive 3.0 - Tokyo
What's New in Apache Hive 3.0 - TokyoWhat's New in Apache Hive 3.0 - Tokyo
What's New in Apache Hive 3.0 - Tokyo
DataWorks Summit
 
Collaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportCollaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR Report
Alfredo Krieg
 
Average Active Sessions RMOUG2007
Average Active Sessions RMOUG2007Average Active Sessions RMOUG2007
Average Active Sessions RMOUG2007
John Beresniewicz
 
In-memory ColumnStore Index
In-memory ColumnStore IndexIn-memory ColumnStore Index
In-memory ColumnStore Index
SolidQ
 
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
Amazon Web Services Korea
 
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Cloudera, Inc.
 
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Databricks
 
Spark Summit EU talk by Mike Percy
Spark Summit EU talk by Mike PercySpark Summit EU talk by Mike Percy
Spark Summit EU talk by Mike Percy
Spark Summit
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next Frontier
Kellyn Pot'Vin-Gorman
 
AWR and ASH Advanced Usage with DB12c
AWR and ASH Advanced Usage with DB12cAWR and ASH Advanced Usage with DB12c
AWR and ASH Advanced Usage with DB12c
Kellyn Pot'Vin-Gorman
 
MySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMySQL Performance Metrics that Matter
MySQL Performance Metrics that Matter
Morgan Tocker
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaa
Cuneyt Goksu
 
pdf-download-db-time-based-oracle-performance-tuning-theory-and.pdf
pdf-download-db-time-based-oracle-performance-tuning-theory-and.pdfpdf-download-db-time-based-oracle-performance-tuning-theory-and.pdf
pdf-download-db-time-based-oracle-performance-tuning-theory-and.pdf
cookie1969
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
Alfredo Abate
 
Challenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineChallenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop Engine
Nicolas Morales
 
Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov...
 Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov... Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov...
Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov...
Databricks
 
What's New in Apache Hive 3.0 - Tokyo
What's New in Apache Hive 3.0 - TokyoWhat's New in Apache Hive 3.0 - Tokyo
What's New in Apache Hive 3.0 - Tokyo
DataWorks Summit
 
Ad

More from John Beresniewicz (12)

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
John Beresniewicz
 
NoSQL is Anti-relational
NoSQL is Anti-relationalNoSQL is Anti-relational
NoSQL is Anti-relational
John Beresniewicz
 
AAS Deeper Meaning
AAS Deeper MeaningAAS Deeper Meaning
AAS Deeper Meaning
John Beresniewicz
 
Awr1page OTW2018
Awr1page OTW2018Awr1page OTW2018
Awr1page OTW2018
John Beresniewicz
 
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
John 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
 
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
John Beresniewicz
 
AWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add upAWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add up
John Beresniewicz
 
Proactive performance monitoring with adaptive thresholds
Proactive performance monitoring with adaptive thresholdsProactive performance monitoring with adaptive thresholds
Proactive performance monitoring with adaptive thresholds
John Beresniewicz
 
Ash Outliers UKOUG2011
Ash Outliers UKOUG2011Ash Outliers UKOUG2011
Ash Outliers UKOUG2011
John Beresniewicz
 
Contract-oriented PLSQL Programming
Contract-oriented PLSQL ProgrammingContract-oriented PLSQL Programming
Contract-oriented PLSQL Programming
John Beresniewicz
 
Average Active Sessions - OaktableWorld 2013
Average Active Sessions - OaktableWorld 2013Average Active Sessions - OaktableWorld 2013
Average Active Sessions - OaktableWorld 2013
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 data
John Beresniewicz
 
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
John 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
 
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
John Beresniewicz
 
AWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add upAWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add up
John Beresniewicz
 
Proactive performance monitoring with adaptive thresholds
Proactive performance monitoring with adaptive thresholdsProactive performance monitoring with adaptive thresholds
Proactive performance monitoring with adaptive thresholds
John Beresniewicz
 
Contract-oriented PLSQL Programming
Contract-oriented PLSQL ProgrammingContract-oriented PLSQL Programming
Contract-oriented PLSQL Programming
John Beresniewicz
 
Average Active Sessions - OaktableWorld 2013
Average Active Sessions - OaktableWorld 2013Average Active Sessions - OaktableWorld 2013
Average Active Sessions - OaktableWorld 2013
John Beresniewicz
 
Ad

Recently uploaded (20)

UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Financial Services Technology Summit 2025
Financial Services Technology Summit 2025Financial Services Technology Summit 2025
Financial Services Technology Summit 2025
Ray Bugg
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Does Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should KnowDoes Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should Know
Pornify CC
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Financial Services Technology Summit 2025
Financial Services Technology Summit 2025Financial Services Technology Summit 2025
Financial Services Technology Summit 2025
Ray Bugg
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Does Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should KnowDoes Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should Know
Pornify CC
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 

DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals

  • 1. Architect, Enterprise and Cloud Manageability Oracle America John Beresniewicz Know your performance fundamentals DB Time, Average Active Sessions, and ASH Math
  • 2. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Safe harbor statement Copyright © 2020, Oracle and/or its affiliates2
  • 3. Copyright © 2020, Oracle and/or its affiliates3 4 3 2 1 Issues ASH Math Average Active Sessions Database Time Agenda
  • 4. Copyright © 2020, Oracle and/or its affiliates | Confidential: Internal/Restricted/Highly Restricted4 Concepts • The core ideas Instrumentation • Services supporting the core ideas Visualization • Presentation of concepts using instrumentation Approach
  • 5. Copyright © 2020, Oracle and/or its affiliates5 Database Time
  • 6. Copyright © 2020, Oracle and/or its affiliates6 Performance is about work and time Performance measures: • Throughput = work / time • Latency (response time) = time / work Database time is about time spent doing database work Database time is the foundation of Diagnostic and Tuning Packs: • ADDM, AWR, SPA, SQL Monitor, EM Perf Page, Top Activity, ASH Analytics Logic of DB Time
  • 7. Copyright © 2020, Oracle and/or its affiliates7 Time spent processing database client calls Specifically: • Foreground time spent executing database calls (SQL) • Actively working (on CPU) or waiting to work (in wait) Note: • Idle wait time is not included in DB Time • Background time is not included in DB Time Definition of DB Time
  • 8. Copyright © 2020, Oracle and/or its affiliates8 DB Time is spent on CPU or in wait DB Time clock starts upon client call to DB and stops with response to client Model of DB Time CPU WAIT DB TIME
  • 9. Copyright © 2020, Oracle and/or its affiliates9 Timers built into code path to measure DB Time spent in certain operations: • Call begin/exit (total time in call) • Parsing • PL/SQL compilation CPU time fetched from OS Can be tricky given call stack complexity • V$SYS_TIME_MODEL • DBA_HIST_SYS_TIME_MODEL • V$SYSMETRIC_HISTORY Instrumentation: Time Model
  • 10. Copyright © 2020, Oracle and/or its affiliates10 The following are critical Time Model measures: DB Time • Clearest and coarsest instrumentation points, highly reliable • Includes run-queue time on CPU saturated systems DB CPU • Fetched from OS counters by foregrounds • Includes only actual time on CPU, not time on run-queue Also: • background cpu time • background elapsed Critical Measures
  • 11. Copyright © 2020, Oracle and/or its affiliates11 DB call execution involves many queueing, serialization, and synchronization mechanisms • Locks, latches, mutexes • Cores / CPUs / instance caging External I/O DB code is instrumented to time these “wait events” • V$WAITCLASSMETRIC_HISTORY (???) • V$EVENT_HISTOGRAM Instrumentation: Wait Model DB CPU WAITUser I/O WAIT DB Time
  • 12. Copyright © 2020, Oracle and/or its affiliates12 CPU saturation is an apex problem • Processing capacity exhausted, no more work can be done Instrumentation distortion • Wait event timing • Invisible / missing DB Time Visibility issues, difficult to measure Run queue: silent killer
  • 13. Copyright © 2020, Oracle and/or its affiliates13 Run-queue distortion: wait path DB file scattered read Run queue CPU actual event latency measured event latency 1. Event finishes and foreground queues for CPU 2. End of wait timestamp requires CPU 3. Measured event latency includes run-queue time end timestampbegin timestamp
  • 14. Copyright © 2020, Oracle and/or its affiliates14 DB Time exceeds total DB CPU time under CPU saturation Run-queue not always reliably measured • Check V$OSSTAT.STAT_NAME = ’RSRC_MGR_CPU_WAIT_TIME’ Run-queue distortion: CPU path CPU Run queue CPU DB Time DB CPU DB CPU
  • 15. Copyright © 2020, Oracle and/or its affiliates15 Quantifying true CPU capacity increasingly difficult • Hyper-threading • Virtualization and hypervisors • Containers and cloud Core utilization is the used fraction of raw core time available • When < 1 system is not CPU saturated • When > 1 system exceeding raw core capacity through hyper-threading Core Utilization !" #$% + '()*+,-./0 )1. 23(1420 5672 ∗ )-,2 )-./5
  • 16. Copyright © 2020, Oracle and/or its affiliates16 Viz: EM DB Performance Page
  • 17. Copyright © 2020, Oracle and/or its affiliates17 Average Active Sessions
  • 18. Copyright © 2020, Oracle and/or its affiliates18 Labeling the Perf Page chart DB Time per sec = “Centi-users per second”?
  • 19. Copyright © 2020, Oracle and/or its affiliates19 Over some time interval, e.g. an AWR snapshot AAS is the rate at which DB Time is accumulates in the system We also think of AAS as the load on the database Typically, total sessions >> AAS (due to session idle time) • However poor session management is a classic performance pitfall Definition of AAS !"#$%&# !'()"# *#++),-+ = !!* = /01 2)3# #4%5+#6 ()3#
  • 20. Copyright © 2020, Oracle and/or its affiliates20 AAS = rate of change of DB Time over time Integrating AAS = computing DB Time Perf Page is literally a picture of DB Time AAS and DB Time !"#$%& '&''$()' # = + ,- .$/& +# 0 12 13 !"#$%& '&''$()' # +# = ,- .$/& #2 #1
  • 21. Copyright © 2020, Oracle and/or its affiliates21 AAS for comparisons: • Across time periods – how does load vary? • Across similar systems – which DB is busiest? Per-core normalization • Compare different systems’ profiles • AWR1page script Normalization and AAS !""#(%&'() *+,- *+./( !""#(012) *+,- *+./(
  • 22. Copyright © 2020, Oracle and/or its affiliates22 Q: Whose time is DB Time? A: Business entities using database services to accomplish time-bound goals • Interactive end-users • Automated business processes ”Enterprise time” is the same regardless of which database or service is being invoked • One second spent waiting for DB1 response is no different than one waiting for DB2 Enterprise DB Time can be thought of as a fungible quantity Fungibility of DB Time
  • 23. Copyright © 2020, Oracle and/or its affiliates23 Viz: EM Enterprise Loadmap
  • 24. Copyright © 2020, Oracle and/or its affiliates27 Active session state sampled into memory every second (1000 msec) • Active = in DB call and not in idle wait Fixes-up values unknown at sampling time • TIME_WAITED Sampled session state is either ON CPU or in WAIT event • Session in WAIT is known • Session presumed ON CPU if not in WAIT Wait event samples biased toward longer latency waits Mechanism design is latch-less, efficient, reliable Instrumentation: Active Session History Conforms to the model of DB Time
  • 25. Copyright © 2020, Oracle and/or its affiliates28 Viz: EM Top Activity Page
  • 26. Copyright © 2020, Oracle and/or its affiliates |29 ASH Math
  • 27. Copyright © 2020, Oracle and/or its affiliates30 Decompose DB Time by aggregating ASH sample rows • Grouped over dimensions, classic fact table query • Many analysis columns: 30+ in DB 10.2, 110+ in DB 12.2 Filter and Aggregate to isolate and expose how DB Time is spent Normalize to AAS: divide DB Time by aggregation interval time Estimating DB Time using ASH !"#$% ∗ = () *+,- (/-0/) select trunc(sample_time,'MI’), sql_id ,sum(usecs_per_row)/(60*power(10,6)) as AAS from v$active_session_history group by trunc(sample_time,'MI’), sql_id;
  • 28. Copyright © 2020, Oracle and/or its affiliates31 Summing samples is equivalent to computing Riemann estimate of DB Time integral • !"#$% &'( )*+,-./ = *!%12.'.))1"$) % • ∆% = )*+,-1$4 1$%.52*- = 1 ).! The calculus of ASH Math ∆% ASH Sample count time sessions *!%12.'.))1"$) %
  • 29. Copyright © 2020, Oracle and/or its affiliates32 Both are literal pictures of DB Time: • Perf Page is top-down instrumentation: • Time Model & Wait model • Top Activity is bottom-up instrumentation • ASH It’s the Fundamental Theorem of Calculus! Perf Page ≡ Top Activity Page
  • 30. Copyright © 2020, Oracle and/or its affiliates33 Beware: the ASH sampler is biased toward longer latencies • Higher probability of being sampled Common mistakes: • AVG(TIME_WAITED) ≠ average event latency • SUM(TIME_WAITED) ≠ DB wait time Bad ASH math
  • 31. Copyright © 2020, Oracle and/or its affiliates34 Viz: ASH Analytics Loadmap
  • 32. IN_CONNECTION_MGMT VARCHAR2(1) IN_PARSE VARCHAR2(1) IN_HARD_PARSE VARCHAR2(1) IN_PLSQL_RPC VARCHAR2(1) IN_PLSQL_COMPILATION VARCHAR2(1) IN_JAVA_EXECUTION VARCHAR2(1) IN_BIND VARCHAR2(1) Copyright © 2020, Oracle and/or its affiliates35 ASH math can estimate DB Time spent in “un-timeable” operations 1. Timestamping may be relatively expensive for very low latency operations 2. Instead, set a session state bit ON when operation begins – very cheap 3. When operations completes, set the bit OFF 4. ASH sampler samples bit vector 5. Using ASH math: COUNT(samples with bit ON) = DB Time in operation Bit vector magic
  • 33. Copyright © 2020, Oracle and/or its affiliates36 So what can TIME_WAITED tell us? Recall: ASH sampling is independent of session activity and on strict schedule TIME_WAITED: advanced ASH math time wait event E CPUCPU 1000 ms 200 ms ASH Sample time Pr # $%&'()* = ,-./#_12.-#3 4%&'(567 .68)9:%(
  • 34. Copyright © 2020, Oracle and/or its affiliates37 • Questions: • If a sampled 200 msec event counts for 1000 msec of DB Time, what about the other 800 msec? • How can the likelihood of sampling an event provide an estimate for how often it occurs? Estimated number of occurrences is number required to minimally cover sampling interval TIME_WAITED: estimating event counts !"#_%&'(#)*)+, = GREATEST 456789:; 9:<=>?58 #@A!_BC@#!D , 1 1000 ms 200 ms time wait event E wait event E wait event E wait event E wait event E
  • 35. Copyright © 2020, Oracle and/or its affiliates38 Estimating average latency properly select wait_class ,TRUNC(DBtime_usecs / est_count) as AvgLatency_usec ,TRUNC(bad_ash_math) as bad_ash_math from (select wait_class ,SUM(GREATEST(usecs_per_row / time_waited, 1)) est_count ,SUM(usecs_per_row) DBtime_usecs ,AVG(time_waited) bad_ash_math from v$active_session_history where time_waited > 0 group by wait_class )
  • 36. Copyright © 2020, Oracle and/or its affiliates39 Bad ASH math vs. properly estimated average latencies: Results WAIT_CLASS AVGLATENCY_USEC BAD_ASH_MATH Concurrency 702 21139 User I/O 735 18380 Administrative 104910 135946 System I/O 543 855 Other 71 65951 Scheduler 9883 10901 Configuration 254143 330538 Cluster 155 5632 Application 277 26880 Commit 494 927 Network 399 51402 Idle 1004 1006
  • 37. Copyright © 2020, Oracle and/or its affiliates40 Issues
  • 38. Copyright © 2020, Oracle and/or its affiliates Database is only one of many layers in the Enterprise technology stack Determine how much DB Time contributes to total Enterprise time Beware of instrumentation infatuation DB Time is not the only relevant time Database Storage Client Services Micro services Database Storage response time profile
  • 39. Copyright © 2020, Oracle and/or its affiliates42 Principal Database Engineer, AWS Kevin Closson “Everything is a CPU problem”
  • 40. Copyright © 2020, Oracle and/or its affiliates43 A curious case from @oradiag
  • 41. Copyright © 2020, Oracle and/or its affiliates44 CPU Wait on Performance Page is derived not measured Time model instrumentation: • Total DB Time • Total DB CPU Wait model instrumentation: • Non-idle wait (I/O and everything else) CPU Wait: estimating run-queue time !"# $%&' = )* +&,- − )* !"# + $01+ DB CPU I/O WAIT WAIT DB TIME CPU Wait
  • 42. Copyright © 2020, Oracle and/or its affiliates45 Always some “CPU bleed” into measured wait time • Timestamps • Call stack traversal CPU time under wait double-counted • DB Time • DB CPU Shrinking event latencies exacerbate the problem • May require instrumentation adjustments CPU under wait CPUWAIT CPUWAIT CPU under wait
  • 43. Copyright © 2020, Oracle and/or its affiliates46 AWR report from @kevinclosson • “What’s up with % DB Time greater than 100?” Close and painful scrutiny revealed CPU under wait • 50% of I/O wait was CPU time • AWR1page script developed Identifying CPU under wait Top 10 Foreground Events by Total Wait Time ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Total Wait Wait % DB Wait Event Waits Time (sec) Avg(ms) time Class ------------------------------ ----------- ---------- ---------- ------ -------- db file parallel read 139,819 469.8 3.36 78.1 User I/O DB CPU 243 40.4 db file sequential read 201,921 52.4 0.26 8.7 User I/O DB Time << CPU + Wait
  • 45. Copyright © 2020, Oracle and/or its affiliates48 @JBeresniewicz john.beresniewicz@oracle.com Thank you
  翻译: