A core component of Oracle RAC Database is the Cache Fusion. Cache Fusion should not be intended as a merged buffer cache across all RAC instances. This is what many people thinks and what you may see but the reality is that each node has a private buffer cache and thought Cache Fusion blocks needed by other instances are sent using private interconnect in a complex distributed locking environment.
Cache Fusion Components - PING
Ping is the word used to describe the transfer of a block from instance's buffer cache to another. Process is quite interesting: when an instance needs a block sends a request to the lock master to obtain the desired lock type for that block. If requested block is already locked by other transaction/instance, master will ask to downgrade or release the current lock. This process is called blocking asynchronous trap, or somewhere simple BAST. An instance receiving the BAST usually try to downgrade or release the lock as soon as possibile and to do this many times block has to be flushed to disk. The whole process is called disk ping, or in some books, hard ping. However, from version 10g, when possible, instances try to send the block across private interconnect without write it to disk. Not always this operation is unexpensive. An high transfer of blocks across instances reveal a design problem and impact performances.
Deferred Ping is one method used by Oracle to reduce pinging. An instance receiving a BAST may defer to send the block or downgrade its current lock for a maximum of ten milliseconds. This time is used to complete the transaction and write at least block header. Doing this eliminate the need to check the transaction for the receiving instance. Consider that if you read a block header where is marked that a transaction is currently running the instance need to do some checks for example to undo data blocks and this another expensive operation.
Past Image Block (PI)
PI blocks are the copies of blocks recently modified that are sent to another instance due to a BAST. PI blocks are taken by the instance until blocks are flushed to disk by the current owner. When the instance currently owning the blocks write them to disk the Global Cache Services - GCS - tell to the other instances to discard the related PIs. Blocks are written to disk due to checkpoint. If checkpoint is issued from another instance is responsibility to GCS to find the most recent block image to write to disk.
Global Cache Services has a memory structure where stores informations about data blocks, this is called lock resource. Every instance tracks its locks and share them also with other instances. As this is a distributed process for each lock exists a Master node. Master node contains information about block, current user, locking request and PIs block. Whenever an instance need a block have to request a data block, it need to contact the master of lock resources. If master is not local, private interconnect will be used to send messages.
Lock combinations available are:
|NL0||Null Local and No past Images|
|SL0||Shared Local with no past image|
|XL0||Exclusive Local with no past image|
|NG0||Null Global – Instance owns current block image|
|SG0||Global Shared Lock – Instance owns current image|
|XG0||Global Exclusive Lock – Instance own current image|
|NG1||Global Null – Instance Owns the Past Image Block.|
|SG1||Shared Global – Instance owns past Image|
|XG1||Global Exclusive Lock – Instance owns Past Image.|
Remember to query view gv$bh to get block status.