Local Cache Expiration

Hi guys,

Please excuse if I have missed something and this is a basic question.

We are using local caching on our broker and we are trying to figure out how it affects our performance.

I have a couple of questions on this.

In memcached, you can set the expiration time, but there is no such option in the local cache.

What is the expiration time for the local cache? Also, if the data for the queried interval changes, does Druid automatically update the cache on ingestion time, so that we get up-to-date results?

For example if we are doing a query for the past 5 minutes, while data is coming in, and we have the cache enabled on the broker, will we get up-to-date results, or will we get the results of the first time the cache was populated?



Good questions. The stock local cache has very basic LRU eviction and also has horrible locking issues at large scale. If you are not seeing the map locking issues yet then you’re OK for now. If you ARE seeing map locking issues (slow queries under heavy query load) I highly recommend checking out the core extension https://github.com/druid-io/druid/blob/master/docs/content/development/extensions-core/caffeine-cache.md which we use in production.

All cache entries have a “version” association such that if data for a particular interval changes, it will cause a cache miss and eventually the old data will just be garbage collected by LRU.

For realtime data coming in queries should not be hitting cached versions unless the data is immutable (the read-optimized temporary storage is not cacheable) and the cache is a local cache. See https://github.com/druid-io/druid/blob/druid- for the actual code that enforces this.