Why does Unused Cache keep reducing and not being released?

The total cache space in a cache task can be logically divided into three parts: 1) Empty Cache which has no data stored, 2) Used Cache which has data stored but is not marked as standby, and 3) Standby Cache which has data stored and is standby for caching new data.

Unused Cache is the sum of Empty Cache and Standby Cache. Empty Cache will be used first to cache data, and it will become Used Cache. Therefore, Unused Cache keeps reducing. When Unused Cache is reduced to a certain threshold, PrimoCache will change a part of the Used Cache to Standby Cache according to the cache replacement algorithm. There is essentially no difference between Used Cache and Standby Cache. Cached data in Standby Cache still can serve read requests from Windows or other applications if data are required. The only difference is that Standby Cache will be used first to cache new data by replacing old cached data. PrimoCache does not need to explicitly release Used Cache. Instead, it schedules the state transitions between Used Cache and Standby Cache when needed. Thus, PrimoCache can maximize the cache utilization. Cache will be explicitly released only when the file corresponding to the cached data is deleted.

You may be wondering, if Unused Cache is less than the amount of new data, is PrimoCache still able to cache all the new data? The answer is yes. PrimoCache can change Used Cache to Standby Cache in the entire cache space according to the needs and the replacement algorithm. Current Unused Cache will cache a part of the new data first, and meanwhile PrimoCache will change some of Used Cache to Standby Cache which can continue to cache the remaining new data.

So Unused Cache does not indicate how much cache is available. It actually indicates whether the cache replacement is triggered. When the value stays at about 32MB, it means that the whole cache space is full of data, the replacement algorithm is triggered, and old cached data will be replaced when new data need to be cached. The current available cache space is not indicated by Unused Cache. Instead, it is calculated according to the following formula: Available Cache = Total Cache - Deferred Blocks. When Defer-Write is not enabled, Deferred Blocks is 0, then Available Cache is always the entire cache.


Tags