Top Banner
Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey http://perfvision.com/ftp/ emea
64

Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

Jan 14, 2016

Download

Documents

Terence Edwards
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

Average Active Sessions (AAS)

The Golden Metric ?

Kyle Hailey

http://perfvision.com/ftp/emea

Page 2: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

204/21/23

Database Performance How quick can you find

Bottleneck in DBIf DB is idleCurrent DB Load

what is DB Load ?

What do you use?Statspack/AWRV$active_session_historyAlerts

what do you alert on ?

what the *!####!*!*? is the database doing ?!

Page 3: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.3

304/21/23

Statspack / AWR1000 lines of data / 30 pagesWhat do you look at ?Top 5 Timed Events?

Top 5 Timed Events~~~~~~~~~~~~~~~~~~ % TotalEvent Waits Time (s) Ela Time------------------------ ------------ ----------- --------CPU time 11,330 81.95log file sync 163,725 1,012 7.32enqueue 4,486 615 4.45latch free 28,786 236 1.71db file sequential read 1,420,355 149 1.08 -----------------------------------------

Jonathan Lewis - http://www.jlcomp.demon.co.uk/statspack_01.html

188 minutes CPUElapsed 15 minutes48 Processors or74% idle

Page 4: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.4

404/21/23 Copyright 2006 Kyle Hailey

In this Session1. AAS

Single Metric Shows DB Performance

2. Yardstick Max CPU CPU Count To measure AAS against

3. Subcomponents CPU Waits Time series

Page 5: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

504/21/23 Copyright 2006 Kyle Hailey

Goal of this Presentation

Cut out unnecessary

Hone in on essential

Simplify the data and empower the DBA

Page 6: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

604/21/23 Copyright 2006 Kyle Hailey

What’s the DB Doing?!

It’s 2am … your manager calls

Whip out the stethoscope:

AAS

what the *!####!*!*? is the database doing ?!

Page 7: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.7

Copyright 2006 Kyle Hailey

Welcome to …The Cult of AAS

Once you’ve been initiated …

there is no going back

For those of you who are already members, welcome back

Page 8: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.8

Copyright 2006 Kyle Hailey

AAS Calculation

AAS = DB TIME / Elapsed Time

DB Time (DBT) = sum over all sessions of time spent in a call. A call could be

executing SQLbackground work

DBWR writing blocksLGWR writing redo

Page 9: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.9

904/21/23 Copyright 2006 Kyle Hailey

Average Active Sessions

Centi-seconds per second In the dark ages waits were often as Centi-secs per

secSometimes called secs/secUsually didn’t include CPU time, which is essential

Average Active Sessions (AAS)OEM 10g GraphsASH Report

Session Load I often refer to it this way

Page 10: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.10

1004/21/23 Copyright 2006 Kyle Hailey

AAS Average load of sessions on the database

Average over 15 secs in OEM 10g Period varies in other tools measured in number of sessions

Active Sessions Only Active sessions put load the database Inactive Sessions don’t put load ( Except for memory usage )

The Golden Metric Powerful Multidimensional Indispensable

Page 11: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.11

1104/21/23 Copyright 2006 Kyle Hailey

AAS Sources1. Manually from

v$sysstat (9i ) v$system_event

2. Statspack Need several calculations

3. AWR One calculation

4. OEM 10g

Directly displayed

Page 12: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.12

Copyright 2006 Kyle Hailey

1. Manually

DB Time (DBT) = sum active session time

DB TIME (10g) =

DB TIME (9i) =Select sum(time_waited) from v$system_event where event not in ( ... idle events …);+Select value from v$sysstat where name = ‘CPU used by this session’;

Select sum(time_waited) from v$system_event where event not in ( ... idle events …);+Select value from v$sysstat where name = ‘CPU used by this session’;

select value from v$sysstat where name = ‘DB time’;

select value from v$sysstat where name = ‘DB time’;‘DB time’

Page 13: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.13

1304/21/23 Copyright 2006 Kyle Hailey

2. Statspack AAS

Look forElapsed TimeTop 5 Timed Events

Start at line 52 of about 1300!Start at line 52 of about 1300!

Page 14: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.14

Copyright 2006 Kyle Hailey

AWR/Statspack: Cheat Sheet

InstallConnect as SYSDBA@?/rdbms/admin/spcreate.sql

RunExec statspack.snap;

