SlideShare a Scribd company logo
When and How to Use the Actor
Model: an Introduction to
Akka.NET
Aaron Stannard, Co-Founder of
Akka.NET and Petabridge
Origins of the Actor Model
1973 – Original Actor Model
Paper
Computer scientists thought
future computers would be
living-room sized
mainframes with thousands
of low-powered CPUs.
Thus, we needed a way to
write programs that could
run on multiple cores, a
novel concept at the time.
https://commons.wikimedia.org/w/index.php?curid=6455009
Actors in the 1970s
• Each actor is its own “micro process”
• Owns 1 core (there are thousands)
• Communicate across cores via message-
passing in shared memory
• Actors process 1 message at a time
Actors in the 1970s
Actors in the 1970s
1970s Actors Never Came to
Pass
1980s: Erlang Actors
• Development of network
computing revived actor
model.
• First implemented in 1986
by Ericsson. Powers
modern day GPRS, 3G,
and LTE cell networks.
• Used to provide fault
tolerance, soft-real time
programming, and linear
hardware scalability for
telephony networks.
Modern CPUs: More Cores!
Source: Karl Rupp https://www.karlrupp.net/2018/02/42-years-of-microprocessor-trend-data/
Modern Day: Actors Everywhere
• Multi-core programming now ubiquitous
• Developers need more robust model than
“shared state concurrent programming”
• Cloud computing == 1970s vision of
dividing work across thousands of cheap
CPUs finally comes true
Why Use the Actor Model?
Actors Reduce Big Problems
into Small Ones
• Accumulate state in-
memory.
• Can react to changes
in state in real-time.
• No database calls, I/O,
or external
infrastructure.
Actors are Reactive
Actors Make Concurrency Easy
Actors Isolate Faults
Actors Scale & Distribute
Actors Recover from Network
Failures
Actors Are Used in Domains
Where
• Soft real-time guarantees are common
– i.e. “every transaction must be completed
within ~100ms to be within SLA”
• Work is best modeled as streams
– Long-running jobs (i.e. Asset line
management, simulations, ETL, migrations)
– Continuous flows(i.e. IOT, marketing
automation, real-time pricing)
• High availability is key to business
success
Introduction to Akka.NET
PS> Install-Package Akka (base types)
PS> Install-Package Akka.Remote (networking)
PS> Install-Package Akka.Persistence (durable
actors)
PS> Install-Package Akka.Cluster (HA networking)
PS> Install-Package Akka.Streams (fun)
Installing Akka.NET
Basic Akka.NET Actor
Creating Actors
• Actor = a class that can contain state and modifies
that state by processing messages it receives.
• ActorReference = a handle to an actor. Allows you to
send the actor messages without knowing its
implementation type or location on network.
• ActorSystem = a collection of actors that exist inside
a single process and communicate via in-memory
message passing.
• Cluster = a collection of networked ActorSystems
whose actors communicate via TCP message
passing.
Actor Terms
Actors Always Run
Asynchronously
State is Shared Only Through
Messages
Actor References are
Location Transparent
• IActorRef can point to
local actor (in-
memory messaging.)
• IActorRef can point to
actor running in
another remote
process (TCP
messaging.)
• You don’t need to
explicitly know or care
which is which.
But Actors Still
Have Explicit Addresses
Processes Usually Contain
Many Actors
Using Actors in Practice
Business Case: Sdbkin
Fulfillment
• “The App Store meets NuGet”
• Fulfillment requires:
– Provisioning NuGet feed
– Processing payment + generating invoice
– Sending out email notifications to customer +
publisher
– Scheduling renewal
– Other stuff (taxes, payouts)
Model Orders as State
Machines
(Saga Pattern)
Actor Implementation
• OrderActor – uses Akka.Persistence
with EntityId == Stripe “IntentId” (or
equivalent)
• Internal state event sourced from
UserService / external payment system
events
• State isn’t persisted until user attempts to
pay
• Uses Akka.Persistence.Azure as backing
store
Actor Infrastructure
• Akka.Cluster – allows us to fault-tolerantly
place actors anywhere in our network
• Akka.Cluster.Sharding – guarantees that
each OrderActor will be globally unique;
moves actors around the cluster to load-balance
and recover from faults
• Akka.Persistence – makes it possible for
actors to recover their state after restart, failure,
or a deployment
• Event-driven applications (i.e. chat, workflow,
CRM)
• Finance (pricing, fraud detection, algorithmic
trading)
• Gaming (multi-player)
• Analytics & monitoring
• Marketing automation
• Systems integration
• IOT (healthcare, transportation, security)
When to Use Akka.NET
What’s in it for me?
Promises
Actors can’t be accessed
directly, only through actor
references.
Actors work by
asynchronously processing
strongly typed messages.
Actors process messages
serially and in FIFO order.
Benefits
Implementation and location
transparency (S.O.C. and
scalability.)
Less code; automatic
concurrency.
Actor state is always thread-safe
and requires no locks.

