streamline icon indicating copy to clipboard operation
streamline copied to clipboard

Revisit GuavaCache to not load entries automatically

Open arunmahadevan opened this issue 7 years ago • 6 comments

Streamline GuavaCache impl uses a Loading cache, but Storable may or may not be cacheable. So need to revisit and make sure GuavaCache caches only if Storable.isCacheable is true.

After these changes CacheBackedStorageManager.get should be refactored.

arunmahadevan avatar Jul 26 '17 06:07 arunmahadevan

Lets remove Caching from storage as we really don't need it. We can keep the caching details around custom processor.

harshach avatar Jul 26 '17 11:07 harshach

@harshach , isn't it good to have the caching layer in-front of the Db so that we don't hit the db always?

arunmahadevan avatar Jul 26 '17 11:07 arunmahadevan

In H/A usage we should get rid of caching layer in front of DB, given that changing entity is not broadcasted to all nodes.

HeartSaVioR avatar Jul 26 '17 11:07 HeartSaVioR

So we can't avoid hitting DB unless we maintain central cache. If we still need to cache due to some huge entities, we can maintain cache and query twice, comparing timestamp to check cached data is valid, and query entity if it's invalid for now.

HeartSaVioR avatar Jul 26 '17 11:07 HeartSaVioR

In HA we need to use a distb cache or use a local cache with some reasonable timeout. If version mismatches occur during updates, we can discard the cached value reload the value from DB and retry.

arunmahadevan avatar Jul 26 '17 11:07 arunmahadevan

We may need to also consider reading. Maybe some entities are not eligible to be cached even with timeout (entities which can be modified concurrently). If we go with timeout, we need to decide which are safe to be cached (ideally along with duration) and which are not. So fine-grained control is required.

HeartSaVioR avatar Jul 28 '17 08:07 HeartSaVioR