14
Usage of Reliable Actors in Azure Service Fabric By Alexander Laysha Lead .NET Developer at ScienceSoft

Usage of Reliable Actors in Azure Service Fabric

Embed Size (px)

Citation preview

Page 1: Usage of Reliable Actors in Azure Service Fabric

Usage of Reliable Actors in Azure Service FabricBy Alexander LayshaLead .NET Developer at ScienceSoft

Page 2: Usage of Reliable Actors in Azure Service Fabric

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"

Page 3: Usage of Reliable Actors in Azure Service Fabric

Let's take a look at example!

Page 4: Usage of Reliable Actors in Azure Service Fabric

Actor Model Characteristics•Communication via direct asynchronous messaging•State machines•Share nothing• Lock-free concurrency• Parallelism•Actors come in systems• Location transparency•Supervision

Page 5: Usage of Reliable Actors in Azure Service Fabric

Azure Service Fabric Overview

Page 6: Usage of Reliable Actors in Azure Service Fabric

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."

Page 7: Usage of Reliable Actors in Azure Service Fabric

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

Page 8: Usage of Reliable Actors in Azure Service Fabric

[timer, reminder, proxy, client events, SF explorer,

VM processes, lifetime, concurrency]

Page 9: Usage of Reliable Actors in Azure Service Fabric

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

Page 10: Usage of Reliable Actors in Azure Service Fabric

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

Page 11: Usage of Reliable Actors in Azure Service Fabric

[stateful actors, readonly methods, partitioning]

Page 12: Usage of Reliable Actors in Azure Service Fabric

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]

Page 13: Usage of Reliable Actors in Azure Service Fabric

Want to contact me?https://www.linkedin.com/in/layshaalexander

https://www.facebook.com/alexander.laysha

@layshaalexander

[email protected]

Page 14: Usage of Reliable Actors in Azure Service Fabric