SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
Akka.net - Teil1 Christian Schaiter und Mathias Feitzinger
Actor Model … aber warum?
Copyright: http://globalnerdy.com
Moore’s
Law!
Alles paletti?
2
Actor Model … aber warum?
Copyright: http://mba.eckovation.com
3
Lösung:
Parallele Programmierung?
Actor Model … aber warum?
4
// Invariant of the class: A countdown stops with 0 and cannot become negative.
public class CountDown {
// Internal state of the class. Value must not be negative.
private int value;
public CountDown(int start) { value = start; }
public void Decrement() {
// We ensure that the countdown never becomes negative
if (value > 0) {
Thread.Sleep(100); // Some longer running (blocking) operation
value -= 1;
}
}
public int Value => value;
}
Actor Model … aber warum?
5
Deadlock
Livelock
Race Conditions
Starvation
Ohne Synchronisierung
Lost Updates
Memory visibility
Mit Synchronisierung
Actor Model … aber warum?
6
Paralleles
Programmieren
ist schwer!
Status Quo
Copyright: https://www.worthofweb.com
7
Lösung:
Synchronisation über
Datenbank?
Status Quo
8
Copyright: Petabridge
Es geht auch anders!
9
Es geht auch anders!
10
Reactive Manifesto
Es geht auch anders!
11
Ver
tei
lung
Das Actor Model
Schauspieler
12
● 1973 von Carl Hewitt entwickelt
● Erlang, Scala
● Grundlegendes Software Modell
○ ähnlich zu Objektorientierung
ALLES IST EIN ACTOR
Actor System
13
Copyright: Brian Storti
● Akka > Opensource für Java
● Akka.net > Akka portiert auf .Net
● NuGet
● http://getakka.net/
Actors für .Net > Akka.net
14
Copyright: Brian Storti
Actors für .Net > Akka.net
15
Konzept
● Asynchrones Senden von Nachrichten
● Nachrichten sind immutable
● Immer nur eine Nachricht in
Verarbeitung
Actors haben
● Eine Mailbox
● Einen Parent
● Behaviour
● State
● Kinder
Copyright: github.com/EdwinW
Beispiel 1
Calculator
16
Actors für .Net > Akka.net
17
Konzept
● Asynchrones Senden von Nachrichten
● Nachrichten sind immutable
● Immer nur eine Nachricht in
Verarbeitung
Actors haben
● Eine Mailbox
● Einen Parent
● Behaviour
● State
● Kinder
Copyright: github.com/EdwinW
● Actors sind Rudeltiere (ᵔᴥᵔ)
○ Actor alleine kann nicht viel ausrichten
○ Geben größere Arbeiten an andere Actors ab
● Mehrere Millionen Actors in einem echten
System
● 1 Actor ≙ 300 bytes
Actors come in systems
18
Location Transparency
19
● Keine direkter Zugriff auf Actor
● Location Transparency:
○ LocalActorRef
○ RemoteActorRef
● State und Behaviour eines Actors somit immer Private
● ActorSelection -> Zugriff auf einen beliebigen Actor im System
Jeder Actor hat eine eindeutige Adresse
akka://mySystem@localhost:4091/user/
IoTSupervisior/DeviceManager/
DeviceGroup1/Device2
Actor Path
20
Beispiel 2
CalculatorSystem
21
Beispiel Calculator System
22
● Befehle von der Console lesen und parsen
○ Addition => “4+3”
○ Question of Life => “Question”
● Berechnung durchführen
● Resultate ausliefern
Anforderungen an die Architektur:
● Das ganze am besten multithreaded
○ daher mehrere Berechnungen parallel
● Ohne Codeänderungen verteilbar!!!
○ Soll in verschiedensten Rechenzentren verteilt sein
○ (Akka Teil 2 -> 7. Dezember 2017)
cliClient
calculation
Coordinator
cli
Reader
command
Parser
summation
Worker
ultimate
Question
Worker
CalculationSystem
AskUserForInputCommand
AskUserForInputCommand
ParseCliInputCommand
InputParsedEventAddCommand /
AnswerUltimateQuestionCommand
ResultCalculatedEvent
23
cliClient
calculation
Coordinator
cli
Reader
command
Parser
summation
Worker
ultimate
Question
Worker
CalculationSystem
24
Parallelität mit Router
25
● Group Router
○ Bestehende Actors als Routees
● Pool Router
○ Verwaltet Routees selbst
○ Dynamische Größe
● Routing Strategien
○ Round Robin
○ Broadcast
○ Random
○ Consistent Hashing
○ TailChopping
○ ScatterGatherFirstCompleted
○ Smallest Mailbox
Copyright: www.packtpub.com
cliClient
calculation
Coordinator
cli
Reader
command
Parser
summation
Worker
ultimate
Question
Worker
CalculationSystem
26
ultimate
Question
Worker
ultimate
Question
Worker
summation
Worker
summation
Worker
Router Router
Let it crash - Actor Supervision
27
Copyright: Petabridge
mathias.feitzinger@world-direct.at
christian.schaiter@world-direct.at
28
Ausblick Akka Teil 2:
● Persistenz
● Remote
● Clustering
7. Dezember 2017

