Configure caching

Gateway 4.3.12+

Itential Gateway can cache the results of discovery operations to disk instead of running live discovery every time. Caching reduces repeated discovery load, which is especially useful for gateways with large inventories or frequent discovery requests.

This topic explains how caching works, how to configure it, and what to consider when running multiple Gateway instances on the same host.

How caching works

When caching is enabled, Gateway writes the results of each discovery type to a dedicated JSON file in a configured directory. On subsequent requests, Gateway reads from these files instead of running live discovery, which reduces the time and load associated with repeated discovery operations.

Gateway creates one cache file per discovery type:

Discovery typeCache file
Collectionscollections_cache.json
Modulesmodules_cache.json
Playbooksplaybooks_cache.json
Scriptsscripts_cache.json
Terraformsterraforms_cache.json
Devicesdevices.json
Groupsgroups.json

When caching is disabled, Gateway always runs live discovery and doesn’t read or write these files.

Configuration properties

Caching is controlled by two top-level properties in properties.yml:

1#### Cache ####
2# Enable cache
3global_cache_enabled: True
4
5# Path to the global cache
6global_cache_directory: '/tmp'
PropertyDescriptionDefault
global_cache_enabledEnables or disables caching.True
global_cache_directoryDirectory where Gateway writes cache files./tmp

Configure caching

global_cache_enabled and global_cache_directory are part of the System section of properties.yml, so you must edit them directly on the Gateway instance rather than through the UI. Changes to properties.yml require a reboot.

  1. On the Gateway instance, open properties.yml in a text editor.
  2. Set global_cache_enabled to True or False.
  3. Set global_cache_directory to the path where you want Gateway to write cache files.
  4. Save the file.
  5. Restart the Gateway service to apply the changes.

You can review these values under Cache Enabled and Global Cache Directory in the System Configuration section of the UI. This section is locked, since it can only be edited in properties.yml, followed by a server restart.

Cache directory availability

At startup, Gateway checks whether the configured cache directory exists and is writable. If it doesn’t exist or isn’t writable, Gateway logs a warning and continues running without caching rather than failing to start.

If you see a caching warning at startup, verify that global_cache_directory points to a directory that exists on the Gateway instance and that the Gateway service account has write permission to it.

Multiple Gateway instances

If you run multiple Gateway instances on the same host, set a distinct global_cache_directory for each instance. Instances that share a cache directory can overwrite each other’s cache files, which can lead to inconsistent discovery results.