Sei sulla pagina 1di 55

Database Buffer Cache Deep Dive

Aman Sharma

@amansharmadb http://blog.aristadba.com

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 1


Who Am I?
▪ Aman Sharma
▪ About 14+ years using Oracle Database
▪ Oracle ACE
▪ Frequent Contributor to OTN Database forum(Aman….)
▪ Vice-President(AIOUG)
▪ Founder/Lead-North India Chapter(AIOUG)
▪ Sun Certified SoundSport® Pulse
|@amansharmadb *
|http://blog.aristadba.com *

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 2


Disclaimer

• This is my understanding of the things


• I don’t know “everything”
• I can be wrong!

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 3


Agenda

▪ Introduction to Database Buffer Cache


▪ A little more about Database Buffer Cache ☺
▪ Tuning of the Buffer Cache

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 4


Agenda

▪ Quick Introduction - Database Buffer Cache


▪ A little more about database Buffer Cache
▪ Buffer Cache Tuning

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 5


Oracle Instance- An Introduction
Shared Pool
SALES App Server Buffer Cache Library Cache Log Buffer
Process
Large Pool Row Cache
PGA Streams Pool
LSNR UGA Result Cache

CGA LGWR DBWR PMON SMON CKPT

System
Metadata

User ORL SYSTEM SYSAUX UNDO CTL


User Data
Metadata

SALES FLBLOG BackUp TEMP


Database ARCH
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 6
Database Kernel Layout Oracle Kernel Layer Description Kernel Layer Name

& Buffer Cache Oracle Call Interface OCI


User Program Interface UPI
Oracle Program Interface OPI
SQL> select count(name) from v$fixed_table where name like 'X$KCB%';
Kernel Compilation Layer KK
COUNT(NAME) Kernel Distribution Execution Layer K2
----------- Buffer Network Program Interface NPI
30 (18c) Cache
Kernel Security Layer KZ
SQL> select name from v$fixed_table where name like 'X$KCB%'; Kernel Query Layer KQ
Recursive Program Interface RPI
NAME
Kernel Access Layer KA
------------------------------
X$KCBWDS Kernel Data Layer KD
X$KCBWBPD Kernel Transaction Layer KT
X$KCBBHS
Kernel Cache Layer KC
X$KCBBES
X$KCBKWRL Kernel Services Layer KS
X$KCBKPFS Kernel Lock Management Layer KJ
X$KCBBF
Kernel Generic Layer KG
……………… Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 7
Operating System Dependencies S
Database Buffer Cache – Quick Intro

• Provides fast access to frequently access data blocks


• Provides mechanism for consistent and concurrent block change
requests
• Provides mechanism for Real Application Cluster’s Cache Fusion
• Provides mechanism for Multiversioning support for consistent
read behavior
• Is a circular cache maintained by a touch based LRU algorithm
• Uses an incremental checkpointing mechanism for faster instance
recovery

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 8


Buffer Cache - Logical IO’s

• Read operations are considered as Logical IO’s


• Within SGA, buffer cache serves as the repository for the cached
buffers
• Two types of Logical IO’s
• Consistent IO’s
• Current IO’s

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 9


Logical IO’s – Current Reads

• Current version of the block


• Used for the dirty buffers created by the DML’s
• Only one current version containing the recent modification stays in
the buffer cache
• Only one current version containing the recent modification stays in
the buffer cache across all the instances in a clustered database
• Current image is modifiable by the future statements in the current
transaction
• Can be used to create CR(consistent read) buffer(s) for consistent
reads

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 10


Logical IO’s - Consistent Reads

• Reads done over consistent images for a dirty buffer


• Created by the requesting session seeking a consistent copy of yet-
not-committed transaction’s old values
• Consistent images can’t be further modified
• Multiple consistent versions of the one dirty buffer may exist
• Can be traced using the trace events 10200/201

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 11


