rmoug 2012 - mining the awr

101
Mining the AWR repository for Capacity Planning, Visualization, & other real world stuff Presented by: Karl Arao

Upload: karlarao

Post on 17-Jun-2015

2.582 views

Category:

Technology


9 download

TRANSCRIPT

Page 1: RMOUG 2012 - Mining the AWR

Mining the AWR repository for Capacity Planning,

Visualization, & other real world stuff

Presented by: Karl Arao

Page 2: RMOUG 2012 - Mining the AWR

Who am I?

• Karl Arao, Oracle ACE, OCP-DBA, RHCE• Currently @ Enkitec - Senior Technical Consultant • Formerly @ SQL*Wizard - Solutions Architect• Blog: http://karlarao.wordpress.com• Wiki: http://karlarao.tiddlyspot.com

Page 3: RMOUG 2012 - Mining the AWR

What will I talk about?

Page 4: RMOUG 2012 - Mining the AWR
Page 5: RMOUG 2012 - Mining the AWR

Overwhelming

Page 6: RMOUG 2012 - Mining the AWR

AWR HELL

Page 7: RMOUG 2012 - Mining the AWR
Page 8: RMOUG 2012 - Mining the AWR

DBA_HIST_* views

Page 9: RMOUG 2012 - Mining the AWR

My first close encounter

Page 10: RMOUG 2012 - Mining the AWR

gc block lost – sudden slow down

http://karlarao.wordpress.com/2009/06/07/diagnosing-and-resolving-gc-block-lost

Page 11: RMOUG 2012 - Mining the AWR

gc block lost – sudden slow down

http://karlarao.wordpress.com/2009/06/07/diagnosing-and-resolving-gc-block-lost

Page 12: RMOUG 2012 - Mining the AWR

gc block lost – sudden slow down

http://karlarao.wordpress.com/2009/06/07/diagnosing-and-resolving-gc-block-lost

Page 13: RMOUG 2012 - Mining the AWR

gc block lost – sudden slow down

http://karlarao.wordpress.com/2009/06/07/diagnosing-and-resolving-gc-block-lost

Page 14: RMOUG 2012 - Mining the AWR

After gc block lost – normal workload

http://karlarao.wordpress.com/2009/06/07/diagnosing-and-resolving-gc-block-lost

Page 15: RMOUG 2012 - Mining the AWR

Utilization = Requirement / Capacity

Page 16: RMOUG 2012 - Mining the AWR

Double Y Axis Graph

Page 17: RMOUG 2012 - Mining the AWR

t0 -------------------------------------> t1335 – 336 – 337 – 338 – 339

Page 18: RMOUG 2012 - Mining the AWR
Page 19: RMOUG 2012 - Mining the AWR
Page 20: RMOUG 2012 - Mining the AWR
Page 21: RMOUG 2012 - Mining the AWR
Page 22: RMOUG 2012 - Mining the AWR
Page 23: RMOUG 2012 - Mining the AWR
Page 24: RMOUG 2012 - Mining the AWR

delta issue

Page 25: RMOUG 2012 - Mining the AWR
Page 26: RMOUG 2012 - Mining the AWR
Page 27: RMOUG 2012 - Mining the AWR
Page 28: RMOUG 2012 - Mining the AWR

AWR Scripts

Page 29: RMOUG 2012 - Mining the AWR

Visualization

Page 30: RMOUG 2012 - Mining the AWR

Can’t go back in time?

Page 31: RMOUG 2012 - Mining the AWR

AAS – Average Active SessionsKyle Hailey: http://www.perfvision.com/ftp/class/02_AAS.ppt

Max CPU

Max CPU

Page 32: RMOUG 2012 - Mining the AWR

AAS – the Golden MetricAAS & CPU count as a yardstick for a possible performance problem: if AAS < 1 -- Database is not blocked AAS ~= 0 -- Database basically idle -- Problems are in the APP not DB AAS < # of CPUs -- CPU available -- Database is probably not blocked -- Are any single sessions 100% active? AAS > # of CPUs -- Could have performance problems AAS >> # of CPUS -- There is a bottleneck

Page 33: RMOUG 2012 - Mining the AWR

AAS from V$ACTIVE_SESSION_HISTORYAAS = Sample Count / Elapsed Time = 19410 / 600 = 32.35

CPU count = 4

Page 34: RMOUG 2012 - Mining the AWR

AAS from DBA_HIST_ACTIVE_SESS_HISTORYAAS = (Sample Count * 10) / Elapsed Time = (1950 * 10) / 600 = 32.5

CPU count = 4

Page 35: RMOUG 2012 - Mining the AWR

AAS from AWR ReportAAS = DB Time / Elapsed Time = 291.81 / 9.10 = 32.07

