service-fabric-distributed-cache icon indicating copy to clipboard operation
service-fabric-distributed-cache copied to clipboard

MaxCacheSizeInMegabytes with HasPersistedState = true

Open Vikhyat08 opened this issue 5 years ago • 4 comments

I am using service fabric distributed cache with a stateful service having HasPersistedState = true. I believe HasPersistedState will allow me to have reliable collections backed by disk. If I set MaxCacheSizeInMegabytes to 1000, does it mean all 1000 MB data is in memory backed by disk. Or does it mean Service fabric reliable collection will manage memory footprint having some objects in memory and rest all in disk.

Also, I see in the example HasPersistedState is false but replicationSize is set to 3. Why would we want replication if we are not backing the data to store there would be no way to recreate state in a node because of no snapshots?

Vikhyat08 avatar Aug 10 '20 16:08 Vikhyat08

It means Service fabric reliable collection will manage memory footprint having some objects in memory and rest all in disk. As far as the replicationSize that is up to you. You would need to refer to the docs on Reliable collections to see if there is any advantage when not backing up the state.

lurock avatar Aug 10 '20 18:08 lurock

If HasPersistedState = false, and all the data is kept in-memory, how is the cache limit being enforced?

Is it possible for the memory footprint to increase beyond the limit set by MaxCacheSizeInMegabytes?

oargaruna avatar Aug 11 '20 17:08 oargaruna

Is it possible for the memory footprint to increase beyond the limit. It is using that setting as a guide to start to removing the least recently used cached items from the store.

lurock avatar Aug 13 '20 23:08 lurock

Can you add an option to impose the size limit? This will be useful for memory constrained environments.

oargaruna avatar Aug 17 '20 16:08 oargaruna