Summary

The cache mechanism is essential to Nomad's download once to branch feature. The cache enables Nomad to hold its downloaded content so that it can be distributed locally to other Nomad peers. The Nomad cache contains downloaded content (such as packages, applications, and software updates) which can vary in size from relative small patches to rather large OS image files. These packages consume disk space so management of the cache is critical. Because the 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 sophisticated cache cleaner utility that automatically but intelligently maintains control over the cache's disk usage.

Nomad uses file system hardlinks between the Nomad and Configuration Manager client caches, ensuring that only a single copy of the content is retained. Hardlinks are used for all content types except Office 365 Updates, as this type of content is retained in the Office 365 Click To Run agent installation folder rather than the CCM cache folder.

On this page

Two ways to clean the cache

From Nomad 6.3 and above there are now two ways to clean the cache: 

  1. The new clean cache cycle method, which is automatically run on a cycle and clears the unused content from the cache as a preference
  2. The existing method using CacheCleaner and its cache cleaner rules, which is either run by Nomad during an active download or manually from the command-line

The cache clean cycle versus CacheCleaner

The cache clean cycle is provided in addition to the previously used CacheCleaner, which can still be run when required (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 of these methods are described in greater detail in the following headings.

Cleaning the cache using the cache clean cycle

From Nomad 6.3 and above a new cache clean cycle has been added that automatically runs the cache cleaner on a regular configurable interval. Nomad was designed to cache content that Configuration Manager has requested or that has been pre-cached via ActiveEfficiency. 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 minimise its impact on the host machine.

Configuration options

This option is configured by setting the following registry values or installer properties:

Registry ValueDefault ValueInstaller PropertyDescription
CacheCleanCycleHrs0 (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)

MaxCacheDays0 (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.

MaxPreCacheDays 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.

MaxSUCacheDays 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.

As you can see from the table 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.

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 typeDelete condition
Pre-cachedlast election date + MaxPreCacheDays > cache clean cycle run date
Application or packagelast election date + MaxCacheDays > cache clean cycle run date
Office 365 update byte-rangelast 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:

  1. The content should be present on at least one of the Nomad subnet peers with an equal or a higher percentage of content
  2. 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:

  • When content is served to a site peer, elections don't occur so the last election date is not updated. So, content which may have been used recently might still get deleted, as long as it fulfils the Cache clean cycle delete conditions.
  • If pre-cache content is deleted by the cache clean cycle, but the corresponding pre-caching job still exists, the ActiveEfficiency Server will send the download notification again to the client.

    If your Nomad policy is to not delete pre-caching jobs you should turn of 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.exe

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.

Cache cleaner and central multicast

If you are using Nomad's Central Multicast feature, cache cleaner automatically takes into account the space required by all the concurrent jobs running before purging a cache. There is no additional configuration needed for this to happen.

Maintaining the cache manually

By default, a 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.

You can explicitly purge the cache with CacheCleaner command-line utility which ships with the Nomad installation. Use CacheCleaner with the following command-line arguments, each preceded with '-'

ArgumentDefault valueRangeDescription

-CachePriority

11-9

Only cache contents with a priority equal to or lower than the CachePriority are purged. Used in conjunction with Pkgsize to emulate the behavior of the cache cleaner when an actual package is being downloaded.

-Debug

  

Sets the debug level for CacheCleaner and it can be passed on the command-line. If it is not, the value from Nomad registry is used. If Debug is already defined, using this argument adds to the logging level.

-Deleteall

  

Deletes all cache content where the priority is less than or equal to the value for Force. If the command-line does not include Force, then Deleteall deletes all cache content where the priority is 1. Works in conjunction with the Force.

-DeletePkg

  

The ID of the package or content to be deleted from the cache. The value must be set to the PackageID or ContentID string that identifies the content to be deleted. Must be used in conjunction with PkgVer.

-DeletePkg=PRI0000A -PkgVer=*
-DeletePkg=Content_9b9ccd56-9fbf-4587-98e7-725fcfa8e70f -PkgVer=*

-Force

  

Content whose cache priority is less than or equal to the CachePriority value are purged. Used in conjunction with the Deleteall and MaxCacheAge.

-MaxCacheAge

 1-1461

The maximum number of days before the contents of a cache is purged. If set, CacheCleaner deletes cache contents which are older than this value.

This argument is ignored if DeletePkg and Deleteall is used on the command-line.

If the command-line includes Force, all caches with a priority less than or equal to CachePriority will have their content purged. If CachePriority is not included on the command-line, all caches with a priority=1 will have their content purged.

-PercentAvailableDisk

101-99

Deletes the lowest cache priority content until the set percentage of available disk is available.

-Pkgsize

  

Only caches with a priority equal to or lower than the CachePriority value will have their contents purged. Used in conjunction with CachePriority to emulate the behavior of the cache cleaner when an actual package is being downloaded.

Determine the space to be cleared when running cachecleaner.exe with PercentAvailableDisk. The PkgSize value is by default specified in bytes but can be set to MB by appending MB to the value.

For example, the following are equivalent:

-Pkgsize=1048576
-Pkgsize=1MB
-PkgVer
  

Identifies the content version to be deleted and must be used in conjunction with DeletePkg. Deletes content from both the Nomad and Configuration Manager client caches that corresponds to the version number and the Package ID (or Content ID).

The special value -PkgVer=* may be used when the user is unsure of the specific version of the package in the cache.

Note:

Setting -PkgVer=* will delete any version of the content with the ID specified in the DeletePkg argument from the Nomad cache only – it will not delete from the Configuration Manager client cache.

Note:

If you want to remove Application or Software Updates content, then the -PkgVer will usually need to be set to "1".
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 download.

CacheCleaner examples

In the following examples, there is no requirement to specify the path to CacheCleaner.exe because the path to Nomad executables is set in the PATH environment variable.

  • 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

    CacheCleaner.exe -PercentAvailableDisk=20
  • To ensure that content in the cache is not kept for more than 30 days, run:

    CacheCleaner.exe -MaxCacheAge=30
  • To delete a particular package and version, run:

    CacheCleaner.exe -DeletePkg=L0A00001 -PkgVer=1
  • To purge the contents of a cache with a priority of 3 or lower, run:

    CacheCleaner.exe -DeleteAll -Force=3
  • To purge the contents of a cache with a particular priority and size, run:

    CacheCleaner.exe -PkgSize=10485760 -CachePriority=6