9
1 Chapter 17 Shared Memory Contention

1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

Embed Size (px)

Citation preview

Page 1: 1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

1

Chapter 17Shared Memory Contention

Page 2: 1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

2

Overview

Specifically talking about SGA– Buffer Cache– Redo Log Buffer

Contention in these areas of SGA– Can restrict SQL processing– Negatively impact performance

Page 3: 1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

3

Buffer Cache Architecture

Multiple areas or “pools” in buffer cache– Keep Pool – for small frequently accessed tables– Recycle Pool – Larger infrequently used tables– Nondefault block size - from 2K to 32K– Default pool – if none specified

Used for data blocks and index blocks Buffer cache searched first for block requests Based on “LRU” – least recently used algorithm

Page 4: 1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

4

Buffer Cache Architecture (cont.)

When DML changes a block– Changes made to block in memory– Changed blocks called “dirty blocks”– Not immediately written to disk– DBWR responsible for writing blocks to disk at a later time

“Lazy write” principle

Dirty blocks can’t be flushed from buffer cache Server processes read blocks from disk Old “LRU” blocks make way for new blocks Direct Path operations bypass the buffer cache

Page 5: 1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

5

Free Buffer Waits

Occurs when all blocks in cache are dirty Sessions wanting to bring new blocks have to

wait Occurs with heavy DML activity DBWR can’t keep up with DML activity

– By default, only one DBWR process– Writing to disk is slow

Page 6: 1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

6

Alleviating Free Buffer Waits

Enabling Asynchronous IO– See FILESYSTEMSIO_OPTIONS parameter– Check V$IOSTAT_FILE to see if enabled

Enabling filesystem direct IO Can set up multiple DBWR processes Use direct path IO Efficient OS disk configuration Increasing buffer cache size

Page 7: 1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

7

Recovery Writer Waits

Occurs if Flashback Database feature enabled– Form of database recovery

Flashback log overhead can slow performance Noted as “flashback buf free by RVWR” wait Alleviate by:

– Increasing number of disk devices used for logs– Host logs on dedicated devices– Other techniques outlined in Chapter 21

Page 8: 1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

8

Buffer Busy Waits

Occurs when– Two processes compete for same buffer– Second session waiting for first session– Insufficient freelists (showing available free buffers)– Insufficient Undo segments– Rarely occurs in Oracle versions > 9i

Can see using:– V$WAITSTAT– V$SEGMENT_STATISTICS

Can be alleviated using partitioning or higher PCTFREE

Page 9: 1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can

9

Redo Log Buffer Waits

Occurs when– Heavy redo generation– Limited by disk IO bandwidth

Alleviate with– NOLOGGING operations (use with caution)– Direct path inserts– Larger buffer can help, but often does not