All Products
Search
Document Center

Cloud Storage Gateway:How the file gateway cache disk works

Last Updated:Mar 26, 2026

The cache disk of a file gateway aggregates and caches data and metadata locally, enabling low-latency read/write access and asynchronous data upload to Object Storage Service (OSS).

How caching works

The cache disk is a cloud disk configured within the Cloud Storage Gateway. It aggregates and caches user data and metadata to accelerate file operations. The cache disk provides the following core capabilities:

  1. Write caching: The cache disk stores data written through the mount target. After a file is closed, the gateway uploads the cached data to OSS asynchronously. This mechanism supports both sequential and random write operations. After the upload completes, the gateway reclaims the corresponding cache space based on a predefined policy.

  2. Read caching: The cache disk stores recently read data to reduce latency for repeated file access. For large files, a pre-read mechanism loads data into the cache disk in advance to increase read bandwidth.

  3. Metadata caching: The cache disk stores metadata, such as the directory structure, to accelerate file system operations such as ls and stat. The gateway also provides flexible metadata synchronization mechanisms, including express sync, scheduled remote sync, and one-time remote sync, to meet data consistency requirements across different scenarios.

  4. Automatic eviction: The gateway automatically evicts cached data that has not been accessed for an extended period. Only the data is evicted. Metadata such as filenames, directory structure, and permissions is retained. This keeps cache disk usage at a healthy level, typically around 60%.

Note

The cache disk stores both data and metadata. Space is allocated proportionally: 80% for the data cache and 20% for the metadata cache.

Cache sizing guidelines

  1. Select a cache disk type.

    Match the cache disk type with your bandwidth and IOPS requirements. Ensure the cache disk performance aligns with the gateway specifications for optimal efficiency. For example, use an ESSD PL1 cache disk for Basic and Standard gateways, and an ESSD PL2 cache disk for Enhanced and Compute-optimized gateways.

  2. Select a cache disk capacity.

    When you select the cache disk capacity, consider the requirements for both data cache and metadata cache.

    • Data cache capacity depends on the concurrency and the maximum file size. To prevent write failures or performance degradation, ensure the available cache space for data meets the following condition: Available cache space > Concurrency x Maximum file size. For better performance, reserve an additional 30% of free space beyond this minimum.

    • The metadata cache stores file system structural information, including the following:

      • Directory hierarchy: The full directory tree structure.

      • File attributes: Properties such as size, creation time, and modification time.

      • Stub files: When the gateway evicts cached data for a file, it retains the file record in the metadata. This ensures a consistent view when users browse directories. When a user accesses an evicted file, the gateway automatically reloads the data from OSS into the cache.

      As a general guideline, a 100 GB cache disk can manage the metadata for approximately 10 million files.

  3. When the data cache or metadata cache runs out of space, the system triggers throttling alerts and insufficient metadata space alerts. To avoid business interruptions, scale out the cache disk promptly after you receive an alert to ensure stable and efficient gateway operation.