Oracle Rac--cache Fusion

Source: Internet
Author: User

Cache Fusion

In practice, it is a block transfer between the SGA in each node of the cluster through the interconnection network, and the benefit is to avoid writing blocks to disk multiple times and re-reading them into the cache of other instances. When a block is read from the disk into the SGA of the first instance in the RAC environment, the block is given a lock resource (as distinct from the row-level lock) to let other instances know that the block is being used (or read), and when another instance requests the action of that block, the current instance SGA passes a copy of the block to the other instance , unchanged); If the in-memory block has been changed, but the change has not yet been committed, a CR copy is passed and the level of the corresponding lock resource is changed. Essentially, the database does not need to be written back to disk multiple times or read into the SGA of the relevant instance multiple times from disk, sharing and passing in the cache in each instance, thus avoiding the extra I/O that is spent in synchronizing the instance cache.


Application environment: when the Interconnect network speed is far greater than the disk I/O access speed.


Here is a description of some of the concepts in cache fusion


Global Cache Service (GCS): The global cache (SGA) involves data blocks. The global cache service is responsible for maintaining cache consistency within the global buffer store, ensuring that an instance can obtain a global lock resource at any time when it wants to modify a block of data, thereby avoiding the possibility of another instance modifying the block at the same time. The modified instance will have the current CP version of the block (both committed and uncommitted) and the Block's front image (post image). If another instance also requests the block, then the GCS is responsible for tracking the instance that owns the block, what version of the owning block, and what resource mode the block is in. The LMS process is a key component of the global cache service. (LMS for Lock Management Server process, for cache Fusion request delivery service between instances)


Global Queue Service (GES): primarily responsible for maintaining consistency within the dictionary cache and in the library cache. The dictionary cache is a cache of data dictionary information stored in an instance's SGA for high-speed access. Because the dictionary information is stored in memory, modifications to the dictionary (such as DDL) on a node must be propagated immediately to the dictionary cache on all nodes. GES is responsible for dealing with the above situation and eliminating the differences between instances. For the same reason, in order to parse the SQL statements that affect these objects, the library cache locks on the objects in the database are removed. These locks must be maintained between instances, and the global queue service must ensure that there are no deadlocks between multiple instances requesting access to the same object. The Lmon, lck, and LMD processes work together to implement the functionality of the Global queue service. GES is an important service that adjusts other resources among nodes in a RAC environment, in addition to the maintenance and management of the data block itself (completed by GCS).


1. Resource mode: three kinds
Null (default)
Share (S) (query)
Exclusive (X) (Modify the contents of the block, other instances are null mode)


2. Resource roles: Two

Local
First-time mode of requesting resources; Only one instance can have this block's dirty copy (that is, the metadata content of the disk data block)
Global
When a block becomes dirty in multiple instances, local becomes global and can only be written to disk by the GCS send request



Here's how the cache fusion block is transmitted.


Environment: A,b,c,d Four nodes, instance D has master resource permissions for the data block (each data block has a master)


    1. Read from No transfer

      Suppose that the SGA of four instances never caches the block, if node C needs to read a block to the shared data disk. Node C sends a request to GCS, at which point the request is directed to node D (because node D is the master of the data block), GCS changes the resource of the block to share mode (S) and local role and the GCs record State on the D node, and notifies the GCs of C that this resource pattern is taken from null- >share C begins the I/O read disk to read the block.

    2. Read to Write transfer

      b to read and write this data block, B's GCs sends a request to D, the GCs of D makes a request to C, asks C to give the data block to the B,c to pass the data block CP to B,b's GCs to modify the block mode Null->exclusive (X), and the other node mode is->null

    3. Write to write transfer

      A node also modifies the data block, A's GCs sends a request to D, the GCs of D points to B, and if the request is not completed at this point, it is placed in the GES queue, B cancels the modification and passes the block to a (which forces log flush) b to null A to receive the block and X lock, at this time, Although B has a block of CP, it cannot be modified because B block mode is NULL

    4. Write to Read transfer

      C to read Block,c's GCS sends a request to D, D points a,a to the lock of the block by X->share mode, C receives a block CP out of the SCN, updates the metadata block with the SCN of CP by GCS.


You can turn cache Fusion off by setting the parameter gc_files_to_locks.


When a block is read/written by another node when it is closed, it must wait for the instance node that occupies the block to commit and write back to the data file.


Note 1: When a new node is added/crashed, the lock resource of the original node is rebalanced

Note 2: When a node no longer needs master, the dynamic resource control process moves him to the node with the highest frequency of requests

This article is from the "8091532" blog, please be sure to keep this source http://8101532.blog.51cto.com/8091532/1587920

Oracle Rac--cache Fusion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.