usage of reliable actors in azure service fabric
TRANSCRIPT
Usage of Reliable Actors in Azure Service FabricBy Alexander LayshaLead .NET Developer at ScienceSoft
Hmm... Actor Model? What is that?
"An actor is a computational entity that, in response to a message it receives, can do the following:• Send a finite number of
messages to other actors• Create a finite number of new
actors• Designate the behavior to be
used for the next message it receives"
Let's take a look at example!
Actor Model Characteristics•Communication via direct asynchronous messaging•State machines•Share nothing• Lock-free concurrency• Parallelism•Actors come in systems• Location transparency•Supervision
Azure Service Fabric Overview
Sigh... Reliable Actors = Actor Model?
"Azure Fabric Actors is an implementation of the actor model that borrows some ideas from Erlang and distributed objects systems, adds a layer of actor indirection, and exposes them in an integrated, programming model that leverages the Azure Service Fabric platform."
Reliable Actor Characteristics•Actors are just objects• Single-threaded execution• Turn-based access•Automatic GC•Automatic lifetime management• Transparent activation• Explicit asynchrony• Location transparency & Automatic Failover
[timer, reminder, proxy, client events, SF explorer,
VM processes, lifetime, concurrency]
What Reliable Actor types exist?•Stateless - state can be lost due to failovers•Stateful - state preserved across GC and failoversPrimary-Secondary replicationAuto/On Demand saveReadonly methodsBuilt-in providers:
- volatile state provider- durable state provider
Can we scale Reliable Actors?At the partition level• Ranged partitioning• Actor Id maps to Partition Id• No partition control
At the service name level
[stateful actors, readonly methods, partitioning]
Reliable Actors Communication•Request-Response pattern[Default Pattern]
• Fire-and-Forget pattern[Return Task.CompletedTask (.NET 4.6) + Timer + Internal stateful Queue]
• Pub-Sub pattern[Community Package: https://www.nuget.org/packages/ServiceFabric.PubSubActors]
Want to contact me?https://www.linkedin.com/in/layshaalexander
https://www.facebook.com/alexander.laysha
@layshaalexander