CPU count = 4

Page 36: RMOUG 2012 - Mining the AWR

AAS from AWR Top EventsAAS = DB Time / Elapsed Time 291.81 / 9.10 = 32.07

AAS = Event Time / Elapsed Time 17410 / 546 = 31.9

CPU count = 4

Page 37: RMOUG 2012 - Mining the AWR

awr_topevents.sql

Page 38: RMOUG 2012 - Mining the AWR

Textual trends

Page 39: RMOUG 2012 - Mining the AWR
Page 40: RMOUG 2012 - Mining the AWR
Page 41: RMOUG 2012 - Mining the AWR
Page 42: RMOUG 2012 - Mining the AWR

AAS on CPU bound workloadCPU count = 4

load average = 100+

Page 43: RMOUG 2012 - Mining the AWR
Page 44: RMOUG 2012 - Mining the AWR
Page 45: RMOUG 2012 - Mining the AWR
Page 46: RMOUG 2012 - Mining the AWR
Page 47: RMOUG 2012 - Mining the AWR

DB Timesnap0 snap1

Direct Path Read

runqueue

CPU

Direct Path Read

runqueue

CPU

Direct Path Read

runqueue

CPU

Direct Path Read

runqueue

CPU

Direct Path Read

CPU

Page 48: RMOUG 2012 - Mining the AWR

DB Timesnap0 snap1

Direct Path Read

CPU

Direct Path Read

CPU

Direct Path Read

CPU

Direct Path Read

CPU

Direct Path Read

CPU

dba_hist_system_event • Will always account for the waits

dba_hist_sys_time_model• ASH will see the session as ON CPU when on run queue but time model only counts

real CPU cycles• When database foreground goes from on-CPU to on-run queue to on-CPU the time

spent on run queue will be added to DB Time but not visible in DB CPU or in any wait event

Page 49: RMOUG 2012 - Mining the AWR

CPU Wait = DB Time – ( sum(events) + DB CPU )

DB Timesnap0 snap1

Direct Path Read

CPUWait

CPU

Direct Path Read

CPUWait

CPU

Direct Path Read

CPUWait

CPU

Direct Path Read

CPUWait

CPU

Direct Path Read

CPU

CPU wait is the “unaccounted for DB Time” similar to

the “unaccounted-for time” in 10046 trace brought by CPU starvation

Page 50: RMOUG 2012 - Mining the AWR

http://karlarao.tiddlyspot.com/#%5B%5BAAS%20investigation%5D%5D

Page 51: RMOUG 2012 - Mining the AWR

AAS throughout the AWR retention period!

http://karlarao.wordpress.com/2010/07/25/graphing-the-aas-with-perfsheet-a-la-enterprise-manager

Page 52: RMOUG 2012 - Mining the AWR

Capacity Planning

Page 53: RMOUG 2012 - Mining the AWR

Utilization is the ultimate metric!

Page 54: RMOUG 2012 - Mining the AWR

awr_genwl.sql

Page 55: RMOUG 2012 - Mining the AWR

http://karlarao.wordpress.com/2010/01/31/workload-characterization-using-dba_hist-tables-and-ksar

Page 56: RMOUG 2012 - Mining the AWR

U = R / C

Page 57: RMOUG 2012 - Mining the AWR

where aas > 1

Page 58: RMOUG 2012 - Mining the AWR

Filter the data points• AAS range

aas > 1

• Per SNAP_ID or range of SNAP_IDsid in (336)where id >= 336 and id <= 340

• Oracle CPU Utilizationoracpupct > 50

• OS CPU Utilizationoscpupct > 50

• Workload periods

AND TO_CHAR(s0.END_INTERVAL_TIME,'D') >= 1 -- Day of week: 1=Sunday 7=Saturday AND TO_CHAR(s0.END_INTERVAL_TIME,'D') <= 7 AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') >= 0900 -- Hour AND TO_CHAR(s0.END_INTERVAL_TIME,'HH24MI') <= 1800 AND s0.END_INTERVAL_TIME >= TO_DATE('2010-jan-17 00:00:00','yyyy-mon-dd hh24:mi:ss') -- Data range AND s0.END_INTERVAL_TIME <= TO_DATE('2010-aug-22 23:59:59','yyyy-mon-dd hh24:mi:ss‘)

Page 59: RMOUG 2012 - Mining the AWR
Page 60: RMOUG 2012 - Mining the AWR

core need = # of cores * utilization * 1.25Database Consolidation Best Practices

http://husnusensoy.files.wordpress.com/2010/05/database-consolidation-best-practices.pdf

Page 61: RMOUG 2012 - Mining the AWR
Page 62: RMOUG 2012 - Mining the AWR
Page 63: RMOUG 2012 - Mining the AWR

