Metadata Cache Retrieval Period

How Remote Repository Metadata works

AuthorFullName__c
Patrick Russell
articleNumber
000004530
ft:sourceType
Salesforce
FirstPublishedDate
2019-08-23T07:13:48Z
lastModifiedDate
2024-03-10T07:49:26Z
VersionNumber
12
This setting can be found by navigating to Admin > Repositories > Remote > < Remote-repo > Advanced menu in both Artifactory 6.X and 7.X.

The Metadata Cache Retrieval Period (MCRP) option, the definition reads: "This value refers to the number of seconds to cache metadata files before checking for newer versions on remote server. A value of 0 indicates no caching." This setting affects each repository type differently. For example, in Maven repositories, it causes Artifactory to check for new maven-metadata.xml files every 600 seconds. In PyPI, the simple.html file is updated using the same timestamp.

Accordingly, Artifactory doesn't need to read individual metadata files. It just passes along fresh metadata to the client, the client then does the processing to make its next requests. Using PyPI as an example, the sequence looks as follows:

User-added image

1. A user runs a pip install against Artifactory

a. The pip client requests the artifactory.com/artifactory/api/pypi/pypi-remote/simple HTML page

b. Artifactory's Metadata Cache Retrieval Period has expired, so it serves an updated HTML page. There's a slight delay as it has to re-download the file. If the MCRP has not expired, the cached file is sent instead.

2. Based on the simple HTML metadata, the pip client requests the desired package binaries

a. Artifactory sends the file from its remote cache to the client, pypi.org is skipped here.

However, this can present a problem. For example, consider the possibility of a developer uploading a package to a remote site. What would happen if they tried to download it through Artifactory right after the upload?

In this example situation, the package won't be present in Artifactory's copy of the metadata and the developer would receive a 404 Not Found error.

The solution to this problem is built into the Artifactory UI. The Zap Cache function resets the MCRP for the whole remote, thus assuring that fresh metadata is sent to the client after the Zap:

User-added image
This setting can be tuned to improve download performance.

Users who always need accurate, up-to-date metadata should lower the setting, possibly to "0" to disable it. This will slow down most pulls (as Artifactory will constantly be serving fresh metadata), but ensure that the most accurate data is always being used.

Of course, users concerned about performance should increase this setting instead. Be aware, however, that doing so will mean that Artifactory will be using its cache more often than not, and at the cost of accuracy.