Cache Configuration
In API Gateway version 10.1 or earlier, all assets are stored in memory and reside in memory indefinitely. Since the cache is loaded fully during startup, it takes a while to load all the elements, such as applications, APIs, policies, and so on in the cache. The Cache configuration functionality in API Gateway enables lazy loading of the assets and ensures that API Gateway startup is quick and is independent of the data size. If the memory size is not enough to contain all the entities API Gateway caches can be configured to load a certain percentage of the entities in memory.
API Gateway internally classifies cache based on the usage and size as follows:
![*](chapterTOC_bullet.png)
size bounded: In-memory cache that forgets the least recently used (LRU) entry when the maximum number of entries is reached. This can be configured as percentage of the total number of entries in the data store.
![*](chapterTOC_bullet.png)
size unbounded: When the cache configuration percentage is set to 100% manually or as computed by auto scale option, the cache is set as unbounded.
Individual cache configurations can be done in this section. Additional parameters that control the cache configuration can be set in the Administration > General > Extended Settings section. For details see,
Configuring Extended Settings.
Note:
The cache configuration is synchronized across different nodes in a cluster.
Autoscaling mode
Depending on the load on the system the autoscaler thread computes the percentage of entities to be kept in memory. If the number of entities is less all the entities are stored in memory. If the number of entities does not fit into the memory then it computes the memory for each of the caches that are set to run in autoscale mode. The caches are reconfigured automatically based on the computed value. This can be controlled by setting the parameters pg_Cache_autoScalerRunInterval and pg_Cache_minCachePercent.
Percentage mode
Depending on the growth or the current size of the number of entities the cache size is computed and resized periodically. This is controlled by the setting the parameters pg_Cache_boundedCacheResizeRunInterval and pg_Cache_minCacheSize.
You can also collect the required statistics for the selected cache, which is displayed in the Global dashboard under Analytics > Cache Statistics. This statistics collection interval can be configured by setting the parameter pg_Cache_statisticsProcessorRunInterval.