RAC Cache Fusion principle understanding, racfusion

Source: Internet
Author: User

RAC Cache Fusion principle understanding, racfusion
Cache fusion. grd. drm. gcs. ges


Cache fusion
1. RAC is a database running on multiple instances. It uses the Distributed Lock manager (DLM) to solve concurrency problems. Resources are shared among each node of RAC, to ensure data consistency among each node, you need to use DLM to coordinate resource competition among instances. This DLM is called Cache Fusion in RAC.


2. in cache Fusion, each data block is mapped to a Cache Fusion resource, which is actually a data structure. The resource name is the data block address. The data block request process: first, convert the data block address X to the Cache Fusion resource name, and then submit the cache fusion resource request to DLM and DLM for the Global Lock application and release activity, as long as the process has obtained the PCM Lock, it can continue to the next step, that is, the instance needs to obtain the right to use the data block.
(First convert the address to a cache fusion resource ----> submit the resource to DLM ----> to obtain the right to use the resource)


GRD
1. GRD (Global Resource Directory) can be seen as an internal database that records the distribution of each data block between clusters and is located in SGA of each instance, GRD in each instance SGA is merged into a complete GRD. The usage information of the resource on all nodes is recorded on the master node of RAC, and the usage information of each node is recorded on the current node.


DRM
1. DRM (Dynamic Resource Management). When resources of a non-MASTER node are frequently accessed, you can use DRM to promote the node to a master node and remaster the node to a master node.
2. problems caused by using DRM:
Experiment .....


GCS
1. GCS (Global cache service) Global cache service: it should be understood together with cache fusion. The global cache should be designed to be a data block. The global cache service maintains the cache consistency in the global cache region and ensures that a global lock resource can be obtained when an instance needs to modify a data block at any time, this prevents another instance from modifying the block at the same time. The instance to be modified will have the current version of the block (including committed and uncommitted transactions) and the block's front image (post image ). If another instance also requests the block, the global cache service is responsible for tracking the instance with the block, the version of the block, and the mode in which the block is in. The LMS process is a key component of the global cache service.
2. LMSn (lock manager sercive) is responsible for transferring data blocks between instances. It is controlled by the GCS_SERCER_PROCESSES parameter. The default value is 2 and the value range is 0-20.


GES
1. GES (Global enqueue service) Global Queue service: mainly responsible for maintaining dictionary cache and database cache consistency. Dictionary cache is the cache of Data Dictionary information stored in the instance's SGA for high-speed access. Because the dictionary information is stored in the memory, the dictionary modifications (such as DDL) on a node must be immediately transmitted to the dictionary cache on all nodes. GES is responsible for handling the above situation and eliminating the differences between instances. For the same reason, in order to analyze the SQL statements that affect these objects, the database cache lock on the objects in the database is removed. These locks must be maintained between instances, and the global queue service must ensure that no deadlock exists between multiple instances that request access to the same object. The LMON, LCK, and LMD processes work together to implement the global queue service function. GES is an important service for adjusting other resources between nodes in the RAC environment in addition to the maintenance and management of data blocks (completed by GCS.
2. LMON
The LMON process of each instance regularly communicates with each other to check the health status of each node in the cluster. When a node fails, it is responsible for cluster reconstruction, GRD recovery, and other operations. The services it provides are called: cluster Group Services (CGS ).
LMON mainly uses two heartbeat mechanisms to perform health checks:
1-Network Heartbeat between nodes: It can be imagined that the node sends a ping packet regularly to check the node status. If a response can be received within the specified time, the status is considered normal.
2-control the disk Heartbeat of a file; each node's CKPT process updates a data block of the control file every three seconds. This data block is called Checkpoint Progress Record, control files are shared, so instances can check each other for timely updates.


3. LCK
This process is responsible for Synchronous access to Non-cache fusion resources. Each instance has an LCK process.
4. LMD
This process is responsible for Global Enqueue Service (GES). Specifically, this process is responsible for coordinating the access sequence of data blocks among multiple instances to ensure consistent data access. It works with the GCS service of the LMSn process and GRD to form the core function CACHE fusion of RAC.


Global Resource Directory is managed by Global Cache Service.
Record the resource mode, the resource role, the status of the block in the instance, publish the master of the resource on each active node, and re-publish the master when necessary (for example, start and close the instance)