Total disk IOPS = (IOPS * Read Ratio) + (IOPS * Write Ratio * RAID penalty)

Number of disk = Total disk IOPS / IOPS per disk

Page 64: RMOUG 2012 - Mining the AWR
Page 65: RMOUG 2012 - Mining the AWR

awr_iowl.sql

Page 66: RMOUG 2012 - Mining the AWR

Average latency issue

60 minutes interval 10 minutes interval

Page 67: RMOUG 2012 - Mining the AWR

latency (ms) = (readtim / phy reads) * 10

Page 68: RMOUG 2012 - Mining the AWR

IO waits latency datafiles latency

SAN filesystem latency

Page 69: RMOUG 2012 - Mining the AWR

Linear Regression

Page 70: RMOUG 2012 - Mining the AWR
Page 71: RMOUG 2012 - Mining the AWR
Page 72: RMOUG 2012 - Mining the AWR
Page 73: RMOUG 2012 - Mining the AWR
Page 74: RMOUG 2012 - Mining the AWR

x data (CPU) = is the "independent value", used to predict the value of y

y data (AAS) = is the "dependent value", variable whose value is to be predicted

Page 75: RMOUG 2012 - Mining the AWR
Page 76: RMOUG 2012 - Mining the AWR
Page 77: RMOUG 2012 - Mining the AWR
Page 78: RMOUG 2012 - Mining the AWR
Page 79: RMOUG 2012 - Mining the AWR
Page 80: RMOUG 2012 - Mining the AWR

r2toolkit

Uses the following inbuilt Oracle functions:

•regr_count•regr_r2•regr_intercept•regr_slope

Page 81: RMOUG 2012 - Mining the AWR

r2toolkit

Page 82: RMOUG 2012 - Mining the AWR

Linear Regression – what’s the value?

Page 83: RMOUG 2012 - Mining the AWR

Linear Regression on 2 node RAChttp://karlarao.tiddlyspot.com/#r2project

racnode1 racnode2

Page 84: RMOUG 2012 - Mining the AWR

Drilling down on the peak workload... with AAS of 10

Page 85: RMOUG 2012 - Mining the AWR

Drilling down on the peak workload... with AAS of 10

Page 86: RMOUG 2012 - Mining the AWR
Page 87: RMOUG 2012 - Mining the AWR
Page 88: RMOUG 2012 - Mining the AWR
Page 89: RMOUG 2012 - Mining the AWR
Page 90: RMOUG 2012 - Mining the AWR

Now on the low workload period... with AAS of 2.2

Page 91: RMOUG 2012 - Mining the AWR

Now on the low workload period... with AAS of 2.2

Page 92: RMOUG 2012 - Mining the AWR
Page 93: RMOUG 2012 - Mining the AWR
Page 94: RMOUG 2012 - Mining the AWR
Page 95: RMOUG 2012 - Mining the AWR
Page 96: RMOUG 2012 - Mining the AWR

Recap

• Mine the beautiful data set

• Visualization tell a story immediately

• Statistics to make sense of data

Page 97: RMOUG 2012 - Mining the AWR

Let the AWR data set

change your mind set!

Page 98: RMOUG 2012 - Mining the AWR

Thank you!

Page 99: RMOUG 2012 - Mining the AWR

References and Tools• http://karlarao.wordpress.com

– http://karlarao.tiddlyspot.com/#%5B%5BStorage%20IOPS%2Ccapacity%2Cperformance%2Ccost%5D%5D

– http://karlarao.tiddlyspot.com/#Statistics– http://karlarao.tiddlyspot.com/#OraclePerformance

• Tanel Poder @ http://blog.tanelpoder.com– http://www.tanelpoder.com/files/TPT_public.zip– http://www.tanelpoder.com/files/PerfSheet.zip– Neil Gunther & Tanel Poder - Multidimensional Visualization of Oracle Performance using

Barry007 http://arxiv.org/pdf/0809.2532• Kyle Hailey @ http://ashmasters.com , http://www.perfvision.com• Craig Shallahamer @ orapub.com

– Introduction To Oracle Server Consolidationhttp://resources.orapub.com/product_p/server_consolidation_ppt.htm

• Husnu Sensoy @ husnusensoy.wordpress.com – Database Consolidation Best Practiceshttp://husnusensoy.files.wordpress.com/2010/05/database-consolidation-best-practices.pdf

• Andy Rivenes @ http://www.appsdba.com/pubs.htm• Neeraj Bhatia @ www.nioug.org/files/Linear_Regression.pdf

Page 100: RMOUG 2012 - Mining the AWR

Contact me through:

[email protected]

Page 101: RMOUG 2012 - Mining the AWR

101

Questions?

Fastest Growing Companies in Dallas