Buffer Cache – ln Old times….
• Component of the SGA for helping
Logical IO’s
• Was a singular component before
Default Buffers
database version 9i
• Made up of
• Database block buffers
• Keep buffers Keep Buffers
• Recycle buffers Recycle Buffers
• The keep cache and recycle cache
used to take memory from the
default cache
• Resizing wasn’t dynamically possible
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 12
Buffer Cache – At Present
• From 9i, each cache is made
independent from each other
• Still Three sub-components
• Default Buffer Cache
• Keep cache
• Recycle cache
Default Cache Keep Cache Recycle Cache
• The keep cache and recycle
cache are now allocated in an
individual capacity
• Also introduced Nk(non-default)
buffer caches
• Memory management uses
Granules
• Resizing is dynamically possible
now
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 13
Buffer Cache - Parameters
• Buffer Cache uses default block size as the minimum unit of IO
• Default Block Size - DB_BLOCK_SIZE
• For sizing the buffer pools:
• DB_CACHE_SIZE
• DB_KEEP_CACHE_SIZE
• DB_RECYCLE_CACHE_SIZE
• Each buffer pool is allocated individually
• Do not use DB_BLOCK_BUFFERS (still valid but don’t use it)
• Buffer Cache For non-default block sizes:
• DB_nK_CACHE_SIZE

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 14


Other Sub-Pools
• BUFFER_POOL clause for Create/Alter|
Table/Index
• Keep Pool
• Controlled by DB_KEEP_CACHE_SIZE
• Meant for small sized objects that may require to be Recycle Nk
cached almost all the time Keep Cache
• Not auto-tuned Cache Cache
• Uses same LRU mechanism as of Default buffer pool
• Recycle Pool
• Controlled by DB_RECYCLE_CACHE_SIZE
• Meant for objects which don’t need to be cached at all Defa
• About 1/3rd of the object buffers only are kept in the
Recycle Pool
• Not auto-tuned
• Non-Default Buffer Pool(s)
• Used for setting the cache for non-standard block sizes
• Meant for Transportable Tablespace
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 15
Granules, Buffer Cache and Dynamic SGA

• From 9i, Oracle Corp made SGA memory allocations dynamic


• Memory swapping is possible between SGA components using the
fixed sized memory chunks - Granules
• Size of the Granules is determined by SGA sizing- Between 4MB-
16MB
• Internal tables – X$KSMGE, X$KSMGV, X$KMGSCT
• To Check the current value of the Granule size,
select bytes from v$sgainfo where name = 'Granule Size';

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 16


Granules, Buffer Cache and Dynamic SGA
GRANTYPE COMPONENT GRANPREV GRANNUM GRANNEXT
---------- ------------- ---------- ---------- ----------
Granule
1 shared pool Type 0 1 2
SGA 1 74 75 69
Component 1 2 3 4
1 3 4 5
Select1 ge.grantype, 4 5 6
1
ct.component,ge.granprev, 5 ge.grannum,
6 7
1 6 7 8
ge.grannext
2 large pool 48 49 0
From x$ksmge
2 ge,x$kmgsct ct 0 48 49
where ge.grantype != 6
3 java pool 0 50 0
and ct.grantype = ge.grantype
order 7by ge.grantype
DEFAULT , ct.component;
buffer cache 87 20 21
7 20 21 22
7 21 22 23
7 22 23 24
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 17
Schematic of a granule allocated to Buffer Cache
Granule Header

• Granules contain
• Array of buffers
holding copies
Granule Header
of data blocks Buffer Header Buffer Header Buffer Header Buffer Header

• Array of buffer Buffer Header Buffer Header Buffer Header Buffer Header

headers Block Header Block Header Block Header Block Header

• Metadata for
Block Header Block Header Block Header Block Header
management

Data Buffers Buffer Headers


Array Array
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 18
Agenda

▪ Database Buffer Cache


▪ A little more about database Buffer Cache
▪ Buffer Cache Tuning

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 19


