* Set default FIFO cache with reasonable defaults.
Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>
* Remove FIFO cache feature flag.
- We noticed that we always want that behavior, so the logic is better
implemented in the `ApplyDinamicConfig` method
- Update documentation
* Move FIFO cache default behavior.
- Move FIFO cache default behavior implementation to ApplyDinamicConfig
* Add tests for the new FIFO cache default behavior.
- The tests tests the behavior of the four existing caches (query results, query
index, write dedupe, and chunk results)
- Add changelog entry
- Fix lint issues regarding import order
- Revert moving of EnableFifoCache check
* Apply suggestions from code review
- Change `EnableFifoCache` description to mention that it is only applied for chunk and query results cache
Co-authored-by: Owen Diehl <ow.diehl@gmail.com>
Co-authored-by: Mauro Stettler <mauro.stettler@gmail.com>
Co-authored-by: Owen Diehl <ow.diehl@gmail.com>
f.DurationVar(&cfg.DefaultValidity,prefix+"default-validity",0,description+"The default validity of entries for caches unless overridden.")
f.DurationVar(&cfg.DefaultValidity,prefix+"default-validity",time.Hour,description+"The default validity of entries for caches unless overridden.")
f.BoolVar(&cfg.EnableFifoCache,prefix+"cache.enable-fifocache",false,description+"Enable in-memory cache (auto-enabled for the chunks & query results cache if no other cache is configured).")
f.StringVar(&cfg.MaxSizeBytes,prefix+"fifocache.max-size-bytes","",description+"Maximum memory size of the cache in bytes. A unit suffix (KB, MB, GB) may be applied.")
f.StringVar(&cfg.MaxSizeBytes,prefix+"fifocache.max-size-bytes","1GB",description+"Maximum memory size of the cache in bytes. A unit suffix (KB, MB, GB) may be applied.")
f.IntVar(&cfg.MaxSizeItems,prefix+"fifocache.max-size-items",0,description+"Maximum number of entries in the cache.")
f.DurationVar(&cfg.Validity,prefix+"fifocache.duration",0,description+"The expiry duration for the cache.")
f.DurationVar(&cfg.Validity,prefix+"fifocache.duration",time.Hour,description+"The expiry duration for the cache.")
f.IntVar(&cfg.DeprecatedSize,prefix+"fifocache.size",0,"Deprecated (use max-size-items or max-size-bytes instead): "+description+"The number of entries to cache. ")
f.StringVar(&cfg.Engine,"store.engine","chunks","The storage engine to use: chunks or blocks.")
cfg.IndexQueriesCacheConfig.RegisterFlagsWithPrefix("store.index-cache-read.","Cache config for index entry reading.",f)
cfg.IndexQueriesCacheConfig.RegisterFlagsWithPrefix("store.index-cache-read.","Cache config for index entry reading.",f)
f.DurationVar(&cfg.IndexCacheValidity,"store.index-cache-validity",5*time.Minute,"Cache validity for active index entries. Should be no higher than -ingester.max-chunk-idle.")
f.BoolVar(&cfg.DisableBroadIndexQueries,"store.disable-broad-index-queries",false,"Disable broad index queries which results in reduced cache usage and faster query performance at the expense of somewhat higher QPS on the index store.")