Cache management
The downloaded content in the Nomad cache consume disk space, therefore management of the cache is critical. Because files may be re-used and distributed to other devices on the same subnet or site, the simple solution of deleting the files as soon as they have finished downloading and executing is not sufficient. Instead, Nomad has a cache cleaner utility that automatically but intelligently maintains control over the cache's disk usage.
Nomad cache is used in a number of deployment scenarios, for example scenarios and how you can monitor those deployments using the Nomad app refer to:
Cache clean cycle versus CacheCleaner
There are two ways to clean the cache:
-
The cache clean cycle - which runs automatically on a cycle and clears the unused content from the cache as a preference (default off).
-
The CacheCleaner and its cache cleaner rules - which is either run by Nomad during an active download or manually from the command-line.
CacheCleaner can be run when required in addition to the automated cache clean cycle, for example when reserving space for new contents to be downloaded by manually running it from the command-line. CacheCleaner deletes content based on its priority and doesn't check its last usage date. So it is possible that content which is lower in priority but has been recently used, or is used regularly (like WIM files), may also get deleted when CacheCleaner runs. This mechanism therefore acts more as an emergency option to free up disk space but may result in the deletion of content that is likely to be used (which must then be downloaded again when needed). The cache clean cycle helps to maintain the low profile of the Nomad cache by removing content that is less likely to be used.
Both cache clean cycle and CacheCleaner methods are described in detail in:
Cleaning the cache using the cache clean cycle
The automated cache clean cycle runs automatically on a regular configurable interval. Nomad was designed to cache content that Configuration Manager has requested or that has been pre-cached using Content Distribution. Because of this the content accumulated in the Nomad Cache can become quite extensive, with a large degree of it no longer relevant or useful. For example, a Windows software update which has been superseded by a newer update is no longer relevant or useful and can be safely removed. The cache clean cycle helps to manage the Nomad cache, remove aged and irrelevant content and minimize its impact on the host machine.
The cache clean cycle is turned off by default, so the registry entries must be set before it will start to regularly clean the cache.
Configuration options
This option is configured by setting the following registry values or installer properties:
Registry Value |
Default Value |
Installer Property |
Description |
---|---|---|---|
0 (turned off) |
CACHECLEANCYCLEHRS |
The first automatic cache clean runs randomly between 10 to 60 mins of service start up. Subsequent cache clean cycles run after the number of hours specified. 0 means feature turned off. No cache cleaning cycle would run. Changing this registry entry performs an internal restart. The minimum value is 4. The maximum value is 168 (Once a week) |
|
1 (turned on) |
CACHECLEANSUBNETLOOKUP |
Before deleting content, Nomad checks if it is on any other client in the same subnet, and will only delete local content if the same is present on at least one other client on the same subnet. To disable subnet lookup, set the value to 0. Its value can be 0 or 1. The default value is 1, subnet lookup is enabled. New setting introduced in 8.0. |
|
0 (turned off) |
MAXCACHEDAYS |
Set to delete application or package content that last triggered Nomad elections before the specified number of days from the date the cache cleaner runs. This ensures that only application or package content that have triggered elections recently will be kept in the cache. 0 means that application and package content will not be deleted automatically when the cache cleaner runs. |
|
0 (turned off) |
MAXCACHEDAYSTHRESHOLD |
This is the maximum number of days content is present on a client. If it's not zero, then content will be deleted without any other checks once it reaches the threshold. If the threshold has a value greater than zero and less than 30, Nomad uses the threshold of 30 days and creates an associated log. Default value is 0. New setting introduced in 8.0. |
|
0 (turned off) |
MAXPRECACHEDAYS |
Set to delete pre-cached content that last triggered Nomad elections before the specified number of days from the date the cache cleaner runs. This ensures that only pre-cached content that has triggered elections recently will be kept in the cache. 0 means that pre-cached content will not be deleted automatically when the cache cleaner runs. |
|
0 (turned off) |
MAXSUCACHEDAYS |
Set to delete software updates that last triggered Nomad elections before the specified number of days from the date the cache cleaner runs. This ensures that only software updates that have triggered elections recently will be kept in the cache. 0 means that software updates will not be deleted automatically when the cache cleaner runs. |
|
0 (turned off) |
DPCACHECLEANUPENABLED |
Deletes all LSZ files in a Distribution Point (DP) cache whose content is no longer distributed, that is not present in ContentLib. To enable DP Cache Cleaner, set the value of registry to 1 (any value except for 0 enables this feature). |
Cache clean cycle delete conditions
When the cache clean cycle runs, it will check the type of each content and the last election date associated with it. There are four main types of content, and these will be marked for deletion if the following delete conditions are true:
Content type |
Delete condition |
---|---|
Pre-cached |
last election date + MaxPreCacheDays > cache clean cycle run date |
Application or package |
last election date + MaxCacheDays > cache clean cycle run date |
Office 365 update byte-range |
last election date + MaxSUCacheDays > cache clean cycle run date |
Software updates related to SMSTSNomad jobs |
|
The cache clean cycle will then also check the following, for all content other than Office 365 update byte-ranges:
-
The content should be present on at least one of the Nomad subnet peers with an equal or a higher percentage of content
-
The network has broadcasts enabled
If both of these conditions are also true, the content will be deleted.
Caveats
The following points describe various caveats related to the way that the cache clean cycle works:
-
If pre-cache content is deleted by the cache clean cycle, but the corresponding pre-caching job still exists, Content Distribution will send the download notification again to the client. If your Nomad policy is to not delete pre-caching jobs, you should turn off deletion of pre-cached content by setting the MaxPreCacheDays registry value to 0.
-
Application upgrades and uninstallation via Software Center require content to be present on the machines (the current version is required for uninstallation and the previous version is required for upgrade scenarios). If the content has been deleted by the cache clean cycle, the content would be downloaded again at uninstall or upgrade time. Because of the way that the cache clean cycle delete conditions are applied Nomad retains one copy of the content per subnet, so even if such a download request comes the content would be downloaded from a Nomad peer and not a DP.
-
ByteRange content is not checked to be present on subnet peers.
-
Cache optimization does not work for content that is to be activated later on.
-
Cache optimization does work on Sensitive Servers.
Cleaning the cache using CacheCleaner
To maintain the cache Nomad uses a set of basic rules that lets you decide the cache's effect on overall disk usage and performs automatic cleaning when necessary. When a job is advertised, automatic cache cleaning could occur under the following circumstances:
-
If the percentage of available disk space is less than the PercentAvailableDisk setting after downloading an incoming package, according to its download package size, automatic cache cleaning is initiated before the download takes place.
-
Nomad then assesses how much space could be cleared by deleting cache folders that are eligible for deletion. A cache folder is deemed eligible for deletion if its cache priority value is lower than or equal to the cache priority value of the incoming package. The cache priority value is set on the Nomad command-line using the pc argument, or set in the Nomad properties page when using Configuration Manager. By default, if no value is specified, packages have a cache priority of 1.
-
If the assessment determines there would still not be sufficient space available: no deletion will take place, the download is aborted and an error logged, which may be one of:
-
Insufficient disk or cache space available to download the Program…
-
Insufficient cache space available to achieve a Max Cache Size of X.
-
-
If the assessment determines there would be sufficient space available in the cache: the folders are deleted in order according to their cache priority until the required disk space is available.
Cache cleaner and Configuration Manager
When Nomad is used with Configuration Manager the cache cleaner will also:
-
Purge linked contents from the Configuration Manager cache.
-
Purge older versions from the Configuration Manager cache before downloading the content for a newer version.
The cache cleaner mechanism also works with the priority job control to ensure that suspended lower priority job caches are not cleaned to make way for the higher priority job unless absolutely necessary.
Command-line switches
CacheCleaner is an executable that can be used to explicitly purge the Nomad cache. By default, the Nomad cache is not purged unless there is an active download. In most cases, available disk space is not really an issue, but there may be circumstances where you may want to manage the cache to keep the disk usage overhead to a minimum.
It is installed as part of Nomad and the format of the command-line is:
CacheCleaner.exe -switch
For a complete reference of Nomad command-line switches refer to CacheCleaner.exe command-line switches.
If the Nomad cache is deleted while another client is accessing it, the other client will recover by downloading directly from the DP. This is by design and ensures recovery occurs in order to complete a successful d
CacheCleaner examples
In the following examples, there is no requirement to specify the path to CacheCleaner.exe because the path to Nomad executable is set in the PATH environment variable:
Example |
Description |
---|---|
Set the cache cleaner to run as a Configuration Manager program. |
You can set the cache cleaner to run as a Configuration Manager program and advertise it to all Nomad systems in a single operation. You can also schedule this as a regular housekeeping job, ensuring that the cache is kept under control automatically. To purge the cache when the total free disk space is at 20% run:
|
Ensure that content in the cache is not kept for more than 30 day. |
To ensure that content in the cache is not kept for more than 30 days, run:
|
Delete a particular package and version. |
To delete a particular package and version, run:
|
Purge the contents of a cache with a priority of 3 or lower. |
To purge the contents of a cache with a priority of 3 or lower, run:
|
Purge the contents of a cache with a particular priority and size. |
To purge the contents of a cache with a particular priority and size, run:
|