Professional Documents
Culture Documents
SKILLBUILDERS
2000 Dot.Com 2001 Quest 2002 Oracle OEM 10g 2005 Embarcadero 2006 Independent
When not being being a Geek writing for the Oaktable etc - photographer - Just Married and new home owner in Portland - and wonder how I missed the dot.com millions
In this Session
The Holy Grail of Performance : ASL 1. ASL : stethoscope for Database Health
Tap is a metric that taps directly into the heart of your DB
Heart stopped - Hung? Beating very slow - Idle ? Beating fast - Heavily Loaded ?
2. ASL Components
CPU Waits Time series
I want a quick and easy way to see what the database is doing
Automated Alerts?
What do you set alerts on? What if no alerts fire ? Are you ok? Do alerts really tell you whats happening?
Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
ASL
10
Performance Page
11
12
Session Load
I often refer to it this way
13
14
ASL : sources
1. Manually
v$system_event v$sysstat
15
ASL Calculation
ASL = DB TIME / Elapsed Time
DB Time (DBT) = sum over all sessions of time spent in a call. A call could be executing SQL background work DBWR writing blocks LGWR writing redo
Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
DB Time
DB Time (DBT) = sum active session time
16
select value from v$sysstat select value from v$sysstat DB TIME (10g) = where name = DB time; DB time where name = DB time; Select sum(time_waited) from v$system_event Select sum(time_waited) from v$system_event where event not in ((... idle events ); where event not in ... idle events ); + + Select value from v$sysstat Select value from v$sysstat where name = CPU used by this session; where name = CPU used by this session;
Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
DB TIME =
17
1. ASL Manually
Data
10g, easy DBTime = V$sysstat DB time 9i ( 7 to 11 actually), DBTime = V$system_event Sum wait times Non-idle waits V$sysstat CPU used by this session
18
19
20
Statspack Output
Trusty statspack report Elapased Time Check Top 5 Timed Events
21
22
Example
Top 5 Timed Events Top 5 Timed Events
23
CPU + WAITS
CPU = 32 WAITS = 250 + 15 + 8 + 5 = 278 secs
Elapsed Time
= 60 secs
Event Time (s) Event Time (s) --------------------------------- --------buffer busy waits 250 buffer busy waits 250 CPU time 32 CPU time 32 free buffer waits 15 free buffer waits 15 write complete waits 8 write complete waits 8 log buffer space 5 log buffer space 5
24
4. ASHRPT
?@/rdbms/admin/ashrpt.sql
25
Top User Events DB/Inst: TESTDB/testdb (Apr 21 12:00 to 12:05) Top User Events DB/Inst: TESTDB/testdb (Apr 21 12:00 to 12:05) Avg Active Avg Active Event Class % Activity Event Class % Activity Sessions Sessions --------------------------- ----------- ---------- ------------------------------------ ----------- ---------- ---------CPU + Wait for CPU CPU 67.98 8.42 CPU + Wait for CPU CPU 67.98 8.42 enq: TX - row lock co Application 23.98 2.97 enq: TX - row lock co Application 23.98 2.97 buffer busy waits Concurrency 4.66 0.58 buffer busy waits Concurrency 4.66 0.58 latch: cache buffers chai 2.26 0.28 latch: cache buffers chai Concurrency Concurrency 2.26 0.28
26
27
28
CPU Count
Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
29
30
4. ASHRPT
ASH Report For TESTDB/testdb ASH Report For TESTDB/testdb TESTDB/testdb DB Name DB Id Instance Inst Num Release RAC Host DB Name DB Id Instance Inst Num Release RAC Host ------------ ----------- ------------ -------- ----------- --- ----------------------- ----------- ------------ -------- ----------- --- -----------TESTDB 2371570538 testdb 11 10.2.0.1.0 NO sdbe604a TESTDB 2371570538 testdb 10.2.0.1.0 NO sdbe604a CPUs SGA Size Buffer Cache Shared Pool ASH Buffer Size CPUs SGA Size Buffer Cache Shared Pool ASH Buffer Size ---- ------------------ ------------------ ------------------ --------------------- ------------------ ------------------ ------------------ -----------------22 1,000M (100%) 468M (46.8%) 112M (11.2%) 4.0M (0.4%) 1,000M (100%) 468M (46.8%) 112M (11.2%) 4.0M (0.4%) Analysis Begin Time: 21-Apr-06 12:00:01 21- AprAnalysis Begin Time: 21-Apr-06 12:00:01 Analysis End Time: 21-Apr-06 12:05:01 21- AprAnalysis End Time: 21-Apr-06 12:05:01 Elapsed Time: 5.0 (mins) mins) Elapsed Time: 5.0 ((mins) Sample Count: 3,716 Sample Count: 3,716 Average Session Load: 12.39 Average Session Load: 12.39 Avg. Active Session per CPU: 6.19 Avg. Active Session per CPU: 6.19 Report Target: None specified Report Target: None specified Top User Events DB/Inst: TESTDB/testdb (Apr 21 12:00 to 12:05) Top User Events DB/Inst: TESTDB/testdb TESTDB/testdb (Apr 21 12:00 to 12:05) Avg Active Avg Active Event Event Class %% Activity Event Event Class Activity Sessions Sessions ----------------------------------- --------------- ---------- -------------------------------------------- --------------- ---------- ---------CPU ++ Wait for CPU CPU 67.98 8.42 CPU Wait for CPU CPU 67.98 8.42 enq: TX -- row lock contention Application 23.98 2.97 enq: TX enq: row lock contention Application 23.98 2.97 buffer busy waits Concurrency 4.66 0.58 buffer busy waits Concurrency 4.66 0.58 latch: cache buffers chains Concurrency 2.26 0.28 latch: cache buffers chains Concurrency 2.26 0.28 Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
ASL Formulas
Use CPU count as yardstick: <1
Database is not blocked
31
ASL ~= 0
Database basically idle
32
33
Wait
Which waits
EM DB Home Page
34
35
Performance
Performance Page
36
Performance Page
37
38
39
1.9
40
CPU Usage
Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
41
Waits
42
CPU
Waits
43
44
45
Relax
Get to Work!
Looks OK But
46
47
Formula
Count active sessions over 15 seconds Divided by # of samples in 15 seconds
48
ASH
t0-n
t0
tn
ASL =
active sessions(ti) / n
n 0 Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
49
2. v$active_session_history
Direct Real time Approximation Allows drilldowns
Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
50
Performance
calculated differently
DB Home
51
Performance
Top Activity
v$sysstat
v$system_event
52
Top Activity
v$active_session_history ASL =
active sessions(ti)
n 0
53
Samples VS Counters
Samples v$active_session_history Slight Lags
v$system_event
Counters
54
Performance
ASH in OEM
55
56
Thanks To ASH
57
58
59
On Performance Page, no way to tell how many users But Top Activity Page fixes that
Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
60
61
Performance
62
SQL
Session
63
64
65
66
67
When to tune?
General rules of Thumb Waits >> CPU CPU > Max CPU
68
69
70
Idle Database
Value of proving the database is Idle Its the Databases Fault
How many times do you hear that?
Database Idle
No load on database Database performance is fine
Under utilized
71
72
Harnessing ASL
Statspack
lacking
73
OEM 10g
Best tool 10g (or 11) only Need licences
Ashmon OEM-lite
Free Any version with S-ASH Limited analysis
Copyright 2007-2007 Kyle Hailey. Distributed by www.skillbuilders.com.
74
Statspack
Free and any version Needs numerical massaging Lacking detailed SQL and Session info
OEM 10g
Clearest, easiest, most powerful
Overview
Load chart - ASL
75
Breakdown
Top SQL and Session Or Service, Module, Action, Objects, Files
Drill downs
SQL Session
Plus
ADDM Automatic Database Diagnostics Monitor SQL Advisor SQL tuning advice
76
Performance
SQL
77
Alternatives
Third Party tools
Quest Performance Analyzer Symantec I3 Confio Ignite
78
79
80
81
82
83
84
In summary
ASL is simple and Powerful ASLs components are even more powerful
CPU WAIT Value over Time
Use # of CPUs as a yardstick Know your application load profile to see anomalies Monitor ASL with OEM 10g, Ashmon or third party tools