Generate Reports@?/rdbms/admin/spreport.sql

Page 15: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.15

1504/21/23 Copyright 2006 Kyle Hailey

2. Statspack AAS

Elapsed Time

Look at Top 5 Timed EventsTop 5 Timed EventsTop 5 Timed Events~~~~~~~~~~~~~~~~~~ % Total~~~~~~~~~~~~~~~~~~ % TotalEvent Waits Time (s) Call TimeEvent Waits Time (s) Call Time

--------------------- --------- --------- ---------------------------- --------- --------- -------

buffer busy waits 2,748 250 78.72buffer busy waits 2,748 250 78.72CPU time 32 10.16CPU time 32 10.16free buffer waits 1,588 15 4.63free buffer waits 1,588 15 4.63write complete waits 10 8 2.51write complete waits 10 8 2.51log buffer space 306 5 1.51log buffer space 306 5 1.51

Top 5 Timed EventsTop 5 Timed Events~~~~~~~~~~~~~~~~~~ % Total~~~~~~~~~~~~~~~~~~ % TotalEvent Waits Time (s) Call TimeEvent Waits Time (s) Call Time

--------------------- --------- --------- ---------------------------- --------- --------- -------

buffer busy waits 2,748 250 78.72buffer busy waits 2,748 250 78.72CPU time 32 10.16CPU time 32 10.16free buffer waits 1,588 15 4.63free buffer waits 1,588 15 4.63write complete waits 10 8 2.51write complete waits 10 8 2.51log buffer space 306 5 1.51log buffer space 306 5 1.51

STATSPACK report for

DB Name DB Id Instance Inst Num Release RAC Host------- ----------- -------- -------- ---------- --- -------

LABSF03 1420044432 labsf03 1 10.1.0.2.0 NO labsfr

Snap Id Snap Time Sessions Curs/Sess

--------- ------------------ -------- ---------

Begin Snap: 1 03-Apr-06 12:34:06 18 5.6 End Snap: 2 03-Apr-06 12:34:36 18 4.8 Elapsed: 1.00 (mins)

STATSPACK report for

DB Name DB Id Instance Inst Num Release RAC Host------- ----------- -------- -------- ---------- --- -------

LABSF03 1420044432 labsf03 1 10.1.0.2.0 NO labsfr

Snap Id Snap Time Sessions Curs/Sess

--------- ------------------ -------- ---------

Begin Snap: 1 03-Apr-06 12:34:06 18 5.6 End Snap: 2 03-Apr-06 12:34:36 18 4.8 Elapsed: 1.00 (mins)

Page 16: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.16

1604/21/23 Copyright 2006 Kyle Hailey

2. Statspack AAS

DBTIME= CPU + WAITSCPU = 32 WAITS = 250+15+8+5 = 278 secs

DBTIME=320 Elapsed Time = 60 secs

320 secs / 60 secs

AAS = 5.1

Top 5 Timed EventsTop 5 Timed Events Event Time (s) Event Time (s) ----------------- ---------------------- -----buffer busy waits 250buffer busy waits 250CPU time 32CPU time 32free buffer waits 15free buffer waits 15write complete waits 8write complete waits 8log buffer spacelog buffer space 55

Top 5 Timed EventsTop 5 Timed Events Event Time (s) Event Time (s) ----------------- ---------------------- -----buffer busy waits 250buffer busy waits 250CPU time 32CPU time 32free buffer waits 15free buffer waits 15write complete waits 8write complete waits 8log buffer spacelog buffer space 55

Page 17: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.17

1704/21/23

3. AWR ReportAAS = DB Time/Elapsed Time

23.56/59.66 = 0.39

AAS= 0.39

Page 18: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.18

1804/21/23

4. OEM 10g

AAS = ~0.75

•OEM 10g

Page 19: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.19

1904/21/23 Copyright 2006 Kyle Hailey

Got AAS, Now What ?

We Need one more item:

CPU Count

# of CPUs available on System Shared with other applications

Need to track CPU used on the system as well

On dual & quad cores, lower the CPU count Represents max active sessions that can do work

Page 20: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.20

2004/21/23 Copyright 2006 Kyle Hailey

CPU Count # of CPUs available in

Statspack 10g AWR report OEM 10g

Statspack 9i # of CPUs missing # of CPUs

SQLPLUS> show parameters cpu_count

