SlideShare ist ein Scribd-Unternehmen logo
1 von 49
ORLEANS
Distributed Virtual Actors for Programmability and Scalability
Philip A. Bernstein, Sergey Bykov, Alan Geller, Gabriel Kliot, Jorgen Thelin
Victor Hurdugaci
VICTOR HURDUGACI
• Romanian
• Currently: Electronic Arts, Seattle
• Past: Microsoft (ASP.NET, Azure WebJobs/Functions, X++ compiler)
• Fell asleep and woke up in a different country
• @VictorHurdugaci
• http://victorh.info
INTRODUCTION
• Building interactive services that are scalable and reliable is hard
INTRODUCTION
• Frontend: stateless
• Middle-tier: stateless
Frontend FrontendFrontendFrontendFrontendFrontend
Middle-tierMiddle-tierMiddle-tier
Storage
INTRODUCTION
• Frontend: stateless
• Middle-tier: stateless
• Limited scalability of storage Frontend FrontendFrontendFrontendFrontendFrontend
Middle-tierMiddle-tierMiddle-tier
Storage
INTRODUCTION
• Frontend: stateless
• Middle-tier: stateless
• Limited scalability of storage Frontend FrontendFrontendFrontendFrontendFrontend
Middle-tierMiddle-tierMiddle-tier
Storage
Cache
INTRODUCTION
• Frontend: stateless
• Middle-tier : stateless
• Limited scalability of storage
• Win:
• Latency
• Throughput
Frontend FrontendFrontendFrontendFrontendFrontend
Middle-tierMiddle-tierMiddle-tier
Storage
Cache
INTRODUCTION
• Frontend: stateless
• Middle-tier : stateless
• Limited scalability of storage
• Win:
• Latency
• Throughput
• Loss:
• Concurrency
• Semantic guarantees
Frontend FrontendFrontendFrontendFrontendFrontend
Middle-tierMiddle-tierMiddle-tier
Storage
Cache
INTRODUCTION
• Frontend: stateless
• Middle-tier : stateless
• Limited scalability of storage
• Win:
• Latency
• Throughput
• Loss:
• Concurrency
• Semantic guarantees
• Custom concurrency control protocol
Frontend FrontendFrontendFrontendFrontendFrontend
Middle-tierMiddle-tierMiddle-tier
Storage
Cache
INTRODUCTION
• Data shipping paradigm: on
every request, the data is shipped
from cache/storage to middle tier
• It does not provide data locality Frontend FrontendFrontendFrontendFrontendFrontend
Middle-tierMiddle-tierMiddle-tier
Storage
Cache
INTRODUCTION
• Function shipping paradigm
• Stateful middle tier
• Performance benefits of cache
• Data locality
• Semantic and consistency benefits
Frontend FrontendFrontendFrontendFrontendFrontend
Middle-tierMiddle-tierMiddle-tier
Storage
Data Data Data
INTRODUCTION
• OOP – intuitive way to model complex systems
• Marginalized in SOA
• Loosely-coupled partitioned services don’t often match objects
• The actor model brings OOP back to system level
VIRTUAL ACTORS
• An actor is a computational entity that, in response to a message it receives, can
concurrently:
• 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 (change state)
-- Wikipedia
OTHER SYSTEMS
• Erlang and Akka
• No lifecycle management
• Distributed races
• No failure management
• Distributed resource management
ORLEANS VIRTUAL ACTORS
• Always exists
• No explicitly creation/destruction
• Automatic resource management
• Never fail
• Location is transparent to application code
LOCATION TRANSPARENCY
Foo x = new Foo(42)
…
x.DoSomething(43)
2.1. VIRTUAL ACTORS
• Actor identity: type + 128 bit GUID
• Behavior
• State
• Actors are isolated from each other
2.1. VIRTUAL ACTORS
1. Perpetual existence
2. Automatic instantiation (activation)
3. Location transparency
4. Automatic scale out
• Stateful – single instance
• Stateless – scale automatically (up to a limit)
2.2. ACTOR INTERFACES
• Strong type interfaces
• All methods must be async
1 public interface IGameActor: IActor
2 {
3 Task<string> GameName { get; }
4 Task<List> CurrentPlayers { get; }
5 Task JoinGame(IPlayerActor game);
6 Task LeaveGame(IPlayerActor game);
7 }
2.3. ACTOR REFERENCES
• Strongly typed proxy
• “GetActor” method is generated at compile time
• Request by primary key (GUID)
• References can be passed as arguments (!)
1 public static class GameActorFactory
2 {
3 public static IGameActor GetActor(Guid gameId);
4 }
2.4. PROMISES
• No blocking calls
• Promise states: unresolved, fulfilled, broken
• Closure/continuation
• .NET: System.Threading.Tasks.Task<T>
• C#: async/await
1 IGameActor gameActor = GameActorFactory.GetActor(gameId);
2 try{
3 string name = await gameActor.GameName;
4 Console.WriteLine(“Game name is ” + name);
5 } catch(Exception) {
6 Console.WriteLine(“The call to actor failed”);
7 }
2.5. TURNS
• Activations are single threaded
• Work in chunks: turns
• Turns (from different actors) can be interleaved
• [Reentrant] attribute
2.6 TURNS
From: http://martintrojer.github.io/clojure/2013/07/07/coreasync-and-blocking-io
2.6 TURNS
From: http://martintrojer.github.io/clojure/2013/07/07/coreasync-and-blocking-io
2.6. PERSISTENCE
• State = property bag interface
1 public interface IGameState: IState
2 {
3 GameStatus Status { get; set }
4 List Players { get; set;}
5 }
6 public class GameActor: ActorBase<IGameState>, IGameActor
7 {
8 Task JoinGame(IPlayerActor game) {
9 this.State.Players.Add(IPlayerActor);
10 this.State.WriteStateAsync();
11 }
12 }
2.6. PERSISTENCE
• Application controlled
• Persistence providers: SQL, Azure Storage, etc
3.1 RUNTIME IMPLEMENTATION
Orleans cluster
Server
Orleans process
Actor Actor Actor
Actor Actor
Server
Orleans process
Actor Actor Actor
Actor
Server
Orleans process
Actor Actor Actor
Actor Actor
Server
Orleans process
Actor Actor Actor
3.1 RUNTIME IMPLEMENTATION
Orleans process
Messaging Hosting Execution
• 1 TCP connection between
each pair of servers
• Multiplex messages
• Actor placement
• Actor lifecycle
• Resource management
• Actor code execution
• Reentrancy
• Single threading
3.2. DISTRIBUTED DIRECTORY
A
C
B
D
Act.1244 -> Hello
3.2. DISTRIBUTED DIRECTORY
• Maps actor id <-> location
• One-hop distributed hash table
• Each server holds a partition of the directory
• Actor partitioning: consistent hashing
A
C
[Act.1234, A]
[Act.1244, C]
[Act.1254, D]
[Act.1235, F]
[Act.1245, A]
[Act.1255, E]
B
D
Act.1244 -> Hello
3.2. DISTRIBUTED DIRECTORY
• Maps actor id <-> location
• One-hop distributed hash table
• Each server holds a partition of the directory
• Actor partitioning: consistent hashing
A
C
1. Act.1244 ?
[Act.1234, A]
[Act.1244, C]
[Act.1254, D]
[Act.1235, F]
[Act.1245, A]
[Act.1255, E]
B
D
Act.1244 -> Hello
3.2. DISTRIBUTED DIRECTORY
• Maps actor id <-> location
• One-hop distributed hash table
• Each server holds a partition of the directory
• Actor partitioning: consistent hashing
A
C
1. Act.1244 ?
[Act.1234, A]
[Act.1244, C]
[Act.1254, D]2. C
[Act.1235, F]
[Act.1245, A]
[Act.1255, E]
B
D
Act.1244 -> Hello
3.2. DISTRIBUTED DIRECTORY
• Maps actor id <-> location
• One-hop distributed hash table
• Each server holds a partition of the directory
• Actor partitioning: consistent hashing
A
C
1. Act.1244 ?
[Act.1234, A]
[Act.1244, C]
[Act.1254, D]2. C
3. Hello
[Act.1235, F]
[Act.1245, A]
[Act.1255, E]
B
D
Act.1244 -> Hello
3.2. DISTRIBUTED DIRECTORY
• Maps actor id <-> location
• One-hop distributed hash table
• Each server holds a partition of the directory
• Actor partitioning: consistent hashing
• (De)Activations update records in the table
• Directory enforces single-activations
A
C
1. Act.1244 ?
[Act.1234, A]
[Act.1244, C]
[Act.1254, D]2. C
3. Hello
[Act.1235, F]
[Act.1245, A]
[Act.1255, E]
B
D
Act.1244 -> Hello
3.2. DISTRIBUTED DIRECTORY
• Maps actor id <-> location
• One-hop distributed hash table
• Each server holds a partition of the directory
• Actor partitioning: consistent hashing
• (De)Activations update records in the table
• Directory enforces single-activations
• Avoid extra hop: large (millions) cache of recent activations
A
C
1. Act.1244 ?
[Act.1234, A]
[Act.1244, C]
[Act.1254, D]2. C
3. Hello
[Act.1235, F]
[Act.1245, A]
[Act.1255, E]
B
D
Act.1244 -> Hello
3.3. STRONG ISOLATION
• Actors don’t share state and communication is always message based
• Method arguments & return values are deep copied
• Guarantees immutability
3.8. RELIABILITY
• Orleans manages everything except persistence
• Failure detection: heartbeats
• Membership view is eventual consistent (30-60s on production servers)
• A “dead” actor is activated on a different server
• Actor lifespan not linked to server lifespan
• No checkpoint strategy (depends on application)
• Misrouted messages are sent to the right destination and sender is notified
3.9. EVENTUAL CONSISTENCY
• No failure = single activation guarantee
• Failure = single activation eventual guarantee
• Two activations in two different partitions
• One is eventually dropped
• Availability over consistency
3.10. MESSAGING GUARANTEES
• At-least-once message guarantee
• Exactly-once can be implemented at application level (request id)
• No FIFO guarantees (sender: A, B, C; receiver: B, A, C)
4.1 HALO 4 PRESENCE SERVICE
4.2. HALO 4 STATISTICS SERVICE
5.1. SYNTHETIC MICRO BENCHMARKS
5.1. SYNTHETIC MICRO BENCHMARKS
*test server had 8 cores
5.1. SYNTHETIC MICRO BENCHMARKS
5.2 HALO PRESENCE
PERFORMANCE EVALUATION
5.2 HALO PRESENCE
PERFORMANCE EVALUATION
ORLEANS DRAWBACKS
• Bulk operations
• Large number of actors (billions) + no temporal locality
• No cross-actor transactions
6.2. OTHER ACTOR FRAMEWORKS
• Akka http://akka.io/
• Erlang https://www.erlang.org/
Not in the paper:
• Orbit (Java/JVM) https://github.com/orbit/orbit
Victor Hurdugaci
http://victorh.info

