Professional Documents
Culture Documents
Session 362
Arup Nanda
Longtime Oracle DBA
arup.blogspot.com
What is This?
RAC Performance Tuning
I teach a course Performance Tuning in RAC
Wait events are useful for understanding the bottlenecks
All single instance wait events are applicable to RAC
RAC has some special cases
This session talks about those RAC-specific wait events
This is just a subset of the events; not a comprehensive
list
Whats a Wait?
A process in Oracle can only be in three states
Doing something Useful (consuming CPU) .. U
Idle, waiting for some work to be assigned .. I
Waiting for something, e.g.
.. W
a block from disk
a lock
a latch (could be waiting on CPU)
Response time = U + I + W
We must accurately measure each component time
before we decide what and how to tune
Cluster Coordination
Buffer Cache
Buffer Cache
SCN1
SCN2
DBWR
DBWR
LMS
Checkpo
int!
LMS
Node 1
Checkpo
int!
Node 2
Database
DBWR must get a lock on the database block
before writing to the
disk.
This is called a
RAC
for Beginners
Block Lock.
Cache Fusion
Will get it via
interconnect
session1
Wants to
modify it
Instance 1
session2
Instance 2
5
Has
modified
it
Block
Grant
Queue
Convert
Queue
SID1
SID5
SID2
SID6
SID3
SID7
Master Instance
Only one instance holds the grant and
convert queues of a specific block
This instance is called Master Instance of
that block
Grant
Queue
Master instance varies for each block
SID1
The memory structure that shows the
SID2
master instance of a buffer is called Global
SID3
Resource Directory (GRD)
That is replicated across all instances
The requesting instance must check the
GRD to find the master instance
Then make a request to the master
instance for the lock
Wait Events in RAC
Block
Convert
Queue
SID5
SID6
SID7
Scenario 1
Sessi
on
Instance 1
Instance 2
D
B
Cache Fusion
Buffer Cache
Buffer Cache
SMON
SMON
LMS
Node 1
LMS
Node 2
messa
ge
buffer
Grant Scenario 2
1. Check its buffer cache to see if the block exists
2. And the buffer is found. Can Instance1 use it?
Not really. The buffer may be old; it may have been changed
3.
3.
4.
5.
10
Grant Scenario 3
Instance 1 is the master
Then it doesnt have to make a request for the grant
In summary, here are the possible scenarios when
Instance1 requests a buffer
Instance1 is the master; so no more processing is
required
No one has the lock on the buffer, the grant is made
by the master immediately
Another instance has the buffer in an incompatible
mode. It has to be changed.
11
12
Placeholder Event
When the buffer is first requested, the session does not
know which of the three paths it will go on to
Therefore it is assigned a placeholder event
This event is known as gc cr block request (for
Consistent Read requests)
If the request is made for the buffer in Current mode, the
event is gc current block request
When one of the three options is chosen, the appropriate
event replaces the placeholder event
13
Grant Event
If the session merely requests a grant from the master:
It waits with the gc cr|current grant 2-way event
gc cr grant 2-way, for requests for buffers in
Consistent Read mode
gc current grant 2-way, for requests for buffers in
Current mode
14
gc file
current
block read
grant
2-way
request
db
scattered
Grant
Queue
Session
re
q
ue
s
t
LMS
GRD
GES
a
gr
LMS
Instance 2
Instance 1
Database
15
Conver
t Queue
SID
1
SID
5
SID
2
SID
6
SID
3
SID
7
ed
t
n
Block Event
After the request is made
and assuming that the buffer is not in the local cache
the buffer may be found in another instance
Requestor requests the buffer from the holding
instance
Possibilities:
Holder is also the master of that buffer
Holder is not the master
If the holder is the master, the requesting session waits
with the event gc cr|current block 2-way
16
gc
gccurrent
currentblock
block2-way
request
Grant
Queue
Session
LMS
GRD
LMS
GES
Instance 2
Instance 1
Database
17
Conver
t Queue
SID
1
SID
5
SID
2
SID
6
SID
3
SID
7
Grant
Queue
Session
Instance 2
Instance 1
Requestor
Wait Events in RAC
Instance 3
18
Conver
t Queue
SID
1
SID
5
SID
2
SID
6
SID
3
SID
7
Master
Holder
Wait Event is
19
Interpretation
Scenario
Interpretation
Tuning Implication
Faster interconnect
Shorten the run queue
gc
gccurrent
currentblock
block2-way
request
SID
1
Session
Session
LMS
LMS
GR
GR
D
D
Block
SID
5
SID
2
SID
6
SID
3
SID
7
LMS
LMS
Instance
Instance 2
2
GES
GES
Instance
Instance 1
1
G
r
a
n
t
Q
u
e
u
e
Database
21
C
o
n
v
e
r
t
Q
u
e
u
e
22
23
24
Thank You!
Session 362
More Information:
Blog: arup.blogspot.com
100 Things You Probably Didn't Know About Oracle
Database http://bit.ly/evr05e
Twitter: arupnanda
Wait Events in RAC
25