NAME VALUE------------------ ----------cpu_count 2

SQLPLUS> show parameters cpu_count

NAME VALUE------------------ ----------cpu_count 2

Page 21: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.21

2104/21/23 Copyright 2006 Kyle Hailey

AAS FormulasUse CPU count as yardstick:

< 1 Database is not blocked

AAS ~= 0 Database basically idleProblems are in the APP not DB

AAS < # of CPUsCPU availableDatabase is probably not blockedAre any single sessions 100% active?

AAS > # of CPUsCould have performance problems

AAS >> # of CPUSThere is a bottleneck

Ideal world – one databasesolution track CPU at OS

AAS > 1 still want to know if a single user is 100% active

Page 22: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.22

2204/21/23 Copyright 2006 Kyle Hailey

Available CPU vs AAS

AAS far above available CPU => problem

AAS = 5.1AAS = 5.1

# of CPU = 2# of CPU = 2

AAS = 0.39AAS = 0.39

# of CPU = 2# of CPU = 2

AAS < 1 , database is fine

Page 23: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.23

2304/21/23 Copyright 2006 Kyle Hailey

Going Farther with AAS AAS can tell you a lot But it’s components tell you much more To go farther need the components of AAS

1.CPU 2.Wait3.Value over time

Only OEM 10g has all 3(Statspack and AWR are aggregated over the snapshot period)

Page 24: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.24

Copyright 2006 Kyle Hailey

EM DB Home Page

Page 25: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.25

Copyright 2006 Kyle Hailey

OEM 10g Perf PagesDB Home DB Home

PerformancePerformance

AAS Point in TimeAAS Point in Time

AAS over TimeAAS over Time

Page 26: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.26

2604/21/23

AAS Components : OEM 10g

OEM 10g

Performance Page

Available CPU AAS:CPU + WAIT

Real CPU available:

Max CPU - non instance CPU

Page 27: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.27

2704/21/23

OEM 10g

Relax Relax Get to Work!Get to Work!Looks Looks OK OK

But …But …

Page 28: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.28

2804/21/23

Limited Analysis

What if you find a problem ?Of the 800 waits most need

SQL and/or P1,P2,P3

to solveWhat if there is a wait bottleneck ?

What SQLWhich sessionsValues of P1, P2 and P3Statspack and AWR fail

Example “easy” waits

free buffer waitslog buffer spacelog file switch (archiving needed)log file switch (checkpoint incomplete)log file switch completion

Example “hard” waits

Buffer busy waitRow cache lockLatch freerow lock contention Latch: cache buffers chains

Page 29: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.29

Copyright 2006 Kyle Hailey

Alternative AAS Calculations

AAS = DB TIME / Elapsed Time

But there is another wayBut there is another way … …

Page 30: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.30

3004/21/23 Copyright 2006 Kyle Hailey

AAS based on ASH

ASH - Active Session History v$active_session_history

AAS = count(*) / elapsed_secondsA statistical approximation, but surprisingly

close

ASH data source empowers drilldownsTop Sql Top WaitsDetails p1,p2,p3 and more

Page 31: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.31

3104/21/23 Copyright 2006 Kyle Hailey

AAS from ASH1. ASHRPT

Based entirely on v$active_session_history @?/rdbms/admin/ashrpt Exec ASH_REPORT_TEXT/HTML

2. OEM 10g Top Activity page Displays it directly Enables Drilldowns

3. Custom queries on v$active_session_history

select * from tableselect * from table(dbms_workload_repository.ash_report_text((dbms_workload_repository.ash_report_text( (select dbid from v$database),(select dbid from v$database), 1,1, sysdate – 1/24, sysdate – 1/24, sysdate )) ;sysdate )) ;

Page 32: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.32

3204/21/23 Copyright 2006 Kyle Hailey

1. ASHRPT

ASH Report For TESTDB/testdbASH Report For TESTDB/testdb

DB Name         DB Id    Instance     Inst Num Release     RAC HostDB Name         DB Id    Instance     Inst Num Release     RAC Host

------------ ----------- ------------ -------- ----------- --- ------------------------ ----------- ------------ -------- ----------- --- ------------

TESTDB        2371570538 testdb              1 10.2.0.1.0  NO  sdbe604aTESTDB        2371570538 testdb              1 10.2.0.1.0  NO  sdbe604a

