+ All Categories
Home > Documents > Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean...

Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean...

Date post: 12-Jan-2016
Category:
Upload: daisy-whitehead
View: 223 times
Download: 0 times
Share this document with a friend
Popular Tags:
43
Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software
Transcript
Page 1: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

Wait-Time Based Oracle Performance Management

Prepared for Ohio Oracle User Group

Presented by Dean Richards Senior Engineer, Confio Software

Page 2: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

2

Who is Dean Richards?

Senior DBA/Engineer for Confio Software Former DBA performance consultant

with Oracle for five years Specialize in performance tuning using

Oracle Wait Event interface Review performance of Oracle

databases at hundreds of customers each year

Page 3: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

3

Agenda

Confio Performance Intelligence Case Study One: Hot Block Issue Case Study Two: Full Table Scans Case Study Three: Inefficient Indexes Q&A

Page 4: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

4

Working the Right Problems?

After spending an agonizing week tuning Oracle to minimize I/O operations, management typically rewards you with:

• A. An all expense paid vacation• B. A free lunch • C. Crumbs from the kitchen• D. Reward? Nobody even noticed!

Page 5: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

5

Why Does This Happen?

Many tools measure system health Assumption: If I make the database

healthy, users benefit Symptoms

• DBA finds “big” problem and fixes it, users report no impact

• Lots of data to review and things to fix, not sure which to do first

• Unclear view of performance leads to Finger-pointing

Developer or vendor

It’s your Code!

It’s your Database!

IT staff

Page 6: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

6

Confio Performance Intelligence

Three Key Principles

1. SQL View: All statistics at SQL statement level

2. Full View: Separately measure every resource (Oracle wait events) to isolate source of problems

3. Time View: Measure Time, not number of times a resource is utilized

Page 7: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

8

SQL View Principle

Example: ‘CEO’ measuring ‘employee’ output Averaging over entire company gives no useful data Must measure each job separately DBA must manage database similarly Measure and identify bottlenecks for each SQL

independently

Page 8: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

9

Time View Principle

Example: ‘CEO’ counting ‘tasks’ vs. ‘time to complete’ Counting system statistics not meaningful Must measure Time to complete System stats (buffer size, hit ratios, I/O counts) do not

identify where database customers are waiting Identify and optimize Wait Time for each SQL as best

indicator of performance

Page 9: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

10

Full View Principle

Example: ‘CEO’ measuring results with blind spot hiding key processes

Without direct visibility, valuable info is lost Must have visibility to every process step Distinctly identify and measure each Oracle resource for

each distinct SQL

Page 10: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

11

Compliant Performance Tool Types

Two Primary Types of Tools

Session Specific Tools• Tools that focus on one session at a time often by

tracing the process• Examples: OraSRP Profiler (open source), Hotsos

Profiler, tkprof

Continuous DB Wide Monitoring Tools• Tools that focus on all sessions by sampling Oracle• Examples: Confio Ignite, Symantec i3

Both tools have a place in the organization

Page 11: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

12

Tracing

Use cautiously due to session statistics skew• 95 out of 100 users are running well• 5 out of 100 have spent 99% of time waiting for

locked rows• If you trace one of the “95” sessions

– No locking problems at all – May spend time trying to tune other items that may not be

important

• If you trace one of the “5” sessions– Severe locking problems– Appears that you could fix the locking problems and reduce

your wait time by 99%

Page 12: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

13

Tracing (cont)

Advantages• Very precise - may be only way to get some

statistics• Bind variable information is available• Can provide detailed analysis even deeper

than wait events

Disadvantages• Only works if a known problem is going to

occur in the future (and known session)• Difficult to see trends over time

Page 13: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

14

Continuous DB Wide Monitoring Tools

24/7 sampling provides real-time and historical perspective

Allows DBA to go back in time• I had a problem at 3:00 pm yesterday

Use Performance Intelligence - trend reports, graphs, etc to communicate with other groups• What is starting to perform poorly?• What progress have we made while tuning?

Page 14: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

15

Oracle Wait Interface

V$SESSION_WAIT (X$KSUSECST)• SID (join to v$session)• EVENT• P1, P1RAW, P2, P2RAW, P3, P3RAW• STATE = ‘WAITING’ – currently waiting on event• STATE = ‘WAITED…’ – currently on CPU (or in

queue)

Oracle 10g added this info to V$SESSION

Page 15: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

16

Oracle Sessions

V$SESSION (X$KSUSE)• SID• USERNAME• SQL_HASH_VALUE

– Join to V$SQL

• PROGRAM• MODULE / ACTION

– DBMS_APPLICATION_INFO

• PLAN_HASH_VALUE– Join to V$SQL_PLAN

Page 16: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

17

Base Query

SELECT

sid, username, program, module, action,

machine, osuser, sql_hash_value, …

decode(state, ‘WAITING’, event, ‘CPU’) event,

p1, p1raw, p2, …,

SYSDATE

FROM V$SESSION s

WHERE s.status = ‘ACTIVE’

AND event NOT IN (<idle wait events>);

Page 17: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

18

Additional Information

V$SESSION• service_name, machine, client_info• row_wait_obj#, blocking_session

