现在的位置: 首页 > 综合 > 正文

RAC的GES/GCS原理(1)

2013年09月07日 ⁄ 综合 ⁄ 共 7566字 ⁄ 字号 评论关闭

为了保证群集中的实例的同步,两个虚拟服务将被实现:全局排队服务(GES),它负责控制对锁的访问。全局内存服务(GCS),控制对数据块的访问。

GES 是 分布式锁管理器(DLM)的扩展,它是这样一个机制,可以用来管理oracle 并行服务器的锁和数据块。在一个群集环境中,你需要限制对数据库资源的访问,这些资源在单instance数据库中被latches 或者locks 来保护。比如说,在数据库字典内存中的对象都被隐性锁所保护,而在库高速缓存中的对象在被引用的时候,必须被pin所保护。

在RAC群集中,这些对象代表了被全局锁所保护的资源。GES 是一个完整的RAC组件,它负责和群集中的实例全局锁进行沟通,每个资源有一个主节点实例,这个实例记录了它当前的状态。而且,资源的当前的状态也记录在所有对这个资源有兴趣的实例上。

GCS,是另一个RAC组件,负责协调不同实例间对数据块的访问。对这些数据块的访问以及跟新都记录在全局目录中(GRD),这个全局目录是一个虚拟的内存结构,在所有的实例中使用扩张。

 

每个块都有一个master实例,这个实例负责对GSD的访问进行管理,GSD里记录了这个块的当前状态信息。GCS 是oracle 用来实施Cache fusion的机制。被GCS 和GES 管理的块和锁叫做资源。对这些资源的访问必须在群集的多个实例中进行协调。这个协调在实例层面和数据库层面都有发生。实例层次的资源协调叫做本地资源协调;数据库层次的协调叫做全局资源协调。

 

本地资源协调的机制和单实例oracle的资源协调机制类似,包含有块级别的访问,空间管理,dictionary cache、library cache管理,行级锁,SCN 发生。全局资源协调是针对RAC的,使用了SGA中额外的内存组件、算法和后台进程。

 

GCS 和GES 从设计上就是在对应用透明的情况下设计的。换一句话来说,你不需要因为数据库是在RAC上运行而修改应用,在单实例的数据库上的并行机制在RAC上也是可靠地。

 

支持GCS 和GES的后台进程使用私网心跳来做实例之间的通讯。这个网络也被Oracle 的 群集组件使用,也有可能被 群集文件系统(比如OCFS)所使用。GCS 和GES 独立于 Oracle 群集组件而运行。但是,GCS 和GES依靠 这些群集组件获得群集中每个实例的状态。如果这些信息不能从某个实例获得,这个实例将被关闭。这个关闭操作的目的是保护数据库的完整性,因为每个实例需要知道其他实例的情况,这样可以更好的确定对数据库的协调访问。

 

GES控制数据库中所有的 library cache锁和dictionary cache锁。这些资源在单实例数据库中是本地性的,但是到了RAC群集中变成了全局资源。全局锁也被用来保护数据的结构,进行事务的管理。一般说来,事务和表锁 在RAC环境或是 单实例环境中是一致的。

 

Oracle的各个层次使用相同的GES 功能来获得,转化以及释放资源。在数据库启动的时候,全局队列的个数将被自动计算。

GES 使用后台进程 LMD0和LCK0来执行它的绝大多数活动。一般来说,各种进程和本地的LMD0 后台进程沟通来管理全局资源。本地的LMD0 后台进程与 别的实例上的 LMD0进程进行沟通。

LCK0 后台进程用来获得整个实例需要的锁。比如,LCK0 进程负责维护dictionary cache 锁。

 

 

影子进程(服务进程) 与这些后台进程通过AST(异步陷阱)消息来通信。异步消息被用来避免后台进程的阻塞,这些后台进程在等待远端实例的的回复的时候将阻塞。后台进程也能 发送 BAST(异步锁陷阱)来锁定进程,这样可以要求这些进程把当前的持有锁置为较低级限制的模式。

 

 

英文原文/翻译