More Related Content

What's hot

Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Lightbend
 
Kubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-HassanKubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-Hassan
Syed Murtaza Hassan
 
Akka and Kubernetes: Reactive From Code To Cloud
Akka and Kubernetes: Reactive From Code To CloudAkka and Kubernetes: Reactive From Code To Cloud
Akka and Kubernetes: Reactive From Code To Cloud
Lightbend
 
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
Helena Edelson
 
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and moreTypesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Legacy Typesafe (now Lightbend)
 
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OSPutting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Lightbend
 
Openstack Fundamentals by CloudZone @Back2School
Openstack Fundamentals by CloudZone @Back2SchoolOpenstack Fundamentals by CloudZone @Back2School
Openstack Fundamentals by CloudZone @Back2School
Asaf Abres
 
Containers Docker Kind Kubernetes Istio
Containers Docker Kind Kubernetes IstioContainers Docker Kind Kubernetes Istio
Containers Docker Kind Kubernetes Istio
Araf Karsh Hamid
 
Secrets in Kubernetes
Secrets in KubernetesSecrets in Kubernetes
Secrets in Kubernetes
Jerry Jalava
 
Container orchestration overview
Container orchestration overviewContainer orchestration overview
Container orchestration overview
Wyn B. Van Devanter
 
Do's and don'ts when deploying akka in production
Do's and don'ts when deploying akka in productionDo's and don'ts when deploying akka in production
Do's and don'ts when deploying akka in production
jglobal
 
Scalable Spark deployment using Kubernetes
Scalable Spark deployment using KubernetesScalable Spark deployment using Kubernetes
Scalable Spark deployment using Kubernetes
datamantra
 
Discovering the Service Fabric's actor model
Discovering the Service Fabric's actor modelDiscovering the Service Fabric's actor model
Discovering the Service Fabric's actor model
Massimo Bonanni
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
Jupil Hwang
 
Kubernetes @ meetic
Kubernetes @ meeticKubernetes @ meetic
Kubernetes @ meetic
Sébastien Le Gall
 
A Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingA Journey to Reactive Function Programming
A Journey to Reactive Function Programming
Ahmed Soliman
 
Apache Curator: Past, Present and Future
Apache Curator: Past, Present and FutureApache Curator: Past, Present and Future
Apache Curator: Past, Present and Future
Jordan Zimmerman
 
Federation of Kubernetes Clusters (Ubernetes) KubeCon 2015 slides - Quinton H...
Federation of Kubernetes Clusters (Ubernetes) KubeCon 2015 slides - Quinton H...Federation of Kubernetes Clusters (Ubernetes) KubeCon 2015 slides - Quinton H...
Federation of Kubernetes Clusters (Ubernetes) KubeCon 2015 slides - Quinton H...
Quinton Hoole
 
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline OverviewAWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
Wyn B. Van Devanter
 
What's new in Kubernetes
What's new in KubernetesWhat's new in Kubernetes
What's new in Kubernetes
Daniel Smith
 

What's hot (20)

Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
 
Kubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-HassanKubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-Hassan
 
Akka and Kubernetes: Reactive From Code To Cloud
Akka and Kubernetes: Reactive From Code To CloudAkka and Kubernetes: Reactive From Code To Cloud
Akka and Kubernetes: Reactive From Code To Cloud
 
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
Streaming Big Data with Spark, Kafka, Cassandra, Akka & Scala (from webinar)
 
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and moreTypesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
 
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OSPutting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
 
Openstack Fundamentals by CloudZone @Back2School
Openstack Fundamentals by CloudZone @Back2SchoolOpenstack Fundamentals by CloudZone @Back2School
Openstack Fundamentals by CloudZone @Back2School
 
