Modern applications and microservices with Actor Programming Model
State of the art = stateless Service Client NLB Client DB Service
Stateless with Cache and DB-partitioning Client Service Client DB CACHE Service DB
State Partitions Client NLB public void Do. It(partition. Key 1) { this. State 1++; } public void Do. It(partition. Key 2) { this. State 2++; }
Actor Programming Model The actor model is a mathematical model of concurrent computation.
About Actors framework basis
Actor Languages § § § § § ABCL Ambient. Talk[33] Axum[34] CAL Actor Language D E Elixir Erlang Fantom Humus[35] § Io § Ptolemy Project § Rebeca Modeling Language § Reia § Rust[citation needed] § SALSA[36] § Scala[37][38] § Scratch § TNSDL
Object Oriented vs. Actor Model
Definition STATE PERSISTENCE ASYNC ONLY Actor SINGLE THREAD EXECUTION
Actor definition Akka. Net public class My. Actor : Untyped. Actor { public Actor 2(string arg) { } protected override void On. Receive(object message) { } }
Actor definition Akka. Net public class Actor 2 : Receive. Actor { public Actor 2() { Receive<Start. Calc. Msg>(msg => { Sender. Tell(sum, Self); } }
Actor activation Akka. Net var system = Actor. System. Create("system") var actor 1 = system. Actor. Of(Props. Create(() => new Actor 1(new List<IActor. Ref>() { remote. Echo 1, remote. Echo 2 })), "startactor"); system. Actor. Selection("/user/startactor"). Tell (new Some. Msg() { Sum. From = 0, Sum. To = 100000 }). Result; var sum = system. Actor. Selection("/user/startactor"). Ask<double>(new Start. Calc. Msg() { Sum. From = 0, Sum. To = 100000 }). Result;