CPUsCPUs           SGA Size       Buffer Cache        Shared Pool    ASH Buffer Size           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:01Analysis Begin Time:   21-Apr-06 12:00:01

                        Analysis End Time:   21-Apr-06 12:05:01Analysis End Time:   21-Apr-06 12:05:01

                                  Elapsed Time:         5.0 (mins)Elapsed Time:         5.0 (mins)

                                  Sample Count:       3,716Sample Count:       3,716

            Average Active Sessions:       12.39Average Active Sessions:       12.39

    Avg. Active Session per CPU:        6.19Avg. Active Session per CPU:        6.19

                                Report Target:   None specifiedReport Target:   None specified

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 ActiveAvg Active

Event                               Event Class     % Activity   SessionsEvent                               Event Class     % Activity   Sessions

----------------------------------- --------------- ---------- --------------------------------------------- --------------- ---------- ----------

CPU + Wait for CPU                  CPU                  67.98       8.42CPU + Wait for CPU                  CPU                  67.98       8.42

enq: TX - row lock contention       Application          23.98       2.97enq: TX - row lock contention       Application          23.98       2.97

buffer busy waits                   Concurrency           4.66       0.58buffer busy waits                   Concurrency           4.66       0.58

latch: cache buffers chains         Concurrency           2.26       0.28latch: cache buffers chains         Concurrency           2.26       0.28

ASH Report For TESTDB/testdbASH Report For TESTDB/testdb

DB Name         DB Id    Instance     Inst Num Release     RAC HostDB Name         DB Id    Instance     Inst Num Release     RAC Host

------------ ----------- ------------ -------- ----------- --- ------------------------ ----------- ------------ -------- ----------- --- ------------

TESTDB        2371570538 testdb              1 10.2.0.1.0  NO  sdbe604aTESTDB        2371570538 testdb              1 10.2.0.1.0  NO  sdbe604a

CPUsCPUs           SGA Size       Buffer Cache        Shared Pool    ASH Buffer Size           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:01Analysis Begin Time:   21-Apr-06 12:00:01

                        Analysis End Time:   21-Apr-06 12:05:01Analysis End Time:   21-Apr-06 12:05:01

                                  Elapsed Time:         5.0 (mins)Elapsed Time:         5.0 (mins)

                                  Sample Count:       3,716Sample Count:       3,716

            Average Active Sessions:       12.39Average Active Sessions:       12.39

    Avg. Active Session per CPU:        6.19Avg. Active Session per CPU:        6.19

                                Report Target:   None specifiedReport Target:   None specified

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 ActiveAvg Active

Event                               Event Class     % Activity   SessionsEvent                               Event Class     % Activity   Sessions

----------------------------------- --------------- ---------- --------------------------------------------- --------------- ---------- ----------

CPU + Wait for CPU                  CPU                  67.98       8.42CPU + Wait for CPU                  CPU                  67.98       8.42

enq: TX - row lock contention       Application          23.98       2.97enq: TX - row lock contention       Application          23.98       2.97

buffer busy waits                   Concurrency           4.66       0.58buffer busy waits                   Concurrency           4.66       0.58

latch: cache buffers chains         Concurrency           2.26       0.28latch: cache buffers chains         Concurrency           2.26       0.28

Page 33: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.33

3304/21/23 Copyright 2006 Kyle Hailey

1. ASH RPT

1) General info

2) Top User Events ***

3) Top Background Events

4) Top Event P1/P2/P3 Values

5) Top Service/Module

6) Top Client IDs

7) Top SQL Command Types

8) Top SQL Statements ***

1) General info

2) Top User Events ***

3) Top Background Events

4) Top Event P1/P2/P3 Values

5) Top Service/Module

6) Top Client IDs

7) Top SQL Command Types

8) Top SQL Statements ***

9) Top SQL using literals

10) Top Sessions ***

11) Top Blocking Sessions

12) Top Sessions running PQs 

13) Top DB Objects

14) Top DB Files

15) Top Latches

16) Activity Over Time ***

9) Top SQL using literals

10) Top Sessions ***

11) Top Blocking Sessions

12) Top Sessions running PQs 

13) Top DB Objects

14) Top DB Files

15) Top Latches

16) Activity Over Time ***

Page 34: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.34

3404/21/23

1. ASHRPT over Time

Waits over TimeNot in AAS

