Buffer Cache Waits. #.2 Copyright 2006 Kyle Hailey Buffer Cache Waits Waits Disk I/O Buffer Busy Library Cache Enqueue SQL*Net Free Buffer Hot Blocks.

Slides:



Advertisements
Similar presentations
Office of the Accountant General (A&E) Andhra Pradesh Hyderabad
Advertisements

IO Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Waits Covered in this Section  db file sequential read  db file scattered.
Enqueue Waits : Locks. #.2 Copyright 2006 Kyle Hailey Wait Tree - Locks Waits Disk I/O Library Cache Enqueue Undo TX 6 Row Lock TX 4 ITL Lock HW Lock.
Enqueue Waits : Locks. #.2 Copyright 2006 Kyle Hailey Locks REDO Lib Cache Buffer Cache IO Locks Network.
CS4432: Database Systems II Buffer Manager 1. 2 Covered in week 1.
1 Chapter 16 Latch and Mutex Contention. 2 Architecture Overview of Latches Protect Oracle’s SGA Prevent two processes from updating same area of SGA.
Oracle Touch Count Algorithm
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Oracle Architecture. Instances and Databases (1/2)
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2007 all rights.
G Robert Grimm New York University Sprite LFS or Let’s Log Everything.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Log File Waits  Redo is written to disk when  User commits  Log Buffer.
Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O.
CheckPoint Internals of PostgreSQL
Waits Defined Kyle Hailey #.2 Copyright 2006 Kyle Hailey Top 36 Foreground Waits write complete waits library cache.
1 Copyright © 2009, Oracle. All rights reserved. Exploring the Oracle Database Architecture.
Shared Pool Waits. #.2 Copyright 2006 Kyle Hailey Shared Pool Waits  Library Cache Latch  Shared Pool Latch  Library Cache Pin  Library Cache Lock.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Basic Oracle Architecture
DBMS Transactions and Rollback Recovery Helia / Martti Laiho.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
Part II : Waits Events Kyle Hailey
7202ICT Database Administration Lecture 7 Managing Database Storage Part 2 Orale Concept Manuel Chapter 3 & 4.
March 19981© Dennis Adams Associates Tuning Oracle: Key Considerations Dennis Adams 25 March 1998.
Architecture Rajesh. Components of Database Engine.
Database Systems Slide 1 Database Systems Lecture 5 Overview of Oracle Database Architecture - Concept Manual : Chapters 1,8 Lecturer : Dr Bela Stantic.
Buffer Cache Waits. In This Section 1.latch: cache buffers chains 2.latch: cache buffers lru chain 3.Free Buffer Wait 4.Buffer Busy Wait 5.Write Complete.
7202ICT – Database Administration
Buffer Cache Waits. #.2 In This Section 1.latch: cache buffers chains 2.latch: cache buffers lru chain 3.latch: cache buffer handles 4.Free Buffer Wait.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Copyright  Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
Oracle Tuning Ashok Kapur Hawkeye Technology, Inc.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
DB Performance Ana Stanescu CIS764 - Fall 08 KSU.
© Dennis Shasha, Philippe Bonnet 2001 Log Tuning.
1 06/05/08 Statspack Kyle Hailey
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Lecture 5 Cost Estimation and Data Access Methods.
Outline Introduction to Oracle Memory Structures SGA, PGA, SCA The Specifics of the System Global Area (SGA) Structures Overview of Program Global Areas.
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
#.6 Sampling Kyle Hailey
1 Logical I/O Julian Dyke Independent Consultant Web Version juliandyke.com © 2005 Julian Dyke.
Chapter 5 Index and Clustering
Preface 1Performance Tuning Methodology: A Review Course Structure 1-2 Lesson Objective 1-3 Concepts 1-4 Determining the Worst Bottleneck 1-5 Understanding.
#.1 Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
SQL*Net & Other Waits. #.2 Copyright 2006 Kyle Hailey SQL*Net Waits Session Shadow Log Buffer Buffer Cache Log Buffer Buffer Cache SGA Library Cache Host.
1-1 Copyright © Oracle Corporation, All rights reserved. Redo Logs and Recovery John Hibbard Senior Principal Instructor Minneapolis MN
3 Copyright © 2004, Oracle. All rights reserved. Database Architecture Comparison.
Same Plan Different Performance Mauro Pagano. Consultant/Developer/Analyst Oracle  Enkitec  Accenture DBPerf and SQL Tuning Training Tools (SQLT, SQLd360,
What is Oracle ? Oracle is a relational database management system. It is a management system which uses the relational data model. In the relational data.
Oracle Database Architectural Components
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.

Module 11: File Structure
Kyle Hailey Redo Waits Kyle Hailey
Redo Logs and Recovery John Hibbard Senior Principal Instructor
The Buffer Cache.
Oracle Memory Internals
Oracle Architectural Components
CS347 Spring 2017 – Quiz 5 Preparation - Solutions UTEID _________
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
Presentation transcript:

Buffer Cache Waits

#.2 Copyright 2006 Kyle Hailey Buffer Cache Waits Waits Disk I/O Buffer Busy Library Cache Enqueue SQL*Net Free Buffer Hot Blocks Free lists IO Read Redo Buffer Cache Row Cache Write Complete Cache Buffer Chains Latch

#.3 Copyright 2006 Kyle Hailey Buffer Cache Waits  Latch - cache buffers chains  Latch - cache buffer chains LRU  Free Buffer Wait  Buffer Busy Wait  Index  Data  Free lists  Hot Spots  RBS  Write Complete Wait  Local Write Wait

#.4 Copyright 2006 Kyle Hailey REDO Log Files Data Files DBWR LGWR User2 User1 User3 Log Buffer Buffer Cache Log Buffer Buffer Cache SGA Library Cache Oracle Memory Stuctures

#.5 Copyright 2006 Kyle Hailey Buffer Cache Caches data blocks from disk that are heavily used Buffer Cache Disk ShadowProcess

#.6 Copyright 2006 Kyle Hailey Block in cache? How do you know if a block is cached? Do you search all the blocks? Could be 1000s of blocks to search. Shado w Proces s ?

#.7 Copyright 2006 Kyle Hailey Buffer Cache Find a block by Take Data file # Block# and Hash Them

#.8 Copyright 2006 Kyle Hailey Hashing I  Simple has could be a Mod function  1 mod 4 = 1  2 mod 4 = 2  3 mod 4 = 3  4 mod 4 = 0  5 mod 4 = 1  Using “mod 4” as a hash funtion creates 4 “buckets” to store things

#.9 Copyright 2006 Kyle Hailey Hashing II Empty Buckets

#.10 Copyright 2006 Kyle Hailey Hashing III Data Block Hash Block’s file# block #’s Result in a bucket# Put Block in bucket

#.11 Copyright 2006 Kyle Hailey Hashing IV

#.12 Copyright 2006 Kyle Hailey Hashing V After a while the buckets become populated with blocks

#.13 Copyright 2006 Kyle Hailey To Find a Block Buffer Headers Data Blocks Hash bucket 1.Hash the block address 2.Look for header 3.Found, read block in cache 4.Not Found Read block off disk ShadowProcess 124 3

#.14 Copyright 2006 Kyle Hailey Cache Buffers Chains A different latch protects each bucket Note: multiple buckets are now protected by one latch

#.15 Copyright 2006 Kyle Hailey Cache Buffers Chains Hash Buckets Buffer Headers Well Balanced

#.16 Copyright 2006 Kyle Hailey Cache Buffers Chains Hash Buckets Buffer Headers Multiple Buckets protected by same latch v9 onwards 1 2 3

#.17 Copyright 2006 Kyle Hailey Cache Buffers Chains : Diag Hash Buckets s1 s1 s1 s1 s1 Sessions Contention if too accesses on a bucket 1 2 3

#.18 Copyright 2006 Kyle Hailey Cache Buffers Chains : Diag Hash Buckets Buffer Headers Contention: Too Many Buffers in Bucket 1 2 3

#.19 Copyright 2006 Kyle Hailey Cache Buffers Chains : Solution  Fine the SQL causing the problem  Contributing Factors  Updates, inserts on blocks while reading those blocks  Cause multiple copies  Hot root block of an index  Select for update  Using dual instead of x$dual

#.20 Copyright 2006 Kyle Hailey Need Free Block Block  If the data block isn’t in cache  Get a free block in the buffer cache  Read it off disk  Add a header  Read the block into the buffer cache Need Free Block to Read in New Data Block

#.21 Copyright 2006 Kyle Hailey Finding a Free Block ShadowProcess When a session reads a block Into the bufffer cache how does it find a FREE spot?

#.22 Copyright 2006 Kyle Hailey Finding a Free Block Buffer Headers Data Blocks Hash bucket Buffer Headers are also on a LRU linked List

#.23 Copyright 2006 Kyle Hailey Cache Buffers LRU list MRU LRU Buffer Headers LRU = Least Recently Used MRU = Least Recently Used Session Shadow

#.24 Copyright 2006 Kyle Hailey Free Buffer Wait  Finding a Free Block  Go to the LRU end of data blocks  Look for first non-dirty block  If search too many post DBWR to make free  Free Buffer wait

#.25 Copyright 2006 Kyle Hailey Free Buffer Wait  #17  Data Block Cache lack free buffers  Tune by  Increase data blocks  Try to tune DBWR  Inefficient SQL  requesting large # of blocks In V7, sorts could flood the cache with dirty blocks

#.26 Copyright 2006 Kyle Hailey Cache Buffers LRU list MRU LRU Used Block gets put on Front Unused blocks get pushed off Buffer Headers

#.27 Copyright 2006 Kyle Hailey Cache Buffers LRU Latch MRU LRU Buffer Headers One Latch protects the linked list during changes to the list

#.28 Copyright 2006 Kyle Hailey Cache Buffers LRU Latch MRU LRU Mid-Point Insertion Full Table Scan Insertion Point Buffer Headers

#.29 Copyright 2006 Kyle Hailey Cache Buffers LRU Latch MRU LRU Mid-Point Insertion Oracle Tracks the touch count of blocks. As the block is pushed to the LRU end, if it’s touch count is 3 or more, it’s promoted to the MRU end

#.30 Copyright 2006 Kyle Hailey Cache Buffers LRU Latch : Solution Buffer Headers Multiple Sets _db_block_lru_latches = 8 10gR2 with cpu_count = 2 Set 1 Set 2

#.31 Copyright 2006 Kyle Hailey Cache Buffers LRU Latch : Solution Other  Increase Size of Buffer Cache  Reduce Checkpointing Activity  Use Async I/O for DBWR  Increase DBWR write batch size

#.32 Copyright 2006 Kyle Hailey Buffer Busy Waits  User 1 tries to change a buffer header  User 2 already has buffer header “locked” User1 User2

#.33 Copyright 2006 Kyle Hailey Buffer Busy  14 kinds of blocks Undo Header - more RBS segs data (index and table are different for bbw) segment header – free lists freelist blocks – free lists groups  9 kinds Buffer Busy Waits 100,110,120,130 (read I/O issues) 200,210,220,230, 231 (block change issues)

#.34 Copyright 2006 Kyle Hailey Buffer Busy Wait What’s Important:  What kind of block header  Rollback  Data  Index  Table  Segment Header  If Pre 10  Read (100,110,120,130 )  Write (200,210,220,230, 231 )

#.35 Copyright 2006 Kyle Hailey Buffer Busy Cases  Undo Header - Not enough rollback segments  Undo Block – hot spot in RBS  Data Block  Table Block w/ DML : Table lacks Free lists  Table I/O : Multiple sessions reading same block into data cache  Note: in 10g, becomes “read by other session”  Index : has hot block, partition or change SQL  Segment Header – add free Lists (with Datablock)  Free List – add free lists groups

#.36 Copyright 2006 Kyle Hailey Buffer Busy Solutions  IF Buffer Busy Waits high  First look at v$waitstat  Class  Time/Count SQL> select * from v$waitstat; CLASS COUNT TIME data block 1 1 segment header 0 0 free list 0 0 undo header 0 0 undo block 0 0 SQL> select * from v$waitstat; CLASS COUNT TIME data block 1 1 segment header 0 0 free list 0 0 undo header 0 0 undo block 0 0

#.37 Copyright 2006 Kyle Hailey Buffer Busy Wait Solutions Buffer wait Statistics DB/Inst: LINUX3/linux3 Snaps: > ordered by wait time desc, waits desc Class Waits Total Wait Time (s) Avg Time (ms) undo header 1, data block file header block segment header undo block

#.38 Copyright 2006 Kyle Hailey Load : Example  4 Sessions running Insert into toto values (null, ‘a’); Commit;

#.39 Copyright 2006 Kyle Hailey Lack of Free List : Diag S1 S2 S3 S4

#.40 Copyright 2006 Kyle Hailey With Free Lists : Diag S1 S2 S3 S4

#.41 Copyright 2006 Kyle Hailey 10g SQL> select * from v$waitstat; CLASS COUNT TIME data block sort block save undo block segment header save undo header free list extent map st level bmb nd level bmb rd level bmb bitmap block bitmap index block file header block unused system undo header system undo block undo header undo block 0 0 NAME P1 P2 P buffer busy waits file# block# class NAME P1 P2 P buffer busy waits file# block# class

#.42 Copyright 2006 Kyle Hailey write complete waits  #18  Usually happens in tandem with free buffer  Tune by  Increase data block cache  Happens because shadow wants to access blocks that are currently being written to disk by DBWR

#.43 Copyright 2006 Kyle Hailey Local Write Wait  #25  Truncating a table  Wait for Data Cache to be cleared of all blocks of truncated table  Wait by shadow for DBWR

#.44 Copyright 2006 Kyle Hailey Summary Buffer Cache Waits  Latch - cache buffers chains: find SQL  Latch - cache buffer chains LRU  Free Buffer Wait : increase cache size, tune SQL  Buffer Busy Wait  Index : aleveate hot spots  Data DML : add free lists  Data Read: change app, tune I/O  RBS : more RBS segs, use UNDO  Write Complete Waits –: increase cache size  Local Write Wait : truncates / reduce cache size