Weitere ähnliche Inhalte

Ähnlich wie Akka.NET Teil 1 - Verteilte Architektur von Beginn an

Puppet - Entwicklungsworkflow und Basismodule
Puppet - Entwicklungsworkflow und BasismodulePuppet - Entwicklungsworkflow und Basismodule
Puppet - Entwicklungsworkflow und Basismoduleinovex GmbH
 
Best Practices für TDD in JavaScript
Best Practices für TDD in JavaScriptBest Practices für TDD in JavaScript
Best Practices für TDD in JavaScriptSebastian Springer
 
OSMC 2017 | Automatisiertes und verteiltes Monitoring in einer CI Umgebung by...
OSMC 2017 | Automatisiertes und verteiltes Monitoring in einer CI Umgebung by...OSMC 2017 | Automatisiertes und verteiltes Monitoring in einer CI Umgebung by...
OSMC 2017 | Automatisiertes und verteiltes Monitoring in einer CI Umgebung by...NETWAYS
 
Nebenläufigkeit mit Kotlins Koroutinen
Nebenläufigkeit mit Kotlins KoroutinenNebenläufigkeit mit Kotlins Koroutinen
Nebenläufigkeit mit Kotlins KoroutinenJörn Dinkla
 
I thought you were my friend!
I thought you were my friend!I thought you were my friend!
I thought you were my friend!Mario Heiderich
 
Lightweight AOP with CDI and JPA
Lightweight AOP with CDI and JPALightweight AOP with CDI and JPA
Lightweight AOP with CDI and JPAmh0708
 
Go - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare SystemeGo - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare SystemeFrank Müller
 
Docker Security - Architektur und Sicherheitsfunktionen von Containervirtuali...
Docker Security - Architektur und Sicherheitsfunktionen von Containervirtuali...Docker Security - Architektur und Sicherheitsfunktionen von Containervirtuali...
Docker Security - Architektur und Sicherheitsfunktionen von Containervirtuali...inovex GmbH
 
Puppet: Designing modules & repositories
Puppet: Designing modules & repositoriesPuppet: Designing modules & repositories
Puppet: Designing modules & repositoriesinovex GmbH
 
Mein paralleles Leben als Java-Entwickler
Mein paralleles Leben als Java-EntwicklerMein paralleles Leben als Java-Entwickler
Mein paralleles Leben als Java-Entwicklerjlink
 
Mobile Games mit Windows Azure
Mobile Games mit Windows AzureMobile Games mit Windows Azure
Mobile Games mit Windows AzureJürgen Gutsch
 
Funktionale Reaktive Programmierung mit Sodium
Funktionale Reaktive Programmierung mit SodiumFunktionale Reaktive Programmierung mit Sodium
Funktionale Reaktive Programmierung mit SodiumTorsten Fink
 
Microservices and Container Management with Mesosphere DC/OS
Microservices and Container Management with Mesosphere DC/OSMicroservices and Container Management with Mesosphere DC/OS
Microservices and Container Management with Mesosphere DC/OSRalf Ernst
 
Production-ready Infrastruktur in 3 Wochen
Production-ready Infrastruktur in 3 WochenProduction-ready Infrastruktur in 3 Wochen
Production-ready Infrastruktur in 3 WochenAndré Goliath
 
