1 Chapter 17 Shared Memory Contention
2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can restrict SQL processing – Negatively impact performance
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
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
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
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
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
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
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