全部博文(413)
分类: Oracle
2013-02-09 14:39:22
cache coherency
The synchronization of data in multiple caches so that reading a memory location through any cache will return the most recent data written to that location through any other cache. Sometimes called cache consistency.
A diskless cache coherency mechanism in Oracle Real Application Clusters that provides copies of blocks directly from a holding instance's memory cache to a requesting instance's memory cache.
Oracle RAC databases have two or more database instances that each contain memory structures and background processes. An Oracle RAC database has the same processes and memory structures as a single-instance Oracle database as well as additional process and memory structures that are specific to Oracle RAC. Any one instance's database view is nearly identical to any other instance's view within the same Oracle RAC database; the view is a single system image of the environment.
Each instance has a buffer cache in its System Global Area (SGA). Using Cache Fusion, Oracle RAC environments logically combine each instance's buffer cache to enable the instances to process data as if the data resided on a logically combined, single cache.
The SGA size requirements for Oracle RAC are greater than the SGA requirements for single-instance Oracle databases due to Cache Fusion.
To ensure that each Oracle RAC database instance obtains the block that
it needs to satisfy a query or transaction, Oracle RAC instances use two
processes, the Global Cache Service (GCS) and the Global Enqueue Service (GES). The GCS and GES maintain records of the statuses of each data file and each cached block using a Global
Resource Directory (GRD). The GRD contents are distributed across all
of the active instances, which effectively increases the size of the
System Global Area for an Oracle RAC instance.
After one instance caches data, any other instance within the same cluster database can acquire a block image from another instance in the same database faster than by reading the block from disk. Therefore, Cache Fusion moves current blocks between instances rather than re-reading the blocks from disk. When a consistent block is needed or a changed block is required on another instance, Cache Fusion transfers the block image directly between the affected instances. Oracle RAC uses the private interconnect for inter-instance communication and block transfers. The Global Enqueue Service Monitor and the Instance Enqueue Process manages access to Cache Fusion resources as well as enqueue recovery processing.
These Oracle RAC processes and the GRD collaborate to enable Cache
Fusion. The Oracle RAC processes and their identifiers are as follows:
LMS (lock manage service) — Global Cache Service Process
LMD (lock manage daemon) — Global Enqueue Service Daemon
LMON (lock monitor) — Global Enqueue Service Monitor
LCK0 (lock) — Instance Enqueue Process
Global Cache Service (GCS)
Process that implement Cache Fusion. It maintains the block mode for blocks in the global role. It is responsible for block transfers between instances. The Global Cache Service employs various background processes such as the Global Cache Service Processes (LMSn) and Global Enqueue Service Daemon (LMD).
Global Cache Service Processes (LMSn)
Processes that manage remote messages. Oracle RAC provides for up to 10 Global Cache Service Processes. The number of LMSn varies depending on the amount of messaging traffic among nodes in the cluster. (其实就是负责block在不同instance之间的传输。)
Global Enqueue Service (GES——就是分布式锁服务)
A service that coordinates enqueues that are shared globally. (本质就是:协调一个全局共享队列 的服务)
Global Enqueue Service Daemon (LMD)
The resource agent process that manages requests for resources to control access to blocks. The LMD process also handles deadlock
detection and remote resource requests. Remote resource requests are
requests originating from another instance.(通过管理对资源的请求,从而控制对block的访问——实际上就是分布式锁。)
总结:
GES服务是协调一个全局共享队列,那么这个全局共享队列是什么队列呢?是一个 request 队列。各个request,让过LMD这个代理进程来进行排队,然后 LMSn 进程才是真正的处理进程,他从这个队列中,一个一个的取出request,进行处理:也就是在不同实例间传输cache buffer,从而实现cache fusion. 同时LMD也处理死锁侦测。
Global Enqueue Service Monitor (LMON)
The background LMON process monitors the entire cluster to manage global resources. LMON manages instance deaths and the associated recovery for any failed instance. In particular, LMON handles the part of recovery associated with global resources. LMON-provided services are also known as Cluster Group Services. (LMON提供了RAC层的集群功能,不同于底层crs的集群功能。)