Search code examples
replicationazure-service-fabric

Incremental actor state replication?


I'm wondering whether actor state, in Service Farbic, is replicated using some kind of incremental delta/diff mechanism or whether the full state is replicated for each change.

Let's say that we have an actor with a quite large state payload, say 100KB. Let's also say that a counter value is embedded in that state. The counter is changed on a high frequency while the rest of the state is changed on a very low frequency.

In this case, it would be wasteful if the full state is replicated for each change and we should probably consider another design.

However, if Service Farbric is capable of doing incremental replication then this approach could be attractive.

Does anybody know the details on this?

Perhaps Service Fabric use a binary delta/diff algorithm on the serialized state during replication, or perhaps state changes are incremental per state name?


Solution

  • It's per state name. If you look at the method IActorStateProvider.SaveStateAsync method, you'll see it accepts a list of ActorStateChange. The persisted provider (KvsActorStateProvider) serializes each of the values in that list (except in the case of remove), and updates the store.