Reevalulate choosing Reliable Collections as the data storage
Closed this issue · 2 comments
Currently, ServiceFabric Persistence uses the mechanism of Reliable Collections to store data. This is a replicated transactional storage provided by StatefulService
base class.
ServiceFabric provides another one that is used by SF Actors' model called KeyValueStoreReplica. It's also a replicated transactional partitioned storage. It's used to store all actors' data including reminders, state and actors' ids. The .NET client complexity of the KVSR is much lower than the reliable collections, hence it might be a faster storage.
When reconsidering the choice one should take into consideration the fact that KVSR might provide a lower guarantees for persistence (although I have found no doco stating this).
A couple of questions (excuse my ignorance on the actors side of SF):
-
As was pointed out by @danielmarbach we expose the synchronized session to allow storing user data along with the saga data. Would that work with KVSR?
It's used to store all actors' data
While this is a public API, is it intended for the usage? I have failed to find any results on KeyValueStoreReplica
that would not have @Scooletz name on it or link to one of his post 😃
As was pointed out by @danielmarbach we expose the synchronized session to allow storing user data along with the saga data. Would that work with KVSR?
It would work as KVSR has transactions similar to reliable collections.
I think that the strongest argument why we should not use KVSR is that, all the samples for stateful services are based on reliable collections. If we based our persistence on KVSR that would require US to provide all the guidance.
I found no note about being intended for internal use only
and the summary of KVSR is quite welcoming :) Anyway, I'd say, let's stick to reliable collections.