Saturday 3 March 2012

Opportunistic Locking & SMB2

What is Opportunistic Locking?

Opportunistic locking (oplocks) is a Windows-specific mechanism for client/server databases to allow multiple processes to lock the same file while allowing for local (client) data caching to improve performance over Windows networks. Unfortunately, the default setting of the oplocks mechanism that enhances the performance of one type of database (client/server) also introduces data integrity issues for other database types (file system/ISAM). Microsoft's documentation states "An opportunistic lock (also called an oplock) is a lock placed by a client on a file residing on a server. In most cases, a client requests an oplock so it can cache data locally, thus reducing network traffic and improving apparent response time. Oplocks are used by network redirectors on clients with remote servers, as well as by client applications on local servers" and "Oplocks are requests from the client to the server. From the point of view of the client, they are opportunistic. In other words, the server grants such locks whenever other factors make the locks possible.".

Related: Opportunistic Locks, Microsoft Developer Network (MSDN)


What Is SMB2?
SMB2 is the second generation of server message block (SMB) communication on Windows networks. SMB2 was introduced in Windows Vista and Windows Server 2008 to enable faster communication between computers that are running Windows Vista and Windows Server 2008. Previous Windows versions used SMB1, also called "traditional" SMB. SMB1 is still supported in current Windows versions (Vista, Server 2008, 7) for backward compatibility.



Disabling Oplocks on Windows Client PCs
To disable oplocks on a Windows client PC (a Windows PC that accesses an embedded database table hosted on another PC), change or add the following Registry values:
  • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MRXSmb\Parameters OplocksDisabled = 1

Disabling Oplocks on Windows Servers
To disable oplocks on a Windows server (a Windows PC that hosts an embedded database table accessed from another PC), change or add the following Registry values:
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters EnableOplocks = 0

Disabling Oplocks on SMB2
To disable SMB2 on a Windows Server 2008 or Windows Vista/7/8 PC hosting embedded database tables, change or add the following Registry value:
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters SMB2 = 0
Once SMB2 is disabled, SMB1 will be used again and the methods described above applied to disable oplocks for SMB1.

No comments:

Post a Comment