All Products
Search
Document Center

File Storage NAS:Use oplocks in the SMB protocol

Last Updated:Dec 01, 2025

Oplocks are an important feature of the Server Message Block (SMB) protocol. Oplocks allow clients to cache data and read ahead locally, which reduces interactions with remote servers and significantly increases file access speed. Oplocks significantly improve performance in scenarios such as single-user file reading and writing, multi-user concurrent access, Internet Information Services (IIS) servers, genomics computing, and shared map applications.

Use cases

  • File writes on a single client

    When a single client writes files, the SMB client uses the write-back mode. Unlike the write-through mode, which writes small chunks of data to the backend with each operation, the write-back mode fully utilizes the local write cache. This reduces network communications and improves overall write efficiency.

  • Concurrent file reads on a single or multiple clients

    When only file read operations occur, all SMB clients use the read-ahead mode. In this mode, a client reads a batch of data ahead into the local read cache. This reduces network communications caused by data reads and improves overall read efficiency.

  • Frequent file opening and closing on multiple clients

    If multiple clients frequently open and close files, SMB clients use the delayed-close method. This reduces network communications caused by repeated file opening and closing and improves overall file access efficiency.

Usage notes

  • Data loss risk: Data in the cache may be lost if the client system crashes or a power failure occurs before the data is written back to the primary storage.

  • Write latency: Data is written to the cache quickly, but the write operations that sync to the primary storage may be delayed. This may not be suitable for scenarios that require high data consistency.

Enable oplock

Oplock is enabled by default. If you have previously disabled it, follow these steps to re-enable it.

  1. Log on to the NAS console.

  2. In the left-side navigation pane, choose File System > File System List.

  3. In the top navigation bar, select the resource group and region of your file system.

  4. Find the file system that uses the SMB protocol and click its file system ID, or click Manage in the Actions column.

  5. On the Basic Information tab, find the Advanced Options for SMB section and turn on the oplock switch.

Disable oplock

  1. Log on to the NAS console.

  2. In the left-side navigation pane, choose File System > File System List.

  3. In the top navigation bar, select the resource group and region of your file system.

  4. Find the file system that uses the SMB protocol and click its file system ID, or click Manage in the Actions column.

  5. On the Basic Information tab, find the Advanced Options for SMB section and turn off the oplock switch.