Buffer Cache – Architecture Overview

• Buffer Cache is maintained in the form of a Hash table comprising of Hash


Buckets
• Hash buckets are structures that maintain the list of data buffer headers ,
grouped by relative Data Block Address(DBA) and tablespace number
• Hash buckets are linked with Hash Chains
• Hash chain is a list of data buffer headers in one hash bucket
• Buffer replacement in the hash buckets is maintained using a LRU
algorithm
• Two latches are deployed for buffer cache
• Cache Buffer LRU Chain Latch
• Cache Buffer Chain Latch

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 20


Hash Buckets in Buffer Cache
• Group the buffers in the buffer cache
• Hash value of the buffers is calculated from the data block address and
the block class to it belongs
• Number of Hash buckets depend on the buffer cache size
• Hash buckets are accessed using Cache Buffer Chain latches
• Each hash bucket contains a chain of buffer headers for a set of
tablespace# and DBA
• Number of hash buckets can be controlled using
_db_block_hash_buckets

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 21


Buffer Cache – Architecture Overview
_db_block_hash_buckets
Hash Buffer
buckets hash
Buffer
table chains cache

B B F F F F

Cache C C E E E E E
buffer
C C C C
chains
latches C C C C

B B B B

A A A A

_db_block_hash_latches

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 22


Buffer Cache – Internal Structures

• Buffer Pool( KCBWBPD)


• WorkArea Set( KCBWDS)
• Buffer Header( KCBBH)
• Buffer Descriptor( KCBDS)
• LRU Linked Lists
• Buffer Replacement Algorithm

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 23


Buffer Cache - Buffer Pools

• Basic Building blocks- maintainable by the DBA’s (You)


• Default Pool
• Keep Pool
• Recycle Pool
• Nk Cache Size Pool – 2k, 4k, 8k, 16k, 32k
• Non-standard cache size pool must have a different (non-standard)
block size than the Default Pool

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 24


Buffer Pool Headers

• Each buffer pool gets a header


created for it Buffer Pool
• Available in the public views Granule Granule

• V$BUFFER_POOL DBWR
• V$BUFFER_POOL_STATISTICS
• Exposed in X$KCBWBPD DBWR

• Contains description of
• WorkAsrea sets
• Granules
WorkArea WorkArea WorkArea WorkArea
Set1 Set2 Set3 Set4

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 25


Buffer Headers Buffer Cache
Buffer1 Buffer2
• Optimized in-memory meta-structure
• Are associated with every buffer that’s loaded in the Cached Buffers
buffer cache
Buffer3 Buffer4
• Access to the buffers is via the buffer headers
• Allow the buffers accessed via search in the Cache BH1 BH2
Buffer Chain lists
• Contains reference to
• Memory address of the buffer
• The hash chain
• Position in the various linked lists i.e. LRU etc.
• Information about the users accessing or waiting for the
buffer
• Information about flags and indicators about the buffers
• Can be seen using X$BH Disk Disk
Block1 Block2
• Buffer header is NOT the same as block header
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 26
CB Lru Chain Latches

WorkArea Sets
• Represents the logical division of a
large buffer cache Default Cache
• Were introduced in 8i(8.1.5)
WorkArea WorkArea
• Each buffer pool is maintained by Set 1 Set 2
one or more workarea sets
Keep Cache
• Created in the Shared Pool
• Written by DBWR WorkArea WorkArea
Set 2 Set 2 Recycle Cache
• Searched and protected by Cache
Buffer LRU Chain Latch
• Each workarea set contains
multiple LRU and CKPT queues
DBWR
• Maintained using X$KCBWDS
• CPU_COUNT/2
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 27
Buffer Cache - Linked Lists

Buffer Cache
• Several linked lists within the buffer
cache Hot End
• Most popularly known are
Dirty List
• Hot buffer list LRU List

• Cold buffer list


• Dirty Buffer List
Cold End