Global Cache Service
1. Resource mode: Three Types
Null (default)
Share (s) (query)
Exclusive (x) (the block content can be changed, and other instances are null mode ).
2. Resource roles
Local: the initial test mode of the first request for resources. Only one instance can have the dirty copy of this block.
Global: When a block is dirty in multiple instances, the local Block becomes a Global block and can only be written to a disk by the Global Cache Service.


Transfer of Cache Fusion Block
For example, there are four ABCD nodes, Global Cache Service: GCS.
1. Read with no transfer
If the c node needs to read a block from the shared disk file, it sends a request to the Global Cache Service. At this time, the request is directed to node D, D is the MASTER of the BLOCK (each resource has a master ). GCS authorizes the resource to Share Mode and local Role, records its status in the directory (directory in node D), and notifies C and C to change the resource from null to share. C starts I/O, and now C has this BLOCK to read from the disk file in SHARE mode.


2. Read to write transfer
B Also needs this block, not only reading, but also changing its content. B sends a request to the GCS of the master of D (this block). The GCS sends a request to C, asking C to give the block to B, and C to give the block to B. After B receives the request, tell GCS that B can modify the block now.

3. Write to write transfer
A sends A request to the GCS of node D. The GCS tells Node B to discard the Exclusive lock and upload the current Image to A. If the request is not completed, it will be placed in the GCS queue. B uploads the block to A. At this time, it needs to write the Log, force lg flush, and change the mode to null. Send to A and tell it that the Exclusive resource is ready for use. When A receives the image of the block, it will notify GCS and tell it that the block status is exclusive. At this time, B cannot operate on the block, although in its buffer cache, it also has the copy of the block.

4. Write to read transfer
C needs to read this block and first sends A request to D (Master). GCS requires A to transmit it to C, and A receives the request to complete its work, this may occur before A writes LOG and log flush sends the block. A will lower its Exclusive lock to the share mode. C retrieves the SCN of the block received by A and constructs A Resource Assumption information to update Global Resource Directory for GCS.

You can disable cache fusion by setting the gc_files_to_locks parameter.
Cache resource does not need to continue the master on a node. dynamic Remastering can move it to different nodes.


Problem:
1. When all instances do not read the block, but the first instance reads the block, how is the lock applied and what lock is applied? If another instance needs to read this block at this time, it is almost the same time, So how should oracle handle arbitration and how to make one read, and the other one gets it from the cache of the former?
2. If a block has been read by another instance, how can this instance determine its existence?
3. If an instance changes the data block, will the change be passed to another instance, or will other instances know and update the status again?
4. if an instance needs to swap out a block, and other instances also have this block cache, modified and unmodified, modified and modified in this instance, what should I do? Truncate: What is the difference between dropping a table and a single instance?
5. How should we design applications so that rac can actually play a role, rather than introducing competition, leading to system weakening?
6. Implementation of RAC locks. A lock is a resource retained in the SGA of each instance and is usually used to control access to database blocks. Each instance usually retains or controls a certain number of locks related to the block range. When an instance requests a block, the block must obtain a lock and the lock must come from the instance currently controlling the lock. That is, the locks are distributed on different instances. To obtain a specific lock, you must obtain it from different instances. However, in this process, these locks are not fixed on an instance, but are adjusted to the most frequently used instance based on the request frequency of the lock to improve efficiency.




1. an instance A needs to send A request to read the block to GCS. master instance B of the block authorizes the resource to share mode through GCS and records the status on master node B, then, change node A of the notification request from null to share to start I/O,
In this case, the node A that requests the resource adds the SHARE lock. If another instance C needs to read the block, it notifies master node B of the GCS and requires A to send the block to C.
2. when an instance requests a block, it needs to access the master node of the block. At this time, the master node of the block will track the instances that own the block through GCS. What is the version of the block, and the mode in which the block is located. There are records in the master node.
3. if an instance changes the data block, the disk heartbeat mechanism in the LMON process of GES works. Each node's CKPT process updates a data block of the control file every three seconds, and the control file is shared, to check for timely updates.
4. view the current status of the block on the master node. If the modified block is before LOG writing and log flush, the block owned by the current node will be reduced from the exclusive lock to the share lock.
5. Implemented through GCS and GES.


Reference blog: http://www.cnblogs.com/sopost/archive/2013/03/14/2960490.html
Http://blog.csdn.net/tianlesoftware/article/details/5353087
Oracle RAC


