Brian Ensink
Brian Ensink

Reputation: 11218

Can my Service Fabric StatefulService have both memory-only and disk-persisted data?

I am designing a Service Fabric application that includes a stateful partitioned microservice. Some of the data must be persisted to disk however some related data is very ephemeral and I would like keep it only in memory. During a failover I do want the secondary instances to have the ephemeral data.

From what I can tell the StatefulService has only one StateManager and all collections created via that StateManager share the same behavior. In other words I can't have one reliable dictionary that is persisted to disk and a second reliable dictionary that is only in memory.

Is there any way to do this within a single StatefulService instance?

Upvotes: 1

Views: 205

Answers (1)

Vaclav Turecek
Vaclav Turecek

Reputation: 9050

No, Reliable Collections always persist all data to disk.

But if that related data can be generated on the fly from the data that's being inserted into a Reliable Collection, then you might be able to use Reliable Collection notifications to generate that related data and keep it in memory whenever you perform an operation on a Reliable Collection. Those notifications are fired on primary and secondary replicas.

Upvotes: 0

Related Questions