That’s not exactly


correct☺

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 28


Buffer Cache - Linked Lists
CB LRU Chain Latches
_db_block_lru_latches

Buffer Cache

Hot End Cold End CKPTQ Lists

LRU Main LRU Aux


Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 29
Buffer Cache -Linked Lists In the WorkArea Sets
Buffer Cache

WorkArea Sets(X$KCBWDS)

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 30


Buffer Cache -Linked Lists In the WorkArea Sets

X$KCBWDS Hot End


NXT_REPL
BH BH BH BH BH
PRV_REPL

NXT_REPLAX BH BH BH BH BH

PRV_REPLAX

Cold End

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 31


Buffer Cache – Major Linked Lists In the WorkArea Sets
• LRU(REPL) Main Queue Buffer Header REPL Queue

• LRU(REPL) Auxiliary Queue


BH (11BFA4A4) file#: 3 rdba: 0x00c067cc (3/26572) class: 1 ba: 11B74000
• Checkpoint Queue set: 3 blksize: 8192 bsi: 0 set-flg: 0 pwbcnt: 0
dbwrid: 0 obj: 8966 objn: 8966 tsn: 2 afn: 3
• File Queue hash: [217b55d0,10bf2a00] lru: [15be9774,11bf6748]
lru-flags: hot_buffer
• Object Queue obj-flags: object_ckpt_list
CB Hash Chain ckptq: [147eaec8,11beab1c] fileq: [147eaed0,11beab24] objq:
[1e5ae154,147ed7b0] Buffer Touch
st: XCURRENT md: NULL tch: 9 Count
flags: buffer_dirty gotten_in_current_mode block_written_once
redo_since_read
LRBA: [0x294.539f.0] HSCN: [0x0.4864bf4] HSUB: [57]

DBWR’s starting point


to write after waking up
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 32
Buffer Cache - LRU Algorithms

• Buffer Cache is a circular cache


• To keep the unused buffers replaced with the used buffers,
Least Recently Used(LRU) algorithm is used
• LRU algorithm got different iterations over the time
• Standard LRU algorithm (used with the initial release
of the Oracle Database)
• Modified LRU algorithm (introduced with version 6)
• Mid-point insertion LRU algorithm (introduced with
8i and is currently used)

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 33


Buffer Cache - Standard LRU Algorithm(V1) MRU End

• Was introduced with the initial release of the BH


database
BH
• Extremely simple- used a single linear chain
• Did bring the concept of the Hot and Cold ends BH LRU Chain
in each LRU chain
• More popular buffers were placed at the BH
MRU(“hot”) end and constantly were promoted
to the “hot” end BH
• Didn’t work very well with the large sized tables BH
accessed with FTS as the entire LRU chain would
be overwritten with the FTS buffers BH
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018
LRU
34
End
Buffer Cache - Modified LRU Algorithm(V2) MRU End

BH
• Was introduced in version 6 BH
• Took into the account the issue of
buffers accessed by FTS replacing the BH LRU Chain
entire LRU chain
• Was implemented with an additional BH
“window” in the LRU chain only meant BH
for the FTS buffers FTS

• Number of buffers in the FTS window


Window
BH
can be controlled by the parameter
_small_table_threshold(2% of DBC) BH
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018
LRU
35
End
Mid-Point Insertion/Touch Count Algorithm MRU End

• Was a completely new algorithm


BH
• LRU chain still has a so-called MRU and LRU ends BH
• LRU chain now has a mid-point dividing it
• Mid point can be controlled by
_db_percent_hot_default
BH LRU Chain
• If the buffer count is larger than
_small_table_threshold buffers will be linked to theMid Point BH
LRU end else it will be in the MRU end
• Buffer promotion/demotion and eviction is now based on
the “touch count” recorded in the buffer header
BH
• Touch count is incremented with every buffer access after a BH
3 second timeout from the last access
• With every “touch” to the buffer, touch counter increments
• Touch count is recorded in the Cache Header of a buffer
BH
• Exposed in X$BH.TCH column BH
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018
LRU
36
End
Mid-Point Insertion TCH - Implementation