What is oracle Database RAC?

RAC, full name: real application clusters.

It is a new technology used in the new version of Oracle Database, a type of high availability, and a core technology that Oracle Database supports the grid computing environment.

Advantages Oracle RAC mainly supports Oracle9i, 10g, and 11g versions, supports 24x7 effective database application systems, builds high-availability database systems on low-cost servers, and freely deploys applications, no need to modify the code. In the Oracle RAC environment, Oracle integration provides cluster software and storage management software, reducing application costs. When the application scale needs to be expanded, you can expand the system as needed to ensure system performance.
(1) multi-node load balancing;
(2) High Availability: Fault Tolerance and seamless switching, minimizing the impact of hardware and software errors;
(3) Improve Transaction Response time through parallel execution technology-usually used in data analysis systems;
(4) Increase the number of transactions and connections per second through horizontal scaling-usually for online transaction systems;
(5) reduce hardware costs. Multiple low-cost PC servers can be used to replace expensive minicomputers or mainframes, while saving maintenance costs;
(6) good scalability, convenient addition and deletion of nodes, and extended hardware resources.

Disadvantage (1) Compared with a single machine, the management is more complex and the requirements are higher;
(2) The performance is even worse than that of a single node in poor system planning and design;
(3) software costs may be increased (if a high-configuration pc server is used, Oracle charges fees based on the number of CPUs ).
Before Oracle9i, RAC is named OPS (Oracle parallel Server ). A large area between RAC and OPS is that RAC uses the Cache Fusion technology. In OPS, data requests between nodes need to write data to the disk before the requested node can read the data. When Cache fusion is used, the data buffer of each node of RAC transmits data blocks through a high-speed, low-latency internal network.

What is oracle rac?

RAC, short for real application clusters, is a new technology used in the new version of Oracle database and a type of high availability, it is also the core technology for Oracle databases to support grid computing environments. Oracle RAC
Oracle RAC supports Oracle9i, 10g, and 11g versions, supports 24x7 effective database application systems, builds high-availability database systems on low-cost servers, and freely deploys applications, no need to modify the code.
In the Oracle RAC environment, Oracle integration provides cluster software and storage management software, reducing application costs. When the application scale needs to be expanded, you can expand the system as needed to ensure system performance.
Oracle RAC Components
In an application environment, all servers use and manage the same database to distribute the workload of each server. The hardware requires at least two servers, A shared storage device is also required. At the same time, two types of software are required: Cluster software and RAC components in the Oracle database. At the same time, the operating systems on all servers should be the same type of OS. According to the Configuration Policy of Server Load balancer, after a client sends a request to the listener of a service, based on our load balancing policy, this server may send requests to the RAC components of the Local Machine for processing or to the RAC components of another server for processing. After processing the requests, RAC accesses our shared storage devices through cluster software.
Logically, each node in the cluster has an independent instance that accesses the same database. Nodes communicate with each other through the communication layer of the cluster software. At the same time, a global cache service exists to reduce IO consumption. Therefore, each database instance retains the same database cacheI
RAC features:
Each node instance has its own SGA
Each node instance has its own background process.
Each node's instance has its own redo logs
Each node instance has its own undo tablespace.
All nodes share one copy of datafiles and controlfiles.
A Cache fusion technology is also proposed)
There are two purposes:
01. Ensure cache consistency
02. Reduce disk I/O consumption
Therefore, multiple nodes in the RAC environment retain the same database CACHE.
How Cache fusion works:
****************************************
01. One node reads a block from the shared database to the database cache.
02. This node performs cross db block copy on all nodes
03. When the cache of any node is modified, the cache is modified between nodes.
04. In order to achieve consistent storage, the final modification results will also be written to the disk.
ClusterWare component
*******************
Four services
Crsd-Cluster Resource Service
Cssd-cluster Synchronization Service
Evmd-Event Management Service
Oprocd-node detection and monitoring
Three types of resources
VIP-Virtual IP Address)
OCR-Oracle Cluster Registry (Cluster registration file), which records information about each node
Voting Disk-Establishes quorum (Voting Disk). The arbitration mechanism is used to subscribe the behavior of multiple nodes simultaneously writing to the shared node, so as to avoid conflicts.
RAC Components
... The remaining full text>

Related Article

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.