Containers Docker Kind Kubernetes Istio
Containers Docker Kind Kubernetes IstioContainers Docker Kind Kubernetes Istio
Containers Docker Kind Kubernetes Istio
 
Secrets in Kubernetes
Secrets in KubernetesSecrets in Kubernetes
Secrets in Kubernetes
 
Container orchestration overview
Container orchestration overviewContainer orchestration overview
Container orchestration overview
 
Do's and don'ts when deploying akka in production
Do's and don'ts when deploying akka in productionDo's and don'ts when deploying akka in production
Do's and don'ts when deploying akka in production
 
Scalable Spark deployment using Kubernetes
Scalable Spark deployment using KubernetesScalable Spark deployment using Kubernetes
Scalable Spark deployment using Kubernetes
 
Discovering the Service Fabric's actor model
Discovering the Service Fabric's actor modelDiscovering the Service Fabric's actor model
Discovering the Service Fabric's actor model
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Kubernetes @ meetic
Kubernetes @ meeticKubernetes @ meetic
Kubernetes @ meetic
 
A Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingA Journey to Reactive Function Programming
A Journey to Reactive Function Programming
 
Apache Curator: Past, Present and Future
Apache Curator: Past, Present and FutureApache Curator: Past, Present and Future
Apache Curator: Past, Present and Future
 
Federation of Kubernetes Clusters (Ubernetes) KubeCon 2015 slides - Quinton H...
Federation of Kubernetes Clusters (Ubernetes) KubeCon 2015 slides - Quinton H...Federation of Kubernetes Clusters (Ubernetes) KubeCon 2015 slides - Quinton H...
Federation of Kubernetes Clusters (Ubernetes) KubeCon 2015 slides - Quinton H...
 
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline OverviewAWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
 
What's new in Kubernetes
What's new in KubernetesWhat's new in Kubernetes
What's new in Kubernetes
 

Similar to DotNext 2020 - When and How to Use the Actor Model and Akka.NET

Actor model in .NET - Akka.NET
Actor model in .NET - Akka.NETActor model in .NET - Akka.NET
Actor model in .NET - Akka.NET
Konrad Dusza
 
Akka Microservices Architecture And Design
Akka Microservices Architecture And DesignAkka Microservices Architecture And Design
Akka Microservices Architecture And Design
Yaroslav Tkachenko
 
Build Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and HerokuBuild Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and Heroku
Salesforce Developers
 
Real world Scala hAkking NLJUG JFall 2011
Real world Scala hAkking NLJUG JFall 2011Real world Scala hAkking NLJUG JFall 2011
Real world Scala hAkking NLJUG JFall 2011
Raymond Roestenburg
 
Event Sourcing and beyond with Akka.NET Persistence
Event Sourcing and beyond with Akka.NET PersistenceEvent Sourcing and beyond with Akka.NET Persistence
Event Sourcing and beyond with Akka.NET Persistence
Konrad Dusza
 
Reactive Streams - László van den Hoek
Reactive Streams - László van den HoekReactive Streams - László van den Hoek
Reactive Streams - László van den Hoek
RubiX BV
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and Akka
Yung-Lin Ho
 
Akka in Production - ScalaDays 2015
Akka in Production - ScalaDays 2015Akka in Production - ScalaDays 2015
Akka in Production - ScalaDays 2015
Evan Chan
 
Developing distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka ClusterDeveloping distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka Cluster
Konstantin Tsykulenko
 
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
João Pedro Martins
 
Reactive programming with examples
Reactive programming with examplesReactive programming with examples
Reactive programming with examples
Peter Lawrey
 
Building Reactive applications with Akka
Building Reactive applications with AkkaBuilding Reactive applications with Akka
Building Reactive applications with Akka
Knoldus Inc.
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
Skills Matter
 
Akka.Net Overview
Akka.Net OverviewAkka.Net Overview
Akka.Net Overview
Geoffrey Vandiest
 
Actor-based concurrency in a modern Java Enterprise
Actor-based concurrency in a modern Java EnterpriseActor-based concurrency in a modern Java Enterprise
Actor-based concurrency in a modern Java Enterprise
Alexander Lukyanchikov
 
Introduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupIntroduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users Group
Roy Russo
 