Weitere ähnliche Inhalte

Ähnlich wie 2017.09.07 Orleans - PWL Seattle

VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012
Eonblast
 
Racsig rac internals
Racsig rac internalsRacsig rac internals
Racsig rac internals
pv_narayanan
 
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
VMware Tanzu
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
Luka Zakrajšek
 
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiGustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Software Guru
 

Ähnlich wie 2017.09.07 Orleans - PWL Seattle (20)

Concurrency (Fisher Syer S2GX 2010)
Concurrency (Fisher Syer S2GX 2010)Concurrency (Fisher Syer S2GX 2010)
Concurrency (Fisher Syer S2GX 2010)
 
Lagom - Mircoservices "Just Right"
Lagom - Mircoservices "Just Right"Lagom - Mircoservices "Just Right"
Lagom - Mircoservices "Just Right"
 
VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012
 
MesosCon EU 2017 - Criteo - Operating Mesos-based Infrastructures
MesosCon EU 2017 - Criteo - Operating Mesos-based InfrastructuresMesosCon EU 2017 - Criteo - Operating Mesos-based Infrastructures
MesosCon EU 2017 - Criteo - Operating Mesos-based Infrastructures
 
Akka.Net Overview
Akka.Net OverviewAkka.Net Overview
Akka.Net Overview
 
