1

For a stateful service, does it run/execute the process in RunAsync on the secondary replicas?

alltej
  • 6,787
  • 10
  • 46
  • 87

1 Answers1

4

RunAsync only runs on primaries of your partitions for Stateful services.

https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-advanced-usage#stateful-service-replica-lifecycle

The RunAsync method in a stateful service is executed only when the stateful service replica is primary. The RunAsync method is cancelled when a primary replica's role changes away from primary, as well as during the close and abort events.

For stateless it runs "when the instance is about to be used". https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-advanced-usage#stateless-service-instance-lifecycle

So for Stateful you can have one RunAsync per partition running (on the primaries), and for stateless one per instance.

yoape
  • 3,285
  • 1
  • 14
  • 27