IO Waits Kyle Hailey [email protected]. #.2 Copyright 2006 Kyle Hailey Waits Covered in this...

28
IO Waits Kyle Hailey [email protected]

Transcript of IO Waits Kyle Hailey [email protected]. #.2 Copyright 2006 Kyle Hailey Waits Covered in this...

IO Waits

Kyle Hailey

[email protected]

Copyright 2006 Kyle Hailey

#.2

Waits Covered in this Section

db file sequential read db file scattered read db file parallel read direct path read direct path write sort segment request direct path write (lob) file open file identify

Copyright 2006 Kyle Hailey

#.3

IO Waits

Data FilesData Files

DBWRDBWR

Buffer Buffer CacheCache

User1User1

SGASGA

Library Library CacheCache

Log Log BufferBuffer

Copyright 2006 Kyle Hailey

#.4

Table/Index IO

db file sequential read db file scatted read db file parallel read

Copyright 2006 Kyle Hailey

#.5

db file sequential read : Diag

ShadowShadow

ProcessProcess

1) Search Buffer Cache for the block

2) Fails

3) Reads of disk

• File

• Block

Buffer CacheBuffer Cache

Copyright 2006 Kyle Hailey

#.6

db file sequential read : Wait #1 Top Wait Single Block Read

IndexData via and IndexData via Rowid RollbackAlso dumping headers, rebuilding controlfile

Sequential meansSequence from an IndexSequence from a rowid

Copyright 2006 Kyle Hailey

#.7

db file sequential read : Args P1 = File # P2 = Block # P3 = 1

Can be more than 1 for temporary segments

select segment_name,

segment_type

from dba_extents

where file_id = P1

and P2 between

block_id and block_id + blocks – 1;

select segment_name,

segment_type

from dba_extents

where file_id = P1

and P2 between

block_id and block_id + blocks – 1;

Copyright 2006 Kyle Hailey

#.8

db file scattered read : Diag

ShadowShadow

ProcessProcess

1) Search Buffer Cache for the blocks

2) Fails

3) Reads off disk

• File

• Block

• Multi Block Read Count

Buffer CacheBuffer Cache

Copyright 2006 Kyle Hailey

#.9

db file scattered read : Wait

# 3 Top Wait Event Multi Block Read

Full Table Scan Index Fast Full Scans

Scattered MeansBlocks are read and scattered throughout buffer

cache

Copyright 2006 Kyle Hailey

#.10

db file scattered read : Args

P1 = File # P2 = Block # P3 = # of Blocks to Read

select segment_name,

segment_type

from dba_extents

where file_id = P1

and P2 between

block_id and block_id + blocks – 1;

select segment_name,

segment_type

from dba_extents

where file_id = P1

and P2 between

block_id and block_id + blocks – 1;

Copyright 2006 Kyle Hailey

#.11

db file parallel read : Diag

ShadowShadow

ProcessProcess

1) Search Buffer Cache for the blocks

2) Fails

3) Reads that block off DiskBuffer CacheBuffer Cache

Copyright 2006 Kyle Hailey

#.12

db file parallel read : Wait

#18 Top Wait Process issues multiple single block reads in

parallelDocumentation says only for recoveryBut seems to happen for normal read ops as wellAsync Call – wait for all reads to complete

Copyright 2006 Kyle Hailey

#.13

db file parallel read: Args

P1 = # of files to read from P2 = # of total blocks to read P3 = # of I/O requests

Same value as P2

Copyright 2006 Kyle Hailey

#.14

IO Solutions If

Db scattered ReadDb file sequential ReadDb file parallel Read

ThenCheck average read times per file

Should be between 5-15 ms Data in Statspack under “File IO Stats”

Check Cache buffer Hit ratio Check db_cache_advice 9i and higher Data in Statspack under “Buffer Pool Advisory”

Tune High IO SQL

Copyright 2006 Kyle Hailey

#.15

IO Solutions : Ave Read TimeFile IO Stats DB/Inst: LABSF03/labsf03 Snaps: 1-2

->Mx Rd Bkt: Max bucket time for single block read

->ordered by Tablespace, File

Tablespace Filename------------------------ ----------------------------------------------------

Av Mx Av

Av Rd Rd Av Av Buffer BufWt

Reads Reads/s (ms) Bkt Blks/Rd Writes Writes/s Waits (ms)

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

SYSTEM /u01/app/oracle/oradata/labsf03/system01.dbf

445 15 0.4 16 1.0 1,157 39 2,744 93.3

USERS /u01/app/oracle/oradata/labsf03/users01.dbf

223 7 0.5 ### 1.0 9,725 324 4 100.0

File IO Stats DB/Inst: LABSF03/labsf03 Snaps: 1-2