In order to archive synchronization between the instances of a cluster,two virtual services are implemented :The
Global Enqueue Service(GES),which controls access to locks,and the Global Cache Service(GCS),which controls access
to blocks.
为了保证群集中的实例的同步,两个虚拟服务将被实现:全局排队服务(GES),它负责控制对锁的访问。全局内存服务(GCS),控制对数据块的访问。

The GES is a development of the Distributed Lock Mnanager(DLM),which was the mechanism used to manage both locks and
blocks in Oracle Parallel Server(OPS).Within a clustered enviroment,you need to restrict access to database resources
that are typically protected by latches or locks in a single-instance database.
GES 是 分布式锁管理器(DLM)的扩展,它是这样一个机制,可以用来管理oracle 并行服务器的锁和数据块。在一个群集环境中,你需要限制对数据库资源的访问,这些资源在单instance数据库中被latches 或者locks 来保护。
For example,objects in the dictionary cache are protected by implicit locks,and objects in the library cache must be
protected by pins while they are being referenced.
比如说,在数据库字典内存中的对象都被隐性锁所保护,而在库高速缓存中的对象在被引用的时候,必须被pin所保护。
In a RAC cluster,these objects are represented by resources that are protected by global locks.
在RAC群集中,这些对象代表了被全局锁所保护的资源。
GES is an integrated RAC component that coordinates global locks between the instances in the cluster.
GES 是一个完整的RAC组件,它负责和群集中的实例全局锁进行沟通,
Each resource has a master instance that records its current status.In addtion,the current status is recorded in all
instances with an interest in that resource.
每个资源有一个主节点实例,这个实例记录了它当前的状态。而且,资源的当前的状态也记录在所有对这个资源有兴趣的实例上。

The GCS,which is another integrated RAC component,coordinates access to database blocks by the varous instances.Block
access and update are recorded in the Global Resource Directory(GRD),which is a virtual memory structure spanning across
all instances.
GCS,是另一个RAC组件,负责协调不同实例间对数据块的访问。对这些数据块的访问以及跟新都记录在全局目录中(GRD),这个全局目录是一个虚拟的内存结构,在所有的实例中扩张。
Each block has a master instance that matains an entry in the GRD describing the current status of the block.GCS is the
mechanism that Oracle uses to implement Cache Fusion.
每个块都有一个master实例,这个实例负责对GSD的访问进行管理,GSD里记录了这个块的当前状态信息。GCS 是oracle 用来实施Cache fusion的机制。
The blocks and locks maintained by GCS and GES are known as resources.Access to these resources must be coordinated between all instances in the cluster.This coordination occurs at both instance level and database level.Instance-level resource
coordination is known as local resource coordination;database-level coordination is known as global resource coordination.
被GCS 和GES 管理的块和锁叫做资源。对这些资源的访问必须在群集的多个实例中进行协调。这个协调在实例层面和数据库层面都有发生。实例层次的资源协调叫做本地资源协调;数据库层次的协调叫做全局资源协调。

Local resource coordination in a RAC instance is identical to that in single-instance Oracle and includes block level
access,space management,dictionary cache and library cache management,row-level locking,and System Change Number(SCN) generation.Global resource coordination is specific to RAC and uses additional SGA memory structures,algorithms,and
background processes.
本地资源协调的机制和单实例oracle的资源协调机制类似,包含有块级别的访问,空间管理,dictionary cache、library cache管理,行级锁,SCN 发生。全局资源协调是针对RAC的,使用了SGA中额外的内存组件、算法和后台进程。

Both GCS and GES are designed to operate transparently to application . In other words,you do not need to modify
applications to run on a RAC cluster,as the same concurrency mechanisms are available in RAC as are found in single-instance
Oracle databases.
GCS 和GES 从设计上就是在对应用透明的情况下设计的。换一句话来说,你不需要因为数据库是在RAC上运行而修改应用,在单实例的数据库上的并行机制在RAC上也是可用地。

The background processes that support GCS and GES use the interconnect network to communicate between instances.This network is also used by Oracle Clusterware and may optionally be used by the cluster file system(e.g OCFS) GCS and GES operate independently of Oracle clusterware .