The impact of cloud NSBCon NY by Yves Goeleven
The impact of cloud NSBCon NY by Yves GoelevenThe impact of cloud NSBCon NY by Yves Goeleven
The impact of cloud NSBCon NY by Yves Goeleven
 
Racsig rac internals
Racsig rac internalsRacsig rac internals
Racsig rac internals
 
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
 
Reasonable RPC with Remotely
Reasonable RPC with RemotelyReasonable RPC with Remotely
Reasonable RPC with Remotely
 
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
 
Geode introduction
Geode introductionGeode introduction
Geode introduction
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
 
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiGustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
 
InfectNet Technical
InfectNet TechnicalInfectNet Technical
InfectNet Technical
 
Deploying microservices on AWS
Deploying microservices on AWSDeploying microservices on AWS
Deploying microservices on AWS
 
Software Defined Networking: Primer
Software Defined Networking: Primer Software Defined Networking: Primer
Software Defined Networking: Primer
 
Orchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failuresOrchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failures
 
Playtrip: a CQRS/ES architecture in Erlang.
Playtrip: a CQRS/ES architecture in Erlang.Playtrip: a CQRS/ES architecture in Erlang.
Playtrip: a CQRS/ES architecture in Erlang.
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017
 
Alwayson in sqlserver2017
Alwayson in sqlserver2017Alwayson in sqlserver2017
Alwayson in sqlserver2017
 