Difficult but better

than nothing

Compare to …

Page 35: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.35

3504/21/23

2. OEM 10g : Top Activity•Top Activity

•Based on ASH•Enables Drilldowns

•Top SQL•Top Session

•Drill into a session• Stats• Raw waits• Open cursors• General info

•Drill into a SQL• Stats and text• Users executing• Explain plan• Tuning options

Page 36: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.36

3604/21/23

3. Custom Scripts

Hate Graphics ? Query v$active_session_history directlyJoin to dba_hist_active_sess_history for week of data

act.sqlLike top 5 timed events

Aveact.sqlCharts with text AAS by hour (15 minute, minute , etc)

Aveactn.sqlDitto, with top 2 wait events per bucket

Following Scripts Available onhttp://perfvision.com/ashscripts.php

Page 37: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.37

3704/21/23 Copyright 2006 Kyle Hailey

3. Custom Scripts@actAnalysis Begin Time :   2007-07-24 11:04:48Analysis End   Time :   2007-07-24 11:19:45Start time, mins ago:           15Request Duration    :           15Collections         :          528Data Values         :         3327Elapsed Time:  15 mins

WAIT_EVENT                         CNT   % Active Ave_Act_Sess

-------------------------------------- ---------- ------------

latch free                      10         .3          .02log buffer space                   13        .39          .02buffer busy waits                   14        .42          .03db file scattered read              15        .45          .03library cache pin                   78       2.34          .15log file sync                      213       6.40          .40ON CPU                             726      21.82         1.38enqueue                            855      25.70        1.62db file sequential read           1399      42.05         2.65

                                                 ------------

sum                                                       6.30

@actAnalysis Begin Time :   2007-07-24 11:04:48Analysis End   Time :   2007-07-24 11:19:45Start time, mins ago:           15Request Duration    :           15Collections         :          528Data Values         :         3327Elapsed Time:  15 mins

WAIT_EVENT                         CNT   % Active Ave_Act_Sess

-------------------------------------- ---------- ------------

latch free                      10         .3          .02log buffer space                   13        .39          .02buffer busy waits                   14        .42          .03db file scattered read              15        .45          .03library cache pin                   78       2.34          .15log file sync                      213       6.40          .40ON CPU                             726      21.82         1.38enqueue                            855      25.70        1.62db file sequential read           1399      42.05         2.65

                                                 ------------

sum                                                       6.30

Page 38: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.38

3804/21/23 Copyright 2006 Kyle Hailey

3. Custom Scripts@aveactTM NPTS AVEACT GRAPH CPU WAITS---------------- ------ ------- ---------------------- ---- -----06-AUG 13:00:00 270 .33 +- 2 29 5906-AUG 14:00:00 1040 2.24 ++--------2--- 341 198406-AUG 15:00:00 623 6.67 ++++------2---------- 438 371806-AUG 16:00:00 1088 2.59 ++--------2---- 335 248606-AUG 17:00:00 1104 1.26 ++----- 2 349 104306-AUG 18:00:00 1093 1.38 +++---- 2 663 84206-AUG 19:00:00 1012 1.74 ++------- 2 373 138806-AUG 20:00:00 1131 .99 +---- 2 304 82006-AUG 21:00:00 1111 1.22 ++----- 2 344 101206-AUG 22:00:00 1010 1.66 ++------ 2 414 125906-AUG 23:00:00 1120 1.08 +---- 2 298 91307-AUG 00:00:00 1024 .83 +--- 2 273 57607-AUG 01:00:00 1006 1.74 ++------- 2 319 142807-AUG 02:00:00 1090 2.47 ++--------2---- 347 234507-AUG 03:00:00 687 6.59 +++-------2---------- 382 414207-AUG 04:00:00 1004 1.95 ++++++--- 2 1299 65907-AUG 05:00:00 1104 3.08 +++++-----2------ 1170 222607-AUG 06:00:00 1122 1.91 +++++++-- 2 1582 558