Reactive app using actor model & apache spark
Reactive app using actor model & apache sparkReactive app using actor model & apache spark
Reactive app using actor model & apache spark
Rahul Kumar
 
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Amazon Web Services
 
Reactive programming with akka
Reactive programming with akkaReactive programming with akka
Reactive programming with akka
Webdesign Factory
 
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
SolarWinds Loggly
 

Similar to DotNext 2020 - When and How to Use the Actor Model and Akka.NET (20)

Actor model in .NET - Akka.NET
Actor model in .NET - Akka.NETActor model in .NET - Akka.NET
Actor model in .NET - Akka.NET
 
Akka Microservices Architecture And Design
Akka Microservices Architecture And DesignAkka Microservices Architecture And Design
Akka Microservices Architecture And Design
 
Build Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and HerokuBuild Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and Heroku
 
Real world Scala hAkking NLJUG JFall 2011
Real world Scala hAkking NLJUG JFall 2011Real world Scala hAkking NLJUG JFall 2011
Real world Scala hAkking NLJUG JFall 2011
 
Event Sourcing and beyond with Akka.NET Persistence
Event Sourcing and beyond with Akka.NET PersistenceEvent Sourcing and beyond with Akka.NET Persistence
Event Sourcing and beyond with Akka.NET Persistence
 
Reactive Streams - László van den Hoek
Reactive Streams - László van den HoekReactive Streams - László van den Hoek
Reactive Streams - László van den Hoek
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and Akka
 
Akka in Production - ScalaDays 2015
Akka in Production - ScalaDays 2015Akka in Production - ScalaDays 2015
Akka in Production - ScalaDays 2015
 
Developing distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka ClusterDeveloping distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka Cluster
 
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
 
Reactive programming with examples
Reactive programming with examplesReactive programming with examples
Reactive programming with examples
 
Building Reactive applications with Akka
Building Reactive applications with AkkaBuilding Reactive applications with Akka
Building Reactive applications with Akka
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
 
Akka.Net Overview
Akka.Net OverviewAkka.Net Overview
Akka.Net Overview
 
Actor-based concurrency in a modern Java Enterprise
Actor-based concurrency in a modern Java EnterpriseActor-based concurrency in a modern Java Enterprise
Actor-based concurrency in a modern Java Enterprise
 
Introduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupIntroduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users Group
 