支持GCS 和GES的后台进程使用私网心跳来做实例之间的通讯。这个网络也被Oracle 的 群集组件使用,也有可能被 群集文件系统(比如OCFS)所使用。
GCS 和GES 独立于 Oracle 群集组件而运行。但是,GCS 和GES依靠 这些群集组件获得群集中每个实例的状态。如果这些信息不能从某个实例获得,这个实例将被关闭。这个关闭操作的目的是保护数据库的完整性,因为每个实例需要知道其他实例的情况,这样可以更好的确定对数据库的协调访问。

 

 

Global Enqueue Services
In a RAC database,GES is responsible for interinstance resource coordination.GES manages all non-Cache Fusion  intro-instance
resource operations.It tracks the status of all Oracle enqueue mechanisms for resources that are accessed by more than
one instance.Oracle uses GES enqueues to manage concurrency for resources operating on transactions,tables,and other
structures with a RAC enviroment.GES is also responsible for deadlock detection.

全局队列服务
在一个RAC数据库中,GES 是对 实例间资源协调负责的。GES 负责所有的非 cache fusion 实例间资源操作。它将跟踪所有的被两个 以上实例访问的 Oracle 资源队列 机制。Oracle 使用GES 队列来访问 并行的资源,这些资源被 事务、表和RAC环境下其它组件所使用。GES 也负责对死锁进行检测。

 

GES controls all library cache locks and dictionary cache locks in the database.These resources are local in a
single-instance database but global in a RAC database.Global locks are also used to protect the data structures
used for transation management.In general ,transation and table lock processing operate the same way in RAC as
they do in single-instance Oracle databases.

GES控制数据库中所有的 library cache锁和dictionary cache锁。这些资源在单实例数据库中是本地性的,但是到了RAC群集中变成了全局资源。全局锁也被用来保护数据的结构,进行事务的管理。一般说来,事务和表锁 在RAC环境或是 单实例环境中是一致的。

 

ALL layers of Oracle use the same GES functions to acquire,convert,and release resources.The number of global enqueues
is calculated automatically at start-up.
As with enqueues on single-instance Oracle ,deadlocks may occur with global enqueues in a RAC cluster.For example,
Instance 1 has an exclusive lock on Resource A,and Instance 2 has an exclusive lock on Resource B.This deadlocak
situation will be detected by the LMD0 back-ground process,which will write an error message to the alert log,
for example:
Global Enqueue Services Deadlock detected.More info in file /u01/app/oracle/admin/RAC/bdump/rac1_lmd0_25084.trc

 

Oracle的各个层次使用相同的GES 功能来获得、转化以及释放资源。

 

Background Processes

GES performs most of its activities using the LMD0 and LCK0 background processes.In general ,processes communicate
with their local LMD0 background process to manipulate the global resources.The local LMD0 background process
communicates with the LMD0 processes on other instances.

GES 使用后台进程 LMD0和LCK0来执行它的绝大多数活动。一般来说,各种进程和本地的LMD0 后台进程沟通来管理全局资源。本地的LMD0 后台进程与 别的实例上的 LMD0进程进行沟通。

 

The LCK0 background process is used to obtain locks that are required by the entire instance.For example,LCK0 is
responsible for maintaining dictionary cache locks.

LCK0 后台进程用来获得整个实例需要的锁。比如,LCK0 进程负责维护dictionary cache 锁。

 

Server processes communicate with these background processes using messages known as Asynchronous Traps(AST).
Asynchronous messages are used to avoid the background processes having to block while they are waiting for
replies from instances on remote nodes.Background processes can also send Blocking Asynchronous Traps(BAST)
to lock holding processes to request that they downgrade a currently held lock to a less restrictive mode.

影子进程(服务进程)  与这些后台进程通过AST(异步陷阱) 消息来通信。异步消息被用来避免后台进程的阻塞,这些后台进程在等待远端实例的的回复的时候将阻塞。后台进程也能 发送 BAST(异步锁陷阱)来锁定进程,这样可以要求这些进程把当前的持有锁置为较低级限制的模式。

抱歉!评论已关闭.