@aveactTM NPTS AVEACT GRAPH CPU WAITS---------------- ------ ------- ---------------------- ---- -----06-AUG 13:00:00 270 .33 +- 2 29 5906-AUG 14:00:00 1040 2.24 ++--------2--- 341 198406-AUG 15:00:00 623 6.67 ++++------2---------- 438 371806-AUG 16:00:00 1088 2.59 ++--------2---- 335 248606-AUG 17:00:00 1104 1.26 ++----- 2 349 104306-AUG 18:00:00 1093 1.38 +++---- 2 663 84206-AUG 19:00:00 1012 1.74 ++------- 2 373 138806-AUG 20:00:00 1131 .99 +---- 2 304 82006-AUG 21:00:00 1111 1.22 ++----- 2 344 101206-AUG 22:00:00 1010 1.66 ++------ 2 414 125906-AUG 23:00:00 1120 1.08 +---- 2 298 91307-AUG 00:00:00 1024 .83 +--- 2 273 57607-AUG 01:00:00 1006 1.74 ++------- 2 319 142807-AUG 02:00:00 1090 2.47 ++--------2---- 347 234507-AUG 03:00:00 687 6.59 +++-------2---------- 382 414207-AUG 04:00:00 1004 1.95 ++++++--- 2 1299 65907-AUG 05:00:00 1104 3.08 +++++-----2------ 1170 222607-AUG 06:00:00 1122 1.91 +++++++-- 2 1582 558

Page 39: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.39

3904/21/23 Copyright 2006 Kyle Hailey

3. Custom Scripts

