The Future of Distributed Programming in Dotnet
The Future of Distributed Programming in Dotnet
Distributed Programming
@petabridge Petabridge.com
A Business Story
@petabridge Petabridge.com
Successful Product
@petabridge Petabridge.com
Struggling Business
@petabridge Petabridge.com
A Radical New Product
@petabridge Petabridge.com
Allow our customers to
start conversations with
the specific types of users.
@petabridge Petabridge.com
Had to be done in real-
time for best results.
@petabridge Petabridge.com
Implementation
@petabridge Petabridge.com
Prototype 1: HTTP +
Database
@petabridge Petabridge.com
(Read after Write)
@petabridge Petabridge.com
Theory
@petabridge Petabridge.com
Reality
@petabridge Petabridge.com
What now?
@petabridge Petabridge.com
I have no idea how to build
this product
@petabridge Petabridge.com
And no vocabulary to
describe my problem
@petabridge Petabridge.com
Desperation
@petabridge Petabridge.com
Breakthrough!
@petabridge Petabridge.com
I had STATEFUL problem!
@petabridge Petabridge.com
But HTTP is a stateless
protocol
@petabridge Petabridge.com
Breakthrough #2
@petabridge Petabridge.com
I had STATEFUL, REACTIVE,
STREAM PROCESSING
problem!
@petabridge Petabridge.com
Akka and the Actor Model
@petabridge Petabridge.com
Reasoning
@petabridge Petabridge.com
OF COURSE IT DOESN'T
@petabridge Petabridge.com
.... Port everything to JVM?
@petabridge Petabridge.com
Lesser of Two Evils
@petabridge Petabridge.com
6 Months Later
@petabridge Petabridge.com
Petabridge
@petabridge Petabridge.com
The actor model creates
new possibilities for
developers
@petabridge Petabridge.com
The New Reality
Data is trivially
cheap to collect
and store
Users accept
nothing less
than excellence
Developers are
expected to
deliver more
@petabridge Petabridge.com
Actor Model to the Rescue!
@petabridge Petabridge.com
What is the actor model
@petabridge Petabridge.com
Everything is an actor.
@petabridge Petabridge.com
Actors work by passing each other
messages
@petabridge Petabridge.com
This is an actor
@petabridge Petabridge.com
These are messages
@petabridge Petabridge.com
@petabridge Petabridge.com
@petabridge Petabridge.com
3 Core Actor Abilities
1. Send messages
2. Create other
actors
3. Change behavior
@petabridge Petabridge.com
Benefit 1: actors make it
easy to write
asynchronous applications
@petabridge Petabridge.com
Benefit 2: actor state is
always thread-safe and
never needs locks!
@petabridge Petabridge.com
Actor Thread Safety
Actor state is never shared directly
with any other object
@petabridge Petabridge.com
Benefit 3: actors are
resilient to failures
@petabridge Petabridge.com
Actors Exist as Hierarchies
@petabridge Petabridge.com
Parents Supervise Children
@petabridge Petabridge.com
When actors fail, parents
can restart them into their
original state
@petabridge Petabridge.com
Benefit 4: Actors can be
easily distributed across
the network
@petabridge Petabridge.com
Actors have globally unique
addresses
@petabridge Petabridge.com
But you dont need to
know an actors address.
(We use Actor References to
communicate with actors)
@petabridge Petabridge.com
ActorRefs have location
transparency
@petabridge Petabridge.com
Location of Actor in Cluster
Doesn't Matter
@petabridge Petabridge.com
Benefit 5: actors reduce
the size of your code
footprint
@petabridge Petabridge.com
Traditional OOP: write
code that manages 1000
entities
@petabridge Petabridge.com
With actor model: write
actor that manages 1
entity, run 1000 of them in
parallel
@petabridge Petabridge.com
New Ways of Looking at
Problems
@petabridge Petabridge.com
What does this make
possible for you?
@petabridge Petabridge.com
THANK YOU!
Email:
[email protected]
Twitter:
@aaronontheweb
@AkkaDotNet
@petabridge Petabridge.com
http://LearnAkka.net
@petabridge Petabridge.com