2009 03 17 Spring101
2009 03 17 Spring1012009 03 17 Spring101
2009 03 17 Spring101gueste4be40
 
Wieso Informatiker bei der Informationssicherheit scheitern
Wieso Informatiker bei der Informationssicherheit scheiternWieso Informatiker bei der Informationssicherheit scheitern
Wieso Informatiker bei der Informationssicherheit scheiternDigicomp Academy AG
 

Ähnlich wie Akka.NET Teil 1 - Verteilte Architektur von Beginn an (20)

Puppet - Entwicklungsworkflow und Basismodule
Puppet - Entwicklungsworkflow und BasismodulePuppet - Entwicklungsworkflow und Basismodule
Puppet - Entwicklungsworkflow und Basismodule
 
Best Practices für TDD in JavaScript
Best Practices für TDD in JavaScriptBest Practices für TDD in JavaScript
Best Practices für TDD in JavaScript
 
Node.js Security
Node.js SecurityNode.js Security
Node.js Security
 
OSMC 2017 | Automatisiertes und verteiltes Monitoring in einer CI Umgebung by...
OSMC 2017 | Automatisiertes und verteiltes Monitoring in einer CI Umgebung by...OSMC 2017 | Automatisiertes und verteiltes Monitoring in einer CI Umgebung by...
OSMC 2017 | Automatisiertes und verteiltes Monitoring in einer CI Umgebung by...
 
Nebenläufigkeit mit Kotlins Koroutinen
Nebenläufigkeit mit Kotlins KoroutinenNebenläufigkeit mit Kotlins Koroutinen
Nebenläufigkeit mit Kotlins Koroutinen
 
I thought you were my friend!
I thought you were my friend!I thought you were my friend!
I thought you were my friend!
 
Lightweight AOP with CDI and JPA
Lightweight AOP with CDI and JPALightweight AOP with CDI and JPA
Lightweight AOP with CDI and JPA
 
Go - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare SystemeGo - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare Systeme
 
Docker Security - Architektur und Sicherheitsfunktionen von Containervirtuali...
Docker Security - Architektur und Sicherheitsfunktionen von Containervirtuali...Docker Security - Architektur und Sicherheitsfunktionen von Containervirtuali...
Docker Security - Architektur und Sicherheitsfunktionen von Containervirtuali...
 
Puppet: Designing modules & repositories
Puppet: Designing modules & repositoriesPuppet: Designing modules & repositories
Puppet: Designing modules & repositories
 
Mein paralleles Leben als Java-Entwickler
Mein paralleles Leben als Java-EntwicklerMein paralleles Leben als Java-Entwickler
Mein paralleles Leben als Java-Entwickler
 
Ruby on Rails SS09 05
Ruby on Rails SS09 05Ruby on Rails SS09 05
Ruby on Rails SS09 05
 
Warum wir Automatisierung cool finden
Warum wir Automatisierung cool findenWarum wir Automatisierung cool finden
Warum wir Automatisierung cool finden
 
Mobile Games mit Windows Azure
Mobile Games mit Windows AzureMobile Games mit Windows Azure
Mobile Games mit Windows Azure
 
Enterprise JS
Enterprise JS Enterprise JS
Enterprise JS
 
Funktionale Reaktive Programmierung mit Sodium
Funktionale Reaktive Programmierung mit SodiumFunktionale Reaktive Programmierung mit Sodium
Funktionale Reaktive Programmierung mit Sodium
 
Microservices and Container Management with Mesosphere DC/OS
Microservices and Container Management with Mesosphere DC/OSMicroservices and Container Management with Mesosphere DC/OS
Microservices and Container Management with Mesosphere DC/OS
 
Production-ready Infrastruktur in 3 Wochen
Production-ready Infrastruktur in 3 WochenProduction-ready Infrastruktur in 3 Wochen
Production-ready Infrastruktur in 3 Wochen
 
2009 03 17 Spring101
2009 03 17 Spring1012009 03 17 Spring101
2009 03 17 Spring101
 
Wieso Informatiker bei der Informationssicherheit scheitern
Wieso Informatiker bei der Informationssicherheit scheiternWieso Informatiker bei der Informationssicherheit scheitern
Wieso Informatiker bei der Informationssicherheit scheitern
 

Akka.NET Teil 1 - Verteilte Architektur von Beginn an