Cache fusion (1)

Source: Internet
Author: User

These two days I learned about RAC's cache fusion and sorted out the last notes of the year ago.

In the RAC environment, each instance has its local buffer cache, which is the same as that in a single instance database. However, instance a requires a data block and the data block is being operated by instance B. In this case, it needs to be accessed through the interconnect mechanism, that is, cache fusion.

Cache fusion solves concurrency issues through the shared cache. In the cache fusion algorithm, when an instance requests to modify a data block, instances that are currently modifying the data block do not need to be written to the disk, reducing the I/O overhead of disk write operations. The concurrency control of cache fusion greatly improves database performance and reduces more management in the RAC environment.

 

Let's introduce several definitions:

GCS (Global cache service)Global cache service: it is the main mechanism for maintaining cache coherency among multiple caches. It is the core concept of cache fusion. When an instance needs to access a data block, requests are sent to GCS. Background process LMS

Tracking: tracking data blocks; tracking all statuses in the queue mechanism

Accepting: Accept data block requests;

Informing: notifies the instance holding the resource to release the lock on the data block or send the CR image; notifies the instance holding or status pi

Coordinating: coordinating data blocks through interconnect to forward data between different instances

GES (Global enqueue Service)The global Queue Service manages dictionary cache locks, library cache locks, and transactions to realize the concurrency of resources used by multiple instances, including:

Transaction locks (transaction locks)-In this mode, the transaction will be released after it is committed or rolled back.

Library cache locks-when parsing and compiling SQL, DML, DDL, PL/SQL, Java statements, reference database objects (tables, views, processes, functions, packages, packages, triggers, this lock is required for indexes, clusters, and synonyms.

In the dictionary cache locks-RAC, Oracle synchronizes all dictionary caches throughout the cluster, using latches.

Table locks-null (N), row share (RS), row exclusive (RX), share lock (s), share row exclusive (SRx ), or exclusive (X ).

GRD (Global Resource dictionary)Global Resource Directory, jointly maintained by GCS and GES (can be considered as a memory database), stores the block information in the current cache (data block address, instance of the latest version, mode, role, SCN, pi ).

GRD records the location of the latest database, block mode and role. All resource requests and forwarding in cache fusion are stored in GRD. GRD is a distributed resource stored in SGA. Each instance contains a part of GRD resources.

Mode and role information are maintained in GRD.

GRD resources have three modes:NULL (n) mode,Shared (s) Mode,Exclusive (x) Mode

NULL (n) Mode

Shared (s) mode:The sharing mode indicates that the current instance session has read data blocks but has not been modified.

Exclusive (x) Mode: The exclusive mode indicates that the database cannot be modified by another instance. The current instance session excludes the data block and the database can be read in a consistent manner.

GRD resources have three role types:Local,Global

Local:The database is read into the memory for the first time, and there is only one image of the data block.

Global: The dirty buffer is sent to the new request instance (requesting instance) on the resource holding instance (PI). At this time, the global role is required.

In summary, sl0 can be used to represent shared mode, local role, and 0 pi.

Pi (past image)Chen Xiang is the data block image stored in the buffer cache before data blocks are written to the disk. It appears in write-write concurrency.

Instance a reads data block D1 into a's buffer cache, and instance B also wants to read data block D1 and cache fusion. instance a transfers D1 to instance B. At this time, d1 in the buffer cache of A becomes a "Chen Xiang ". This is called "Chen Xiang" because instance B is currently requested and instance B may modify D1, the D1 PI in a is no longer the latest version, that is, a "Chen Xiang" (dirty buffer block.

The advantage of cache fusion is that when multiple instances concurrently access the same data block, you do not need to wait for the current instance to finish writing the data block to the disk. You can copy the data block that has been modified but not written to the disk from the buffer cache to another instance, in this way, the concurrency of multiple instances will have different PI versions on multiple instances.

These different PI versions can be used again when an instance is down.

When the data block modification is written to the disk, all PI on all instances will be cleared, and the logs related to the PI in the redo log can also be overwritten.

CR imageConsistent read image, in the read-write concurrency.

Pi is stored in the buffer cache of the resource-holding instance, and CR image needs to be sent to the new request instance (requesting instance.

For more information, see consistent read)

Transaction T1 is modifying D1, and transaction T2 wants to read D1; If T1 does not have commit, T2 needs a Cr block. Cr blocks are dirty data blocks read from undo segment/Buffer Based on SCN.

In RAC, as you need to access the Undo segment on different instances, creating a CR image will produce additional I/O overhead.

 

It took me one afternoon to sort out this. I read a lot of documents, blogs, and learned the knowledge through a powerful network. So I also hope to contribute a little bit and hope it will be useful.

In fact, the more you read, the less you know ..

If you are not busy tomorrow, list the usage scenarios of cache fusion.

I found a good book and made an advertisement ~, More than five hundred, it is a little expensive.

Oracle 10GGrid & Real Application Clusters
Oracle10GGrid computing with RAC

Mike Ault, Madhu tumma

 

[Reference ]:

1. http://www.dba-oracle.com/t_gupta_oracle_rac_cache_fusion.htm

2. http://avdeo.com/2008/07/21/oracle-rac-10g-cache-fusion/

3.

Http://www.remote-dba.net/t_rac_real_application_clusters_components.htm

4. http://www.manotes.net /? P = 213

5. http://docs.oracle.com/cd/B10501_01/rac.920/a96597/pslkgdtl.htm

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.