@aveactnTO_CHAR(STA AAS AAS1 FIRST AAS2 SECOND GRAPH

----------- ------- ----- --------------- ----- --------------- ------------------------06 13:00:00 .30 .11 db file sequent .10 CPU - 206 14:00:00 2.24 .87 direct path wri .49 log file sync ++--------2---06 15:00:00 6.67 2.07 direct path wri 1.93 log file sync ++++------2----------06 16:00:00 2.59 1.01 direct path wri .57 log file sync ++--------2----06 17:00:00 1.26 .63 log file sync .32 CPU ++----- 206 18:00:00 1.38 .61 CPU .45 log file sync +++---- 206 19:00:00 1.86 .97 log file sync .39 CPU ++------- 206 20:00:00 .99 .38 log file sync .27 CPU +---- 206 21:00:00 1.22 .57 log file sync .31 CPU ++----- 206 22:00:00 1.66 .81 log file sync .41 CPU ++------ 206 23:00:00 1.08 .49 log file sync .27 CPU +---- 207 00:00:00 .83 .37 log file sync .27 CPU +--- 207 01:00:00 1.74 .96 log file sync .31 CPU ++------- 207 02:00:00 2.48 1.21 direct path wri .52 log file sync ++--------2----07 03:00:00 6.59 2.63 direct path wri 1.58 log file sync +++-------2----------07 04:00:00 1.95 1.29 CPU .27 log file sync ++++++--- 207 05:00:00 3.08 1.05 CPU .83 enqueue +++++-----2------

@aveactnTO_CHAR(STA AAS AAS1 FIRST AAS2 SECOND GRAPH

----------- ------- ----- --------------- ----- --------------- ------------------------06 13:00:00 .30 .11 db file sequent .10 CPU - 206 14:00:00 2.24 .87 direct path wri .49 log file sync ++--------2---06 15:00:00 6.67 2.07 direct path wri 1.93 log file sync ++++------2----------06 16:00:00 2.59 1.01 direct path wri .57 log file sync ++--------2----06 17:00:00 1.26 .63 log file sync .32 CPU ++----- 206 18:00:00 1.38 .61 CPU .45 log file sync +++---- 206 19:00:00 1.86 .97 log file sync .39 CPU ++------- 206 20:00:00 .99 .38 log file sync .27 CPU +---- 206 21:00:00 1.22 .57 log file sync .31 CPU ++----- 206 22:00:00 1.66 .81 log file sync .41 CPU ++------ 206 23:00:00 1.08 .49 log file sync .27 CPU +---- 207 00:00:00 .83 .37 log file sync .27 CPU +--- 207 01:00:00 1.74 .96 log file sync .31 CPU ++------- 207 02:00:00 2.48 1.21 direct path wri .52 log file sync ++--------2----07 03:00:00 6.59 2.63 direct path wri 1.58 log file sync +++-------2----------07 04:00:00 1.95 1.29 CPU .27 log file sync ++++++--- 207 05:00:00 3.08 1.05 CPU .83 enqueue +++++-----2------

Page 40: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.40

4004/21/23 Copyright 2006 Kyle Hailey

Samples VS Counters

CountersCounters

SamplesSamples

Slight LagsSlight Lags

v$system_eventv$system_event

v$active_session_historyv$active_session_history

Page 41: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.41

4104/21/23 Copyright 2006 Kyle Hailey

CPU in ASH vs Stats

Page 42: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.42

4204/21/23 Copyright 2006 Kyle Hailey

In Review: Two Sources

1. v$system_event & v$sysstat Indirect Accurate Lags (especially CPU) Limits analysis

2. v$active_session_history Direct Real time Approximation ***Allows drilldowns***

Page 43: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.43

Copyright 2006 Kyle Hailey

The Power ASH gives AASDB Home DB Home

PerformancePerformance

Top ActivityTop Activity

ASHASH

eventseventsstatisticsstatistics

Page 44: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.44

Copyright 2006 Kyle Hailey

ASH in OEM

Top Activity gives Top Activity gives more informationmore information

Page 45: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.45

Copyright 2006 Kyle Hailey

Top Activity : Based on ASH

missingmissing

Thanks Thanks

To To

ASHASH

Page 46: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.46

Copyright 2006 Kyle Hailey

Top Activity : ASH Dimensions

Page 47: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.47

Copyright 2006 Kyle Hailey

AAS – %Session Time Issue

Shown in % DB TimeShown in % DB TimeMissing % Session TimeMissing % Session Time

Page 48: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.48

Copyright 2006 Kyle Hailey

Top Activity: ASH Sessions

Many Users Active Many Users Active

On Performance Page, no way to tell how many usersOn Performance Page, no way to tell how many users

But Top Activity Page fixes thatBut Top Activity Page fixes that

Page 49: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.49

Copyright 2006 Kyle Hailey

Top Activity: ASH Sessions

Two Users ActiveTwo Users Active

Page 50: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.50

Copyright 2006 Kyle Hailey

OEM 10g Perf PagesDB Home DB Home

PerformancePerformance

Top ActivityTop Activity

SQLSQLSessionSession

Page 51: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.51

Copyright 2006 Kyle Hailey

OEM 10g Perf Pages

Top ActivityTop Activity

SQLSQLSessionSession

Page 52: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.52

Copyright 2006 Kyle Hailey

Session : ASH Activity

Page 53: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.53

Copyright 2006 Kyle Hailey

SQL : ASH Activity

Page 54: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.54

Copyright 2006 Kyle Hailey

Getting the Most out of AAS Need to know the System’s Profile What your application is like?

Data Warehouse OLTP Typical load

Once you get to know it you can see anomalies Is AAS near 0 when it should be higher Is that Data Warehouse query running normal

Do you know what it looks like? Is there an unusual bottleneck

Page 55: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.55

Copyright 2006 Kyle Hailey

Knowing your DB Profile

Page 56: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.56

Copyright 2006 Kyle Hailey

When to tune?

General rules of Thumb Waits >> CPU CPU > Max CPU

Page 57: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.57

Copyright 2006 Kyle Hailey

Waits > CPU

Page 58: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.58

Copyright 2006 Kyle Hailey

CPU > Max CPU

Page 59: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.59

Copyright 2006 Kyle Hailey

Idle Database

Value of proving the database is Idle It’s the Databases Fault

How many times do you hear that? Database Idle

No load on databaseDatabase “performance” is fine

Under utilized

Problem lies elsewhere Saved me time and stress many times

Page 60: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.60

Copyright 2006 Kyle Hailey

Idle Database – Perf Page

Page 61: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.61

Copyright 2006 Kyle Hailey

Idle Database – Top Activity

Page 62: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.62

Copyright 2006 Kyle Hailey

Harnessing AAS Statspack/AWR report

Lacking Statspack free and any version AWR automatically installed in10g Both

Needs numerical massaging Lacking detailed SQL and Session info

OEM 10g Clearest, easiest, most powerful Overview

Load chart - AAS 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

Page 63: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.63

Copyright 2006 Kyle Hailey

OEM 10g Perf PagesDB Home DB Home

PerformancePerformance

Top ActivityTop Activity

SQLSQLSessionSession

Page 64: Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey .

#.64

Copyright 2006 Kyle Hailey

In summary

AAS is simple and Powerful AAS’s components are even more powerful

CPUWAITValue over Time

Use # of CPUs as a yardstick Know your application load profile to see

anomalies Monitor AAS with OEM 10g