Kürzlich hochgeladen

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 

Kürzlich hochgeladen (20)

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

2017.09.07 Orleans - PWL Seattle

  • 1. ORLEANS Distributed Virtual Actors for Programmability and Scalability Philip A. Bernstein, Sergey Bykov, Alan Geller, Gabriel Kliot, Jorgen Thelin Victor Hurdugaci
  • 2. VICTOR HURDUGACI • Romanian • Currently: Electronic Arts, Seattle • Past: Microsoft (ASP.NET, Azure WebJobs/Functions, X++ compiler) • Fell asleep and woke up in a different country • @VictorHurdugaci • http://victorh.info
  • 3. INTRODUCTION • Building interactive services that are scalable and reliable is hard
  • 4. INTRODUCTION • Frontend: stateless • Middle-tier: stateless Frontend FrontendFrontendFrontendFrontendFrontend Middle-tierMiddle-tierMiddle-tier Storage
  • 5. INTRODUCTION • Frontend: stateless • Middle-tier: stateless • Limited scalability of storage Frontend FrontendFrontendFrontendFrontendFrontend Middle-tierMiddle-tierMiddle-tier Storage
  • 6. INTRODUCTION • Frontend: stateless • Middle-tier: stateless • Limited scalability of storage Frontend FrontendFrontendFrontendFrontendFrontend Middle-tierMiddle-tierMiddle-tier Storage Cache
  • 7. INTRODUCTION • Frontend: stateless • Middle-tier : stateless • Limited scalability of storage • Win: • Latency • Throughput Frontend FrontendFrontendFrontendFrontendFrontend Middle-tierMiddle-tierMiddle-tier Storage Cache
  • 8. INTRODUCTION • Frontend: stateless • Middle-tier : stateless • Limited scalability of storage • Win: • Latency • Throughput • Loss: • Concurrency • Semantic guarantees Frontend FrontendFrontendFrontendFrontendFrontend Middle-tierMiddle-tierMiddle-tier Storage Cache
  • 9. INTRODUCTION • Frontend: stateless • Middle-tier : stateless • Limited scalability of storage • Win: • Latency • Throughput • Loss: • Concurrency • Semantic guarantees • Custom concurrency control protocol Frontend FrontendFrontendFrontendFrontendFrontend Middle-tierMiddle-tierMiddle-tier Storage Cache
  • 10. INTRODUCTION • Data shipping paradigm: on every request, the data is shipped from cache/storage to middle tier • It does not provide data locality Frontend FrontendFrontendFrontendFrontendFrontend Middle-tierMiddle-tierMiddle-tier Storage Cache
  • 11. INTRODUCTION • Function shipping paradigm • Stateful middle tier • Performance benefits of cache • Data locality • Semantic and consistency benefits Frontend FrontendFrontendFrontendFrontendFrontend Middle-tierMiddle-tierMiddle-tier Storage Data Data Data
  • 12. INTRODUCTION • OOP – intuitive way to model complex systems • Marginalized in SOA • Loosely-coupled partitioned services don’t often match objects • The actor model brings OOP back to system level
  • 13. VIRTUAL ACTORS • An actor is a computational entity that, in response to a message it receives, can concurrently: • 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 (change state) -- Wikipedia
  • 14. OTHER SYSTEMS • Erlang and Akka • No lifecycle management • Distributed races • No failure management • Distributed resource management
  • 15. ORLEANS VIRTUAL ACTORS • Always exists • No explicitly creation/destruction • Automatic resource management • Never fail • Location is transparent to application code
  • 16. LOCATION TRANSPARENCY Foo x = new Foo(42) … x.DoSomething(43)
  • 17. 2.1. VIRTUAL ACTORS • Actor identity: type + 128 bit GUID • Behavior • State • Actors are isolated from each other
  • 18. 2.1. VIRTUAL ACTORS 1. Perpetual existence 2. Automatic instantiation (activation) 3. Location transparency 4. Automatic scale out • Stateful – single instance • Stateless – scale automatically (up to a limit)
  • 19. 2.2. ACTOR INTERFACES • Strong type interfaces • All methods must be async 1 public interface IGameActor: IActor 2 { 3 Task<string> GameName { get; } 4 Task<List> CurrentPlayers { get; } 5 Task JoinGame(IPlayerActor game); 6 Task LeaveGame(IPlayerActor game); 7 }
  • 20. 2.3. ACTOR REFERENCES • Strongly typed proxy • “GetActor” method is generated at compile time • Request by primary key (GUID) • References can be passed as arguments (!) 1 public static class GameActorFactory 2 { 3 public static IGameActor GetActor(Guid gameId); 4 }
  • 21. 2.4. PROMISES • No blocking calls • Promise states: unresolved, fulfilled, broken • Closure/continuation • .NET: System.Threading.Tasks.Task<T> • C#: async/await 1 IGameActor gameActor = GameActorFactory.GetActor(gameId); 2 try{ 3 string name = await gameActor.GameName; 4 Console.WriteLine(“Game name is ” + name); 5 } catch(Exception) { 6 Console.WriteLine(“The call to actor failed”); 7 }
  • 22. 2.5. TURNS • Activations are single threaded • Work in chunks: turns • Turns (from different actors) can be interleaved • [Reentrant] attribute
  • 25. 2.6. PERSISTENCE • State = property bag interface 1 public interface IGameState: IState 2 { 3 GameStatus Status { get; set } 4 List Players { get; set;} 5 } 6 public class GameActor: ActorBase<IGameState>, IGameActor 7 { 8 Task JoinGame(IPlayerActor game) { 9 this.State.Players.Add(IPlayerActor); 10 this.State.WriteStateAsync(); 11 } 12 }
  • 26. 2.6. PERSISTENCE • Application controlled • Persistence providers: SQL, Azure Storage, etc
  • 27. 3.1 RUNTIME IMPLEMENTATION Orleans cluster Server Orleans process Actor Actor Actor Actor Actor Server Orleans process Actor Actor Actor Actor Server Orleans process Actor Actor Actor Actor Actor Server Orleans process Actor Actor Actor
  • 28. 3.1 RUNTIME IMPLEMENTATION Orleans process Messaging Hosting Execution • 1 TCP connection between each pair of servers • Multiplex messages • Actor placement • Actor lifecycle • Resource management • Actor code execution • Reentrancy • Single threading
  • 30. 3.2. DISTRIBUTED DIRECTORY • Maps actor id <-> location • One-hop distributed hash table • Each server holds a partition of the directory • Actor partitioning: consistent hashing A C [Act.1234, A] [Act.1244, C] [Act.1254, D] [Act.1235, F] [Act.1245, A] [Act.1255, E] B D Act.1244 -> Hello
  • 31. 3.2. DISTRIBUTED DIRECTORY • Maps actor id <-> location • One-hop distributed hash table • Each server holds a partition of the directory • Actor partitioning: consistent hashing A C 1. Act.1244 ? [Act.1234, A] [Act.1244, C] [Act.1254, D] [Act.1235, F] [Act.1245, A] [Act.1255, E] B D Act.1244 -> Hello
  • 32. 3.2. DISTRIBUTED DIRECTORY • Maps actor id <-> location • One-hop distributed hash table • Each server holds a partition of the directory • Actor partitioning: consistent hashing A C 1. Act.1244 ? [Act.1234, A] [Act.1244, C] [Act.1254, D]2. C [Act.1235, F] [Act.1245, A] [Act.1255, E] B D Act.1244 -> Hello
  • 33. 3.2. DISTRIBUTED DIRECTORY • Maps actor id <-> location • One-hop distributed hash table • Each server holds a partition of the directory • Actor partitioning: consistent hashing A C 1. Act.1244 ? [Act.1234, A] [Act.1244, C] [Act.1254, D]2. C 3. Hello [Act.1235, F] [Act.1245, A] [Act.1255, E] B D Act.1244 -> Hello
  • 34. 3.2. DISTRIBUTED DIRECTORY • Maps actor id <-> location • One-hop distributed hash table • Each server holds a partition of the directory • Actor partitioning: consistent hashing • (De)Activations update records in the table • Directory enforces single-activations A C 1. Act.1244 ? [Act.1234, A] [Act.1244, C] [Act.1254, D]2. C 3. Hello [Act.1235, F] [Act.1245, A] [Act.1255, E] B D Act.1244 -> Hello
  • 35. 3.2. DISTRIBUTED DIRECTORY • Maps actor id <-> location • One-hop distributed hash table • Each server holds a partition of the directory • Actor partitioning: consistent hashing • (De)Activations update records in the table • Directory enforces single-activations • Avoid extra hop: large (millions) cache of recent activations A C 1. Act.1244 ? [Act.1234, A] [Act.1244, C] [Act.1254, D]2. C 3. Hello [Act.1235, F] [Act.1245, A] [Act.1255, E] B D Act.1244 -> Hello
  • 36. 3.3. STRONG ISOLATION • Actors don’t share state and communication is always message based • Method arguments & return values are deep copied • Guarantees immutability
  • 37. 3.8. RELIABILITY • Orleans manages everything except persistence • Failure detection: heartbeats • Membership view is eventual consistent (30-60s on production servers) • A “dead” actor is activated on a different server • Actor lifespan not linked to server lifespan • No checkpoint strategy (depends on application) • Misrouted messages are sent to the right destination and sender is notified
  • 38. 3.9. EVENTUAL CONSISTENCY • No failure = single activation guarantee • Failure = single activation eventual guarantee • Two activations in two different partitions • One is eventually dropped • Availability over consistency
  • 39. 3.10. MESSAGING GUARANTEES • At-least-once message guarantee • Exactly-once can be implemented at application level (request id) • No FIFO guarantees (sender: A, B, C; receiver: B, A, C)
  • 40. 4.1 HALO 4 PRESENCE SERVICE
  • 41. 4.2. HALO 4 STATISTICS SERVICE
  • 42. 5.1. SYNTHETIC MICRO BENCHMARKS
  • 43. 5.1. SYNTHETIC MICRO BENCHMARKS *test server had 8 cores
  • 44. 5.1. SYNTHETIC MICRO BENCHMARKS
  • 47. ORLEANS DRAWBACKS • Bulk operations • Large number of actors (billions) + no temporal locality • No cross-actor transactions
  • 48. 6.2. OTHER ACTOR FRAMEWORKS • Akka http://akka.io/ • Erlang https://www.erlang.org/ Not in the paper: • Orbit (Java/JVM) https://github.com/orbit/orbit