Go back later to get• Sql_text from v$sql• SQL stats from v$sqlarea• Execution plan from v$sql_plan• Object info from dba_objects

Page 18: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

Case Study OneHot Block Issue

Page 19: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

23

Problem Observed

Critical situation: application performance unsatisfactory• All email coming into and going out of the

company was tracked in order to find:– Viruses– Espionage– Legal reasons

• However, email was getting behind• Email not getting to end-users for several

hours• Declared top priority in company

Page 20: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

24

Wait Events During Problem

Buffer busy waits

Query that is doing “real” work

Log file waits

Page 21: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

25

What do we know?

Which SQL: DDL or CommitsSQL hash_value=0

Which Resource: buffer busy waitslog file waits

How much time: 163 Hours of wait time per day

Page 22: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

26

“buffer busy waits” Description

Buffer is being read into cache by another session and this session is waiting for that process to complete.• In Oracle 10g buffer busy waits are further

refined and this becomes “read by other session”

Buffer is already in the cache but in an incompatible mode, i.e. another session is changing it.

Page 23: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

27

“buffer busy waits” Description

P1 – file number information P2 – block number information

SELECT owner, segment_name, segment_type

FROM   dba_extents

WHERE file_id = &P1

AND &P2 BETWEEN block_id AND block_id + blocks -1

Gives information about the object being waited for

Page 24: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

29

“buffer busy waits” Analysis

Page 25: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

30

Results

Found hot block problem• “buffer busy waits” was waiting for Block

#2 in the file “…staging01.dbf”• The email processing code was creating a

series of staging tables, every time it executed

Solutions• Started using temporary tables vs.

create/drop distinct tables each time the process ran

Page 26: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

Case Study Two DB File Scattered Reads

Page 27: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

32

Problem Observed

Problem: Login taking 12 minutes for each user when they started their day• High wait accumulation from 6:30 – 8:30 am• 240 Users X 12 Minutes = 48 Hours Every Day• 6 employees wasted time per day• $400,000+ wasted per year

Applied Confio methods to problem identification• Identify Wait Time, offending SQL, offending

Resource

Page 28: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

33

Wait Events During Problem

Page 29: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

34

Investigation

Page 30: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

35

What do we know?

Which SQL: LoginLookupUpdateInventory

Which Resource: scattered readbuffer busy waits

How much time: 48+ HoursEvery Day

Page 31: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

36

Hypotheses: Oracle Interpretations

Key Questions: 1. Is full table scan necessary?2. What causes a full table scan for this SQL

Statement?

Two Alternative paths for optimization:I. Eliminate Full Table Scan

1. Add Index / Collect Histograms2. Update Statistics3. Utilize Query Hints

II. Full Table Scan Required - Improve response time

1. Parallelized Reads2. Optimize I/O Subsystem3. Optimize Application

Page 32: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

44

Results

Added indexes to underlying tables Added Materialized View

Full Table Scan Fixed

Page 33: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

Case Study Three DB File Sequential Reads

Page 34: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

46

Problem Observed

Data Warehouse loads were taking too long

Noticed high wait times on “db file sequential read” wait event

DBAs were confused – why are data loads “reading” data

Applied Confio Method to problem identification• Identify Wait Time, offending SQL, offending

Resource

Page 35: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

47

Investigation

Page 36: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

48

Investigation for an INSERT Statement

Sequential read time by object for SQL

Page 37: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

49

What do we know?

Which SQL: Load Process

Which Resource: DB File Sequential Read

How much time: 5 hour+ 90% of wait time

Page 38: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

50

Investigating db file sequential reads

Often considered a “good” read DB file sequential reads normally occur

during index lookups Often a single-block read although it

may retrieve more than one block. • P1 – file id• P2 – block id• Join to DBA_EXTENTS (see buffer busy waits)

Page 39: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

51

Hypotheses: Oracle Interpretations of Sequential Reads

Causes of excessive wait times: Reading too many index leaf blocks Low cardinality first column index Not finding block in buffer cache

forces disk read Slow disk reads Contention for certain blocks

Page 40: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

56

Results

Many sessions were loading data and all were updating low cardinality indexes

Modified index and noticed a 50% performance improvement in an INSERT

Customer is also analyzing global vs. local indexes

Reviewing usage of bitmap indexes Removed unused indexes Enhanced the disk subsystem

Page 41: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

70

Conclusion

Conventional Tuning focus on “system health” and lead to finger-pointing and confusion

Wait event tuning implemented according to Confio Performance Intelligence is the best way to tune

Two compliant tools types• Tracing tools• Continuous DB-wide monitoring tools

Page 42: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

71

About Confio Software

Developer of Performance Tools Igniter Suite

• Ignite for Oracle, DB2, SQL Server, Sybase• Ignite for Java

Packaged, easy-to-use implementation of Wait Time Performance Tuning

Based in Colorado, 100’s of worldwide customers

Free trial at www.confio.com

Page 43: Wait-Time Based Oracle Performance Management Prepared for Ohio Oracle User Group Presented by Dean Richards Senior Engineer, Confio Software.

72

Thank you for coming

Dean Richards

Stop by the Confio Booth

Contact Information• [email protected]• 303-938-8282 ext. 116• Company website

http://www.confio.com


Recommended