• Every buffer’s touch counter is incremented with every access


• Every access timeout has to be 3 seconds
• Once the buffer’s counter >=2, it’s promoted to the “hot” end of the
LRU Chain
• At the hot end, the buffer’s TCH is forcefully marked to 0 and is
attached to the “cold” end
• At “cold” end, the TCH becomes 1
• If the buffer is not accessed again, it’s marked as a candidate buffer
for being evicted
• Buffer counter increments are visible through X$BH.TCH

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 37


Parameters used for TCH based LRU

• _db_percent_hot_default=50
• _db_aging_hot_criteria=2
• _db_aging_stay_count=0
• _db_aging_cool_count=1
• _db_aging_touch_time=3
• _db_aging_freeze_cr=False

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 38


Mid-Point Insertion TCH - Example

Head of Head of Block


Hot End Cold End Number

92
71
42 34
92
71 72
34
92 45
72
34 52
42
45
33
72
87
11 71
52
42
45
33
72
11 66
71
52
42
45
33
11 49
66
71
52
42
45
11

0 3
0 3
4
0 2
4 2
4
1 2
1
4 0
2
1 0
1
2

Read Block 42 Touch


42
33
87
11
Count
Insert buffer at head of cold
end 1

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 39


Caching Tables In the Buffer Cache MRU End

BH
TCH=0
• Tables can be cached using an explicit CACHE
clause BH
• Can be used with
• CREATE TABLE
BH LRU Chain
• ALTER TABLE BH
TCH=1
Mid Point
• HINT
• CACHE Clause does not really caches the tables BH
• Puts the buffers in the LRU_MAIN list directly BH
• Buffers are still replaceable despite being
“cached” BH
BH
LRU End
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 40
Big Table Caching in 12c - Using Object Temperature
• Touch count based mechanism is for the block replacement
• From 12c(12.1) onwards, an object replacement mechanism is also
available based on the “temperature” of the objects
• Is maintained by having a sub-section in the default buffer cache-
Big Table Cache
• Is beneficial for scans of large objects which don’t fit in the default
cache in specific environments like DWH
• Is available for both single instance and RAC databases
• Works along with In-Memory parallel query

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 41


Big Table Caching - Parameters and Views
• Parameters
• PARALLEL_DEGREE_POLICY=AUT
O/ADAPTIVE Buffer Cache=8GB
• DB_BIG_TABLE_CACHE_PERCENT Big Table Cache=3GB
_TARGET=0(%of the Buffer Temperature
Cache||90% Max) Based

• Views
• V$BT_SCAN_CACHE
• V$BT_SCAN_OBJ_TEMPS
Touch Counter
Based

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 42


Buffer Cache - Buffer Look Up In Buffer Cache
Simplified example of performing a Full Table Scan
• Optimizer comes with an execution plan
• Extent information of the required segment is loaded
• Required DBA’s(Data Block Address) are hashed between 1-M(M=list of the buffer headers in
the buffer cache)
• Required Hash Buckets are now located
• Using Cache Buffer Chain(CBC) Latch, Hash Chains within the Hash Buckets are started to
traverse
• If the DBA is found, return using a Logical IO
• If the DBA is not found, unpin the CBC latch, read the buffer from the disk using a Physical IO
• Pin Cache Buffer LRU Chain Latch to find a free buffer
• Load the block from the disk in the free buffer
• Return the result to the server process

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 43


Agenda

▪ Database Buffer Cache


▪ A little more about database Buffer Cache
▪ Buffer Cache Tuning
▪ Q/A

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 44


Buffer Cache- Related Wait Events

• Free Buffer Wait


• Read Waits
• Cache Buffer Chain/LRU Latch Contention
• Buffer Cache Hit Ratio
• Buffer Busy Waits

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 45


