Search code examples
azure-service-fabricservice-fabric-statefulservice-fabric-stateless

Azure service fabric - instances VS replicas


I have created this question to assure that my understanding of replicas and instances are correct. Based on the reading from https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-concepts-replica-lifecycle, Instances and replicas are a copy of the service logic with the difference that instances are for stateless and replicas are for stateful service. Both have different life cycles based on the fact that replicas need to save the state / data associated with the service.

Please confirm


Solution

  • Instances and replicas are a copy of the service logic with the difference that instances are for stateless and replicas are for stateful service.

    This is correct

    Both have different life cycles based on the fact that replicas need to save the state / data associated with the service.

    The fact that there is state associated does not affect the service life cycle. Replicas are copies of service + data, to increase resilience. The primary replica is the one copy that can be written to, and secondary replicas can only be read from. Changes are replicated automatically.

    Stateless service instances are all equal.