Technical article 101712

What are opportunistic locks and how are they related to performance ?

OpenServer 5.0.0

Written · Last revised

Problem

What are opportunistic locks ?

Solution

An opportunistic lock is a performance enhancement that
was implemented into the SMB protocol several years ago.
The way in which an opportunistic lock works is as
follows.  When a client opens a file, the protocol will
automatically lock it in order to prevent other processes
from writing to it.  Once it has the file locked, the
client is able to be flexible about how it does its reads
and writes to the file.
This method of locking is called 'opportunistic' because
the user has not actually requested a file lock.  LAN Manager
does it on the user's behalf.
With the file safely locked, the client can cache data.
For instance,  if the user requests a 1 byte read, the client
can actually read 1K, or 4K, and cache the data locally to
satisfy potential future reads.  The same is true for writes.
A small write does not have to go over the network; it goes
into a cache on the client side.  Four 1K writes is a major
performance loss compared with one 4K write.
Opportunistic locks Implementation
----------------------------------
-----------------------------------------------------
Product                   Opportunistic Locks Support
-----------------------------------------------------
Lan Manager 1.x                    Yes
-----------------------------------------------------
Lan Manager 2.x                    No
-----------------------------------------------------

In order to improve the performance of file access on a Lan Manager 2.x server (for example, when loading an application like MS Winword from the server), the application files on the server can be made read-only as a workaround.

Opportunistic locks will be implemented in a future release of the product.

From the Xinuos technical article database, record 101712. Reproduced with permission. The original is at www.sco.com/ta/101712, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.