I spent evenings evaluating the Azure Service Fabric as a replacement for our current WebApps / CloudServices stack, and I feel a little unsure of how to decide when services / actors with state should be stateful and when they should be non-core with External persistent state (Azure SQL, Azure Storage, and DocumentDB). I know that this is a fairly new product (at least for the general public), so there probably isn’t much good practice regarding this, but I read most of the documentation provided by Microsoft that couldn’t find a specific answer for this.
The current area of concern that I am approaching is our event store; parts of our applications are event-driven and CQRS-based, and I am evaluating how to port this event store to the Service Fabric platform. The event store will contain many time series of data, and since this is our only source of truth for the data stored there, it must be sequential, replicated and stored in some form of long-term storage.
One of the ways I've looked at is that it has the status of "EventStream". Each instance of the aggregate using the event source stores its events in an isolated stream. This means that a state actor can track all events for his own stream, and I would fulfill my requirements regarding how the data is stored (transactional, replicated, and long-lived). Nevertheless, some flows can grow very large (hundreds of thousands, if not millions) of events, and it is here that I begin to doubt. I think having an actor with a lot of states will affect system performance when these large data models need to be serialized or deserialized from disk.
Another option is to keep these members stateless and force them to simply read their data from some external repository such as Azure SQL, or simply use services without tolerance instead of participants.
Basically, when is the number of states for the actor / service "too many" and you should start considering other ways to handle the state?
Also, this section in Fabric Actors Service Template Designer: some anti-templates leave me a little puzzled:
Think of Azure Service Fabric videos as a transactional system. Azure Service Fabric Actors is not a two-phase commit system that offers ACID. If we do not realize the optional constancy, and the machine on which the actor is working dies, the current state will go with it. The actor will advance on the other node very quickly, but if we do not fulfill the persistence of support, the state will disappear. However, between attempts to reuse, duplicate filtering and / or idempotent construction, you can achieve a high level of reliability and consistency.
What does it mean "if we do not realize optional tenacity" here? I had the impression that as long as your state-modifying transaction succeeded, your data was stored in reliable storage and replicated, at least to a subset of the replicas. This paragraph leaves me wondering if there are situations when the state of my actors / services will be lost, and if this is what I need for myself. The impression I got from the state model in other parts of the documentation seems to counteract this statement.