[Linux-cluster] Lock Resources

Christine Caulfield ccaulfie at redhat.com
Fri May 2 07:35:32 UTC 2008

Ja S wrote:
> Hi, All:
> I have downloaded "Programming Locking Applications"
> written by Christine Caulfield from
> http://sources.redhat.com/cluster/wiki/HomePage?action=AttachFile&do=view&target=rhdlmbook.pdf
> I read it through, especially the DLM locking model.
> It is very informative. Thanks Christine.
> Now I have some questions about the lock resource and
> wish to get answers from you.
> 1. Whether the kernel on each server/node is going to
> initialize a number of empty lock resources after
> completely rebooting the cluster? 
> 2. If so, what is the default value of the number of
> empty lock resources? Is it configurable?

There is no such thing as an "empty" lock resource. Lock resources are
allocated from kernel memory as required. That does mean that the number
of resources that can be held on a node is limited by the amount of
physical memory in the system. I think this addresses 3 & 4.

> 3. Whether the number of lock resources is fixed
> regardless the load of the server?
> 4. If not, how the number of lock resources will be
> expended under a heavy load?
> 5. The lock manager maintains a cluster-wide directory
> of the locations of the master copy of all the lock
> resources within the cluster and evenly divides the
> content of the directory across all nodes. How can I
> check the content held by a node (what command or
> API)?

On RHEL4 (cluster 1) systems the lock directory is viewable in
/proc/cluster/dlm_dir. I don't think there is currently any equivalent
in RHEL5 (cluster 2)

> 6. If only one node A is busy while other nodes are
> idle all the time,  does it mean that the node A holds
> a very big master copy of lock resources and other
> nodes have nothing?

That's correct. There is no point in mastering locks on a remote node as
it will just slow access down for the only node using those locks.

> 7. For the above case, what would be the content of
> the cluster-wide directory? Only one entry as only the
> node A is really doing IO, or many entries and the
> number of entries is the same as the number of used
> lock resources on the node A? If the latter case is
> true, will the lock manager still divide the content
> evenly to other nodes? If so, would it costs the node
> A extra time on finding the location of the lock
> resources, which is just on itself,  by messaging
> other nodes?

You're correct that the lock directory will still be distributed around
the cluster in this case and that it causes network traffic. It isn't a
lot of network traffic (and there needs to be some way of determining
where a resource is mastered; a node does not know, initially, if it is
the only node that is using a resource). That lookup only happens the
first time a resource is used by a node, once the node knows where the
master is, it does not need to look it up again, unless it releases all
locks on the resource.

I hope this helps,



More information about the Linux-cluster mailing list