Problem solve Get help with specific problems with your technologies, process and projects.

Configure opportunistic locking

A way to allow concurrent read operations on open files.



Configure opportunistic locking
Serdar Yegulalp

Opportunistic locking is a way of granting read access to a file on a Windows 2000 machine by more than one other client at a time. With op-lock enabled, as long as no write operations are attempted, clients can perform read-ahead operations that are cached locally; this accelerates operations on the files. The downside of opportunistic locking is that it comes with a slight performance hit. This is because the server granting the op-lock must manage breaking the lock when another user requests access to the same file that is locked.

Locking is enabled by default, but it can be toggled off, and editing the Registry can modify its parameters. To enable or disable opportunistic locking, open REGEDT32 and navigate to the key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MRXSmb\Parameters\ and look for the subkey OplocksDisabled (REG_DWORD). Set this to 0 to enable op-locking; set it to 1 to disable it.

To edit settings for op-locking, navigate to HKEY_LOCAL_MACHINESYSTEM\CurrentControlSet\Services\LanmanServer\Parameters and look for the following REG_DWORD values:

EnableOplocks: Set to 1 to enable op-locking for all clients; set to 0 to disable op-locking globally.

OplockBreakWait: A value in seconds, from 10-180, with a default of 35. Set this to change the time the server waits for clients to respond to a request to break an op-lock. This setting can be useful for slow connections.

MinLinkThroughput: Normally zero, calibrated in bytes per second. Set this to change the minimum throughput before the server disables op-locking.

MaxLinkDelay: Normally 60 seconds, but can be set from 0-100,000. Set this to turn off op-locking if link delays over the network exceed this number. This is useful if you have a great many WAN links to the server that are, say, hosted through slow dialup connections.

Serdar Yegulalp is the editor of the Windows 2000 Power Users Newsletter.

Dig Deeper on Windows client management