->Mx Rd Bkt: Max bucket time for single block read

->ordered by Tablespace, File

Tablespace Filename------------------------ ----------------------------------------------------

Av Mx Av

Av Rd Rd Av Av Buffer BufWt

Reads Reads/s (ms) Bkt Blks/Rd Writes Writes/s Waits (ms)

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

SYSTEM /u01/app/oracle/oradata/labsf03/system01.dbf

445 15 0.4 16 1.0 1,157 39 2,744 93.3

USERS /u01/app/oracle/oradata/labsf03/users01.dbf

223 7 0.5 ### 1.0 9,725 324 4 100.0

Copyright 2006 Kyle Hailey

#.16IO Solutions : Buffer Pool Advisory

Buffer Pool Advisory Size for Size Buffers for Read EstimatedP Est (M) Factor Estimate Factor Physical Reads--- -------- ------ ------------ ------ --------------D 56 .1 6,986 2.3 58,928D 112 .2 13,972 1.6 42,043D 224 .4 27,944 1.0 25,772D 336 .6 41,916 1.0 25,715D 448 .8 55,888 1.0 25,715D 596 1.0 74,351 1.0 25,715D 728 1.2 90,818 1.0 25,715D 840 1.4 104,790 1.0 25,715D 952 1.6 118,762 1.0 25,715D 1,064 1.8 132,734 1.0 25,715

Buffer Pool Advisory Size for Size Buffers for Read EstimatedP Est (M) Factor Estimate Factor Physical Reads--- -------- ------ ------------ ------ --------------D 56 .1 6,986 2.3 58,928D 112 .2 13,972 1.6 42,043D 224 .4 27,944 1.0 25,772D 336 .6 41,916 1.0 25,715D 448 .8 55,888 1.0 25,715D 596 1.0 74,351 1.0 25,715D 728 1.2 90,818 1.0 25,715D 840 1.4 104,790 1.0 25,715D 952 1.6 118,762 1.0 25,715D 1,064 1.8 132,734 1.0 25,715

Copyright 2006 Kyle Hailey

#.17

IO Solutions

After CheckingFile IO response timesBuffer Cache Hit Ratio

Then the only choice is to Tune the SQL

Copyright 2006 Kyle Hailey

#.18

IO Throughput

Copyright 2006 Kyle Hailey

#.19

Direct I/O WAITSDirect I/O : This mechanism lets the client bypass the buffer cache forI/O intensive operations. The disk blocks are written into and read fromprocess private memory.

Direct IO Clients : hash join sqlldr loading/reading LOBs parallel DMLs sorts create table as select create index

Copyright 2006 Kyle Hailey

#.20

direct path read

# 7 Top Wait Could signal sort problems

Sorts read into their PGA from datafiles via direct path read

Other UsesPQOAsyncronous read ahead

Copyright 2006 Kyle Hailey

#.21

direct path read : Diag

ShadowShadow

ProcessProcess

Buffer CacheBuffer Cache

PGAPGA

XX

Copyright 2006 Kyle Hailey

#.22

direct path write

# 8 Top Wait Occurs when:

Could signal sorting waits Sorts write to TEMP segment via direct path write

insert /*+ APPEND */ sql*loader direct=y

Copyright 2006 Kyle Hailey

#.23

direct path write : Diag

ShadowShadow

ProcessProcess

Buffer CacheBuffer Cache

PGAPGA

TEMPTEMP

DBWRDBWR

Copyright 2006 Kyle Hailey

#.25

direct path write (lob) #35

Note: Direct path read (lob) Happens for reads on LOBs that are stored NOCACHELOBS stored CACHE are read into the buffer cache

Copyright 2006 Kyle Hailey

#.26

file open #16 Args

P1 fib P2 iov P3 0

Wait on an open file The time it takes to open the file Times should be order of a block read To tune, try pre-opening files Leave sessoins connected

High reconnection rates can exacerbate

Can try holding log files open (see script from Steve Adams)

Copyright 2006 Kyle Hailey

#.27

file identify

#29 The time it takes to identify a file so that it can be

opened later. Datafile should be identified just once Logfiles are identified every checkpoint

Reduce checkpoints

Arguments p1 fib p2 filename p3 opcode (1 test for create, 2 get details)

Copyright 2006 Kyle Hailey

#.28

Summary I/O

direct path read : sorts or PQO direct path write : direct path or temp io sort segment request : SMON occupied? direct path write (lob) : stored NOCACHE file open : log files or session reconnects file identify : log files or session reconnects

Copyright 2006 Kyle Hailey

#.29

Summary I/O

Buffer Cache IOdb file sequential readdb file scattered readdb file parallel read

Tune I/O’s should be 5-15msCheck Buffer Cache AdvisoryTune SQL