Buffer Cache - Free Buffer Wait
LRU-Main
• Server process waits for the Free Server
buffers in the buffer cache Process 1
• DBWR starts writing existing Dirty
buffers in “panic mode”
Write Dirty
• Can be resolved by Server
Buffer
Process 2
• Reducing the number of free
buffers required by using optimized DBWR
SQL statements
• Increasing the overall size of the Server Free
buffer cache Process 3
• Increasing the writing pace of the
DBWR process by either having a
faster storage, multiple DBWR’s or
multiple DBWR slaves

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 46


Buffer Cache - Read Waits
• Three kinds of Buffer Read waits
• DB File Sequential Read
• DB File Scattered Read
• DB File Parallel Read
• Contrary to what the assumption, these three are Disk reads into the Buffer
Cache
• Occurrence of any/all the wait events is a normal phenomenon
• If the Wait time is consistently increasing(>15ms) then
• Check for the statements in the SQL Ordered by Reads statistics
• Reads are delayed due to the checkpointing as disks will be busy completing writes.
So reduce checkpointing rate
• Add more disk capacity or stripe the disks to reduce contention
• Last but not the least, increase buffer cache size(better use AMM/ASMM)

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 47


Buffer Cache - Latch contentions

• Cache Buffer LRU Chain latch contention represents that excessive time is spent
on searching for the free buffers
• Increase the buffer cache size if not using AMM
• Cache Buffer Chain Latch contention represents that multiple processes are trying
to access the same hot buffer
• For Data blocks
• Mostly caused by inefficient design of application or sub-optimal SQL statements
• Demands application tuning
• For index block contention
• Create Reverse key index or Global Hash partitioned index
• Also can happen when the caller process is attempting to replace the buffers too
frequently
• Increase the buffer cache size

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 48


Buffer Cache - Buffer Busy Waits
• Happens when one session needs to use a buffer in an incompatible mode when it’s
already used by another session
• Identify buffer busy wait contention by checking AWR report
• Index maintenance may also add to Buffer Busy Waits in high OLTP systems
• For read request of a buffer currently read by another session, the wait event is now
called Read By Other Session and is not a contention issue
V$SEGMENT_STATISTICS

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 49


Buffer Cache Hit Ratio

• Hit ratio is a mark of how much result is retrieved


via Logical IO’s(via Buffer Cache)
• Is not a true marker of a well tuned database
• Hit ratio can be high or low and yet database can
perform optimally or poorly
• Hit ratio is one just one factor in determining
database performance
• Check AWR report for
• Instance Efficiency
• Load Profile
• If Hit ratio is consistently low, think about increasing
buffer cache size
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 50
Buffer Cache - Tuning Goals

• Buffer Cache should be adequately sized


• There should be less data accessed via Physical IO’s
• Pay attention to Logical IO’s
• Long waits should not happen for free buffers or related latches
• Though not really so mandatory but do look at the hit ratio not going
consistently down
• Anytime can avoid using buffer cache, do so!

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 51


Buffer Cache – Final Thoughts

• Buffer Cache configuration is now dynamic


• If the cache is too small, it may cause excessive PIO’s , LRU latch
contention, excessive DBWR contention
• To get an advice about the configuration, use DB Cache Advisor
(works for all buffer pools)
• Use AMM or ASMM
• Some operations can bypass Buffer Cache using direct path IO

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 52


Buffer Cache- Fun stuff

• Alter system flush buffer_cache;


• ORADEBUG

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 53


References

• https://www.amazon.com/Oracle-8i-Internal-Services-
Latches/dp/156592598X
• https://www.amazon.com/Oracle-Core-Essential-Internals-
Developers/dp/1430239549/
• http://www.ixora.com.au/

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 54


Thank You!

| @amansharmadb

| http://blog.aristadba.com

| amansharma@aristadba.com

Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 55

Potrebbero piacerti anche