Reactive app using actor model & apache spark
Reactive app using actor model & apache sparkReactive app using actor model & apache spark
Reactive app using actor model & apache spark
 
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
Infrastructure at Scale: Apache Kafka, Twitter Storm & Elastic Search (ARC303...
 
Reactive programming with akka
Reactive programming with akkaReactive programming with akka
Reactive programming with akka
 
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
 

More from petabridge

NET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxNET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptx
petabridge
 
.NET Conf 2019 When and How to Use the Actor Model: an Introduction to Akka...
.NET Conf 2019   When and How to Use the Actor Model: an Introduction to Akka....NET Conf 2019   When and How to Use the Actor Model: an Introduction to Akka...
.NET Conf 2019 When and How to Use the Actor Model: an Introduction to Akka...
petabridge
 
Introduction to Distributed Tracing
Introduction to Distributed TracingIntroduction to Distributed Tracing
Introduction to Distributed Tracing
petabridge
 
Akka.NET: Concurrency without the Pain
Akka.NET: Concurrency without the PainAkka.NET: Concurrency without the Pain
Akka.NET: Concurrency without the Pain
petabridge
 
Automed .NET Performance Testing with NBench
Automed .NET Performance Testing with NBenchAutomed .NET Performance Testing with NBench
Automed .NET Performance Testing with NBench
petabridge
 
We're all distributed systems devs now: a crash course in distributed program...
We're all distributed systems devs now: a crash course in distributed program...We're all distributed systems devs now: a crash course in distributed program...
We're all distributed systems devs now: a crash course in distributed program...
petabridge
 
The New .NET Enterprise Stack
The New .NET Enterprise StackThe New .NET Enterprise Stack
The New .NET Enterprise Stack
petabridge
 
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET ActorsFull-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
petabridge
 
OSS From the Outside In - A Personal Journey With Akka.NET
OSS From the Outside In - A Personal Journey With Akka.NETOSS From the Outside In - A Personal Journey With Akka.NET
OSS From the Outside In - A Personal Journey With Akka.NET
petabridge
 
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NETConcurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
petabridge
 
Akka.NET @ London.NET
Akka.NET @ London.NETAkka.NET @ London.NET
Akka.NET @ London.NET
petabridge
 
Akka.NET Fundamentals — #ProgNet15
Akka.NET Fundamentals — #ProgNet15Akka.NET Fundamentals — #ProgNet15
Akka.NET Fundamentals — #ProgNet15
petabridge
 
Slides - Intro to Akka.Cluster
Slides - Intro to Akka.ClusterSlides - Intro to Akka.Cluster
Slides - Intro to Akka.Cluster
petabridge
 
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
petabridge
 
Distributed Transactions in Akka.NET
Distributed Transactions in Akka.NETDistributed Transactions in Akka.NET
Distributed Transactions in Akka.NET
petabridge
 
Streaming ETL With Akka.NET
Streaming ETL With Akka.NETStreaming ETL With Akka.NET
Streaming ETL With Akka.NET
petabridge
 
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
petabridge
 

More from petabridge (17)

NET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxNET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptx
 
.NET Conf 2019 When and How to Use the Actor Model: an Introduction to Akka...
.NET Conf 2019   When and How to Use the Actor Model: an Introduction to Akka....NET Conf 2019   When and How to Use the Actor Model: an Introduction to Akka...
.NET Conf 2019 When and How to Use the Actor Model: an Introduction to Akka...
 
Introduction to Distributed Tracing
Introduction to Distributed TracingIntroduction to Distributed Tracing
Introduction to Distributed Tracing
 
Akka.NET: Concurrency without the Pain
Akka.NET: Concurrency without the PainAkka.NET: Concurrency without the Pain
Akka.NET: Concurrency without the Pain
 
Automed .NET Performance Testing with NBench
Automed .NET Performance Testing with NBenchAutomed .NET Performance Testing with NBench
Automed .NET Performance Testing with NBench
 
We're all distributed systems devs now: a crash course in distributed program...
We're all distributed systems devs now: a crash course in distributed program...We're all distributed systems devs now: a crash course in distributed program...
We're all distributed systems devs now: a crash course in distributed program...
 
The New .NET Enterprise Stack
The New .NET Enterprise StackThe New .NET Enterprise Stack
The New .NET Enterprise Stack
 
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET ActorsFull-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
 
OSS From the Outside In - A Personal Journey With Akka.NET
OSS From the Outside In - A Personal Journey With Akka.NETOSS From the Outside In - A Personal Journey With Akka.NET
OSS From the Outside In - A Personal Journey With Akka.NET
 
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NETConcurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
 
Akka.NET @ London.NET
Akka.NET @ London.NETAkka.NET @ London.NET
Akka.NET @ London.NET
 
Akka.NET Fundamentals — #ProgNet15
Akka.NET Fundamentals — #ProgNet15Akka.NET Fundamentals — #ProgNet15
Akka.NET Fundamentals — #ProgNet15
 
Slides - Intro to Akka.Cluster
Slides - Intro to Akka.ClusterSlides - Intro to Akka.Cluster
Slides - Intro to Akka.Cluster
 
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
Akka.NET: Concurrency Without the Pain (Intro to the Actor Model)
 
Distributed Transactions in Akka.NET
Distributed Transactions in Akka.NETDistributed Transactions in Akka.NET
Distributed Transactions in Akka.NET
 
Streaming ETL With Akka.NET
Streaming ETL With Akka.NETStreaming ETL With Akka.NET
Streaming ETL With Akka.NET
 
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
2 12-2015 - Cassandra Day LA - Using DataStax Enterprise and Actor Systems fo...
 

Recently uploaded

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 

Recently uploaded (20)

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 

DotNext 2020 - When and How to Use the Actor Model and Akka.NET

  • 1. When and How to Use the Actor Model: an Introduction to Akka.NET Aaron Stannard, Co-Founder of Akka.NET and Petabridge
  • 2. Origins of the Actor Model
  • 3. 1973 – Original Actor Model Paper Computer scientists thought future computers would be living-room sized mainframes with thousands of low-powered CPUs. Thus, we needed a way to write programs that could run on multiple cores, a novel concept at the time. https://commons.wikimedia.org/w/index.php?curid=6455009
  • 4. Actors in the 1970s • Each actor is its own “micro process” • Owns 1 core (there are thousands) • Communicate across cores via message- passing in shared memory • Actors process 1 message at a time
  • 7. 1970s Actors Never Came to Pass
  • 8. 1980s: Erlang Actors • Development of network computing revived actor model. • First implemented in 1986 by Ericsson. Powers modern day GPRS, 3G, and LTE cell networks. • Used to provide fault tolerance, soft-real time programming, and linear hardware scalability for telephony networks.
  • 9. Modern CPUs: More Cores! Source: Karl Rupp https://www.karlrupp.net/2018/02/42-years-of-microprocessor-trend-data/
  • 10. Modern Day: Actors Everywhere • Multi-core programming now ubiquitous • Developers need more robust model than “shared state concurrent programming” • Cloud computing == 1970s vision of dividing work across thousands of cheap CPUs finally comes true
  • 11. Why Use the Actor Model?
  • 12. Actors Reduce Big Problems into Small Ones
  • 13. • Accumulate state in- memory. • Can react to changes in state in real-time. • No database calls, I/O, or external infrastructure. Actors are Reactive
  • 16. Actors Scale & Distribute
  • 17. Actors Recover from Network Failures
  • 18. Actors Are Used in Domains Where • Soft real-time guarantees are common – i.e. “every transaction must be completed within ~100ms to be within SLA” • Work is best modeled as streams – Long-running jobs (i.e. Asset line management, simulations, ETL, migrations) – Continuous flows(i.e. IOT, marketing automation, real-time pricing) • High availability is key to business success
  • 20. PS> Install-Package Akka (base types) PS> Install-Package Akka.Remote (networking) PS> Install-Package Akka.Persistence (durable actors) PS> Install-Package Akka.Cluster (HA networking) PS> Install-Package Akka.Streams (fun) Installing Akka.NET
  • 23. • Actor = a class that can contain state and modifies that state by processing messages it receives. • ActorReference = a handle to an actor. Allows you to send the actor messages without knowing its implementation type or location on network. • ActorSystem = a collection of actors that exist inside a single process and communicate via in-memory message passing. • Cluster = a collection of networked ActorSystems whose actors communicate via TCP message passing. Actor Terms
  • 25. State is Shared Only Through Messages
  • 26. Actor References are Location Transparent • IActorRef can point to local actor (in- memory messaging.) • IActorRef can point to actor running in another remote process (TCP messaging.) • You don’t need to explicitly know or care which is which.
  • 27. But Actors Still Have Explicit Addresses
  • 29. Using Actors in Practice
  • 30. Business Case: Sdbkin Fulfillment • “The App Store meets NuGet” • Fulfillment requires: – Provisioning NuGet feed – Processing payment + generating invoice – Sending out email notifications to customer + publisher – Scheduling renewal – Other stuff (taxes, payouts)
  • 31. Model Orders as State Machines (Saga Pattern)
  • 32.
  • 33.
  • 34. Actor Implementation • OrderActor – uses Akka.Persistence with EntityId == Stripe “IntentId” (or equivalent) • Internal state event sourced from UserService / external payment system events • State isn’t persisted until user attempts to pay • Uses Akka.Persistence.Azure as backing store
  • 35. Actor Infrastructure • Akka.Cluster – allows us to fault-tolerantly place actors anywhere in our network • Akka.Cluster.Sharding – guarantees that each OrderActor will be globally unique; moves actors around the cluster to load-balance and recover from faults • Akka.Persistence – makes it possible for actors to recover their state after restart, failure, or a deployment
  • 36.
  • 37. • Event-driven applications (i.e. chat, workflow, CRM) • Finance (pricing, fraud detection, algorithmic trading) • Gaming (multi-player) • Analytics & monitoring • Marketing automation • Systems integration • IOT (healthcare, transportation, security) When to Use Akka.NET
  • 38. What’s in it for me? Promises Actors can’t be accessed directly, only through actor references. Actors work by asynchronously processing strongly typed messages. Actors process messages serially and in FIFO order. Benefits Implementation and location transparency (S.O.C. and scalability.) Less code; automatic concurrency. Actor state is always thread-safe and requires no locks.