Cached Filesystem Binary Provider

cache-fs binary provider acts as a local LRU cache layer for remote filestores with configurable size and multiReadEnabled.

The cache-fs serves as a binary cache that uses LRU (Least Recently Used) as its cleanup protocol. This can improve Artifactory's performance since frequent requests will be served from the cache-fs (as in the case of the S3 binary provider).

The cache-fs binary provider is the filestore layer closest to Artifactory. If the filestore is mounted, place the cache-fs locally on the Artifactory server (if the filestore is already local, cache-fs provides no benefit). In an HA configuration, the cache-fs is mounted, and each node should have its own cache-fs layer.

cache-fs template configuration

If you choose to use the cache-fs template, your binarystore.xml configuration file should look like this:

<config version="v1">
        <chain template="cache-fs"/>
</config>

What's in the template?

While you do not need to configure anything else in your binarystore.xml, this is what the cache-fs template looks like under the hood.

<chain> <!-- template="cache-fs" -->
    <provider id="cache-fs" type="cache-fs">
        <provider id="file-system" type="file-system"/>
    </provider>
</chain>

This example sets the cache-fs size to be 10GB and its location (absolute path since it starts with a "/") to be /cache/filestore.

<config version="v1">
        <chain template="cache-fs"/>
        <provider id="cache-fs" type="cache-fs">
                <cacheProviderDir>/cache/filestore</cacheProviderDir>
                <maxCacheSize>10000000000</maxCacheSize>
        </provider>
</config>

Where:

Parameter

Description

type

cache-fs

maxCacheSize

The maximum storage allocated for the cache in bytes. maxCacheSize does not include files that are being uploaded (which are saved under cache/_pre); keep extra space for the _pre folder.

Default: 5000000000 (5GB)

cacheProviderDir

The root folder of binaries for the filestore cache. If the value specified starts with a forward slash (“/”) it is considered the fully qualified path to the filestore folder. Otherwise, it is considered relative to the baseDataDir.

Default: cache

maxFileSizeLimit

The maximum limit in bytes for a binary to be saved in the cache-fs layer. For example, if maxFileSizeLimit = 1000000000 (1GB), then any binary bigger than 1GB will not be saved in the cache-fs.

Default: None (no limit).

Available from Artifactory version 7.71.1.

skipDuringUpload

If this flag is set to true, binaries will not be saved in the cache-fs during upload requests but rather only when downloading a binary.

Default: false (binaries can be added during both download and upload requests)

Available from Artifactory version 7.71.1.

multiReadEnabled

Default: true

When true, optimizes the download of binaries by allowing multiple simultaneous requests for the same binary to be fulfilled from a single fetch operation, which reduces the load on the underlying storage.

validateChecksum

Default: true

When true, validates the checksum of the binary before moving the binary to the cache-fs folder.

tempDir

A temporary folder into which files are written for internal use by Artifactory. If the value specified starts with a forward slash ("/") the value is considered the full path to the temporary folder. Otherwise, it is considered relative to the cacheProviderDir under the baseDataDir.

📘

Note

Prior to Artifactory 7.98.2, tempDir was always relative to baseDataDir, and if tempDir had an absolute path in binarystore.xml (for example: /tmp), tempDir was set to $BASEDATADIR/filestore/tmp.

preCleanupEnabled

Default: false

This flag determines whether the cleanup of old dbRecord*.bin files in the cache provider’s _pre folder is enabled.

preCleanupIntervalSecs

Default: 86400 seconds (1 day)

Determines the interval (in seconds) of how often the cleanup of old dbRecord*.bin files in the cache provider’s _pre folder runs.

preCleanupThresholdSecs

Default: 86400 seconds (1 day)

The age threshold (in seconds) for when a file become valid for deletion during the cleanup process of dbRecord*.bin files in the cache provider’s _pre folder. If a file is older than this threshold, it will be removed during cleanup.

Example: NFS filestore with caching

The following example shows how you can configure an NFS filestore with caching.

<config version="v1">
  <chain>
    <provider id="cache-fs" type="cache-fs">
        <provider id="file-system" type="file-system"/>
    </provider>
  </chain>
  <provider id="cache-fs" type="cache-fs">
    <cacheProviderDir>/path/to/cache/dir</cacheProviderDir>
    <maxCacheSize>100000000000</maxCacheSize>
  </provider>
  <provider id="file-system" type="file-system">
    <fileStoreDir>/path/to/filestore/dir</fileStoreDir>
  </provider>
</config>

Create the folders specified in the configuration before starting Artifactory.

Related Topics

Frequently Asked Questions

This section provides answers to frequently asked questions.

FAQs
Q: Where should the cache-fs layer be placed in an HA configuration?

A: In an HA configuration the filestore is mounted, and each node should have its own cache-fs layer placed locally on that node. If the filestore is already local, cache-fs provides no benefit. See Cached Filesystem Binary Provider for configuration details.

Q: What is the default maximum cache size and how is it measured?

A: The default maxCacheSize is 5,000,000,000 bytes (5 GB). Note that maxCacheSize does not include files currently being uploaded, which are saved under the cache/_pre folder, so extra space should be reserved for that folder.

Q: Does maxCacheSize account for files currently being uploaded?

A: No. Files being uploaded are saved under cache/_pre and are not counted against maxCacheSize. You should keep extra space available for the _pre folder beyond what you set for the cache limit.

Q: What does maxFileSizeLimit control and from which Artifactory version is it available?

A: maxFileSizeLimit sets the maximum binary size in bytes that will be saved in the cache-fs layer. Any binary larger than this value is not cached. This parameter is available from Artifactory version 7.71.1.

Q: How does skipDuringUpload change when binaries are added to the cache?

A: When skipDuringUpload is set to true, binaries are only added to the cache during download requests, not during uploads. The default is false, meaning binaries can be added during both download and upload operations. This parameter is available from Artifactory version 7.71.1.