SlideShare ist ein Scribd-Unternehmen logo
1 von 73
Downloaden Sie, um offline zu lesen
Resilient Applications with Akka
Persistence
Patrik Nordwall

@patriknw
Konrad Malawski

@ktosopl
Björn Antonsson

@bantonsson
Reactive Applications
Akka	
  Persistence	
  ScalaDays	
  2014
Resilient
• Embrace Failure
• Failure is a normal part of the application lifecycle
• Self Heal
• Failure is detected, isolated, and managed
Akka	
  Persistence	
  ScalaDays	
  2014
The Naïve Way
• Write State to Database
• Transactions Everywhere
• Problem Solved?
• Not Scalable, Responsive, Event-Driven!
Akka	
  Persistence	
  ScalaDays	
  2014
Command and Event Sourcing
Command and Event Sourcing
• State is the sum of Events
• Events are persisted to Store
• Append only
• Scales well
Akka	
  Persistence	
  ScalaDays	
  2014
Command v.s. Event
• Command
• What someone wants me to do
• Can be rejected
• Event
• Something that has already happened
• An immutable fact
Akka	
  Persistence	
  ScalaDays	
  2014
Commands can Generate Events
• If I accept a Command and change State
• Persist Event to Store
• If I crash
• Replay Events to recover State
Akka	
  Persistence	
  ScalaDays	
  2014
Persist All Commands?
• If I crash on a Command
• I will likely crash during recovery
• Like the Army
• Don't question orders
• Repeat until success
Akka	
  Persistence	
  ScalaDays	
  2014
Only Persist Events
• Only accepted Commands generate Events
• No surprises during recovery
• Like a dieting method
• You are what you eat
Akka	
  Persistence	
  ScalaDays	
  2014
Achievement Unlocked?
• Resilient
• State is recoverable
• Scalable
• Append only writes
• Something Missing?
• Queries
Akka	
  Persistence	
  ScalaDays	
  2014
CQRS
Command Query Responsibility Segregation
CQRS
• Separate Models
• Command Model
• Optimized for command processing
• Query Model
• Optimized data presentation
Akka	
  Persistence	
  ScalaDays	
  2014
Query Model from Events
• Source the Events
• Pick what fits
• In Memory
• SQL Database
• Graph Database
• Key Value Store
Akka	
  Persistence	
  ScalaDays	
  2014
Akka	
  Persistence	
  ScalaDays	
  2014
Client
Service
Query	
  
Model
Command
Store
Query
Store
Command	
  
Model
PersistentActor
Akka	
  Persistence	
  ScalaDays	
  2014
PersistentActor
Processor & Eventsourced Processor
Replaces:
in Akka 2.3.4+
super quick domain modelling!
sealed trait Command!
case class GiveMe(coins: Int) extends Command!
case class TakeMy(coins: Int) extends Command
Commands - what others “tell” us; not persisted
case class Wallet(coins: Int) {!
def updated(diff: Int) = State(coins + diff)!
}
State - reflection of a series of events
sealed trait Event!
case class BalanceChangedBy(coins: Int) extends Event!
Events - reflect effects, past tense; persisted
var state = S0
!
def processorId = “a”
!
PersistentActor
Command
!
!
Journal
PersistentActor
var state = S0
!
def processorId = “a”
!
!
!
Journal
Generate
Events
PersistentActor
var state = S0
!
def processorId = “a”
!
!
!
Journal
Generate
Events
E1
PersistentActor
ACK
“persisted”
!
!
Journal
E1
var state = S0
!
def processorId = “a”
!
PersistentActor
“Apply”
event
!
!
Journal
E1
var state = S1
!
def processorId = “a”
!
E1
PersistentActor
!
!
Journal
E1
var state = S1
!
def processorId = “a”
!
E1
Okey!
PersistentActor
!
!
Journal
E1
var state = S1
!
def processorId = “a”
!
E1
Okey!
PersistentActor
!
!
Journal
E1
var state = S1
!
def processorId = “a”
!
E1
Ok, he got my $.
PersistentActor
class BitCoinWallet extends PersistentActor {!
!
var state = Wallet(coins = 0)!
!
def updateState(e: Event): State = {!
case BalanceChangedBy(coins) => state.updatedWith(coins)!
}!
!
// API:!
!
def receiveCommand = ??? // TODO!
!
def receiveRecover = ??? // TODO!
!
}!
persist(e) { e => }
PersistentActor
def receiveCommand = {!
!
case TakeMy(coins) =>!
persist(BalanceChangedBy(coins)) { changed =>!
state = updateState(changed) !
}!
!
!
!
!
!
!
}
async callback
PersistentActor: persist(){}
def receiveCommand = {!
!
!
!
!
!
!
case GiveMe(coins) if coins <= state.coins =>!
persist(BalanceChangedBy(-coins)) { changed =>!
state = updateState(changed) !
sender() ! TakeMy(coins)!
}!
}
async callback
Safe to mutate
the Actor’s state
PersistentActor
def receiveCommand = {!
!
!
!
!
!
!
case GiveMe(coins) if coins <= state.coins =>!
persist(BalanceChangedBy(-coins)) { changed =>!
state = updateState(changed) !
sender() ! TakeMy(coins)!
}!
}
Safe to access
sender here
persist(){} - Ordering guarantees
!
!
Journal
E1
var state = S0
!
def processorId = “a”
!
C1
C2
C3
!
!
Journal
E1
var state = S0
!
def processorId = “a”
!
C1
C2
C3
Commands get “stashed” until
processing C1’s events are acted upon.
persist(){} - Ordering guarantees
!
!
Journal
var state = S0
!
def processorId = “a”
!
C1
C2
C3 E1
E2
E2E1
events get
applied in-order
persist(){} - Ordering guarantees
C2
!
!
Journal
var state = S0
!
def processorId = “a”
!
C3 E1 E2
E2E1
and the cycle
repeats
persist(){} - Ordering guarantees
persistAsync(e) { e => }
persistAsync(e) { e => }
+
defer(e) { e => }
def receiveCommand = {!
!
!
!
case Mark(id) =>!
sender() ! InitMarking!
persistAsync(Marker) { m =>!
// update state...!
}!
!
!
!
!
}
persistAsync
PersistentActor: persistAsync(){}
will NOT force stashing of commands
PersistentActor: persistAsync(){}
def receiveCommand = {!
!
!
!
case Mark(id) =>!
sender() ! InitMarking!
persistAsync(Marker) { m =>!
// update state...!
}!
!
defer(Marked(id)) { marked =>!
sender() ! marked!
}!
}
execute once all
persistAsync handlers done
NOT persisted
persistAsync(){} - Ordering guarantees
!
!
Journal
var state = S0
!
def processorId = “a”
!
C1
C2
C3
persistAsync(){} - Ordering guarantees
!
!
Journal
var state = S0
!
def processorId = “a”
!C2
C3
persistAsync(){} - Ordering guarantees
!
!
Journal
var state = S0
!
def processorId = “a”
!
C3
persistAsync(){} - Ordering guarantees
!
!
Journal
var state = S0
!
def processorId = “a”
!
C3
E1
E2
persistAsync(){} - Ordering guarantees
var state = S0
!
def processorId = “a”
!
C3
E1
Akka	
  Persistence	
  ScalaDays
!
!
Journal
E1
E2
persistAsync(){} - Ordering guarantees
E1
var state = S1
!
def processorId = “a”
!
E2
E1
E2
!
!
Journal
Akka	
  Persistence	
  ScalaDays
E2
E3E1
persistAsync(){} - Ordering guarantees
E1
var state = S2
!
def processorId = “a”
!
E2
E1 E2
deferred handlers triggered
M1
M2
!
!
Journal
Akka	
  Persistence	
  ScalaDays
E2
E3E1
Recovery
Akka	
  Persistence	
  ScalaDays
Eventsourced, recovery
/** MUST NOT SIDE-EFFECT! */!
def receiveRecover = {!
case replayedEvent: Event => !
state = updateState(replayedEvent)!
}
re-using updateState, as seen in
receiveCommand
Akka	
  Persistence	
  ScalaDays
Views
Akka	
  Persistence	
  ScalaDays
Journal	

(DB)	

!
!
!
Views
!
Processor
!
def processorId = “a”
!
polling
Akka	
  Persistence	
  ScalaDays
!
View
!
def processorId = “a”
!
!
!
Journal	

(DB)	

!
!
!
Views
!
Processor
!
def processorId = “a”
!
polling
!
View
!
def processorId = “a”
!
!
!
polling
different ActorPath,
same processorId
Akka	
  Persistence	
  ScalaDays
!
View
!
def processorId = “a”
!
!
!
View
class DoublingCounterProcessor extends View {!
var state = 0!


override val processorId = "counter"!
!
def receive = {!
case Persistent(payload, seqNr) =>!
// “state += 2 * payload” !
!
}!
}
subject to
change!
Akka	
  Persistence	
  ScalaDays
Views,
as Reactive Streams
Akka	
  Persistence	
  ScalaDays
View, as ReactiveStream
// Imports ...!
!
import org.reactivestreams.api.Producer!
!
import akka.stream._!
import akka.stream.scaladsl.Flow!
!
import akka.persistence._!
import akka.persistence.stream._!


val materializer = FlowMaterializer(MaterializerSettings())!
pull request 	

by krasserm
early preview
Akka	
  Persistence	
  ScalaDays
View, as ReactiveStream
// 1 producer and 2 consumers:!
val p1: Producer[Persistent] = PersistentFlow.!
fromProcessor(“processor-1").!
toProducer(materializer)!
!
Flow(p1).!
foreach(p => println(s"consumer-1: ${p.payload}”)).!
consume(materializer)!
!
Flow(p1).!
foreach(p => println(s"consumer-2: ${p.payload}”)).!
consume(materializer)
pull request 	

by krasserm
early preview
Akka	
  Persistence	
  ScalaDays
View, as ReactiveStream
// 2 producers (merged) and 1 consumer:!
val p2: Producer[Persistent] = PersistentFlow.!
fromProcessor(“processor-2").!
toProducer(materializer)!


val p3: Producer[Persistent] = PersistentFlow.!
fromProcessor(“processor-3").!
toProducer(materializer)!
!
Flow(p2).merge(p3). // triggers on “either”!
foreach { p => println(s"consumer-3: ${p.payload}") }.!
consume(materializer)!
pull request 	

by krasserm
early preview
Akka	
  Persistence	
  ScalaDays
Akka	
  Persistence	
  ScalaDays	
  2014
Usage in a Cluster
• distributed journal (http://akka.io/community/)
• Cassandra
• DynamoDB
• HBase
• MongoDB
• shared LevelDB journal for testing
• single writer
• cluster singleton
• cluster sharding
Akka	
  Persistence	
  ScalaDays	
  2014
Cluster Singleton
A
B
C D
Akka	
  Persistence	
  ScalaDays	
  2014
Cluster Singleton
A
B
C
D
role: backend-1 role: backend-1
role: backend-2 role: backend-2
Akka	
  Persistence	
  ScalaDays	
  2014
Cluster Sharding
A B
C D
Akka	
  Persistence	
  ScalaDays	
  2014
Cluster Sharding
sender
id:17
region

node-­‐1
coordinator
region

node-­‐2
region

node-­‐3
GetShardHome:17
id:17 ShardHome:17	
  -­‐>	
  node2
17	
  -­‐>	
  node2
Akka	
  Persistence	
  ScalaDays	
  2014
Cluster Sharding
sender region

node-­‐1
coordinator
region

node-­‐2
region

node-­‐3
id:17
id:17
GetShardHome:17
ShardHome:17	
  -­‐>	
  node2
id:17
17	
  -­‐>	
  node2
17	
  -­‐>	
  node2
Akka	
  Persistence	
  ScalaDays	
  2014
Cluster Sharding
17
sender region

node-­‐1
coordinator
region

node-­‐2
region

node-­‐3
id:17
id:17
17	
  -­‐>	
  node2
17	
  -­‐>	
  node2
17	
  -­‐>	
  node2
Akka	
  Persistence	
  ScalaDays	
  2014
Cluster Sharding
17
sender region

node-­‐1
coordinator
region

node-­‐2
region

node-­‐3
17	
  -­‐>	
  node2
17	
  -­‐>	
  node2
17	
  -­‐>	
  node2
id:17
Akka	
  Persistence	
  ScalaDays	
  2014
Cluster Sharding
17
sender region

node-­‐1
coordinator
region

node-­‐2
region

node-­‐3
17	
  -­‐>	
  node2
17	
  -­‐>	
  node2
17	
  -­‐>	
  node2
id:17
Cluster Sharding
val idExtractor: ShardRegion.IdExtractor = {
case cmd: Command => (cmd.postId, cmd)
}
!
val shardResolver: ShardRegion.ShardResolver = msg => msg match {
case cmd: Command => (math.abs(cmd.postId.hashCode) % 100).toString
}
ClusterSharding(system).start(
typeName = BlogPost.shardName,
entryProps = Some(BlogPost.props()),
idExtractor = BlogPost.idExtractor,
shardResolver = BlogPost.shardResolver)
val blogPostRegion: ActorRef = 

ClusterSharding(context.system).shardRegion(BlogPost.shardName)
!
val postId = UUID.randomUUID().toString
blogPostRegion ! BlogPost.AddPost(postId, author, title)
Akka	
  Persistence	
  ScalaDays	
  2014
Lost messages
sender destination
$
Akka	
  Persistence	
  ScalaDays	
  2014
At-least-once delivery - duplicates
sender destination
$
ok
$
$
$
ok
Re-­‐send
Akka	
  Persistence	
  ScalaDays	
  2014
M2
At-least-once delivery - unordered
sender destination
M1
ok	
  1 ok	
  2
M2
ok	
  3
M3
M1M3
M2
Re-­‐send
Akka	
  Persistence	
  ScalaDays	
  2014
M2
At-least-once delivery - crash
sender destination
M1
ok	
  1 ok	
  2
M2
ok	
  3
M3
1. Sent	
  M1	
  
2. Sent	
  M2	
  
3. Sent	
  M3	
  
M3
5.	
  M2	
  Confirmed	
  
6.	
  M3	
  Confirmed
4.	
  M1	
  Confirmed
sender
M1M2
M3
PersistentActor with AtLeastOnceDelivery
case class Msg(deliveryId: Long, s: String)
case class Confirm(deliveryId: Long)
sealed trait Evt
case class MsgSent(s: String) extends Evt
case class MsgConfirmed(deliveryId: Long) extends Evt
class Sender(destination: ActorPath)
extends PersistentActor with AtLeastOnceDelivery {
!
def receiveCommand: Receive = {
case s: String => persist(MsgSent(s))(updateState)
case Confirm(deliveryId) => persist(MsgConfirmed(deliveryId))(updateState)
}
!
def receiveRecover: Receive = { case evt: Evt => updateState(evt) }
!
def updateState(evt: Evt): Unit = evt match {
case MsgSent(s) =>
deliver(destination, deliveryId => Msg(deliveryId, s))
!
case MsgConfirmed(deliveryId) => confirmDelivery(deliveryId)
}
}
Akka	
  Persistence	
  ScalaDays	
  2014
Next step
• Documentation
• http://doc.akka.io/docs/akka/2.3.3/scala/persistence.html
• http://doc.akka.io/docs/akka/2.3.3/java/persistence.html
• http://doc.akka.io/docs/akka/2.3.3/contrib/cluster-sharding.html
• Typesafe Activator
• https://typesafe.com/activator/template/akka-sample-persistence-scala
• https://typesafe.com/activator/template/akka-sample-persistence-java
• http://typesafe.com/activator/template/akka-cluster-sharding-scala
• Mailing list
• http://groups.google.com/group/akka-user
• Migration guide from Eventsourced
• http://doc.akka.io/docs/akka/2.3.3/project/migration-guide-eventsourced-2.3.x.html
©Typesafe 2014 – All Rights Reserved

Weitere ähnliche Inhalte

Was ist angesagt?

HBase RowKey design for Akka Persistence
HBase RowKey design for Akka PersistenceHBase RowKey design for Akka Persistence
HBase RowKey design for Akka PersistenceKonrad Malawski
 
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Lightbend
 
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...Lightbend
 
A Tale of Two APIs: Using Spark Streaming In Production
A Tale of Two APIs: Using Spark Streaming In ProductionA Tale of Two APIs: Using Spark Streaming In Production
A Tale of Two APIs: Using Spark Streaming In ProductionLightbend
 
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka StreamsFresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka StreamsKonrad Malawski
 
Streaming all the things with akka streams
Streaming all the things with akka streams   Streaming all the things with akka streams
Streaming all the things with akka streams Johan Andrén
 
Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Konrad Malawski
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on AndroidTomáš Kypta
 
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...Lightbend
 
Laying down the smack on your data pipelines
Laying down the smack on your data pipelinesLaying down the smack on your data pipelines
Laying down the smack on your data pipelinesPatrick McFadin
 
Reactive stream processing using Akka streams
Reactive stream processing using Akka streams Reactive stream processing using Akka streams
Reactive stream processing using Akka streams Johan Andrén
 
Reactive streams processing using Akka Streams
Reactive streams processing using Akka StreamsReactive streams processing using Akka Streams
Reactive streams processing using Akka StreamsJohan Andrén
 
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 productionjglobal
 
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous ArchitecturesUnderstanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous ArchitecturesLightbend
 
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 ClusterKonstantin Tsykulenko
 
Asynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka StreamsAsynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka StreamsJohan Andrén
 
Building production spark streaming applications
Building production spark streaming applicationsBuilding production spark streaming applications
Building production spark streaming applicationsJoey Echeverria
 
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)Konrad Malawski
 
Akka 2.4 plus new commercial features in Typesafe Reactive Platform
Akka 2.4 plus new commercial features in Typesafe Reactive PlatformAkka 2.4 plus new commercial features in Typesafe Reactive Platform
Akka 2.4 plus new commercial features in Typesafe Reactive PlatformLegacy Typesafe (now Lightbend)
 
Asynchronous Orchestration DSL on squbs
Asynchronous Orchestration DSL on squbsAsynchronous Orchestration DSL on squbs
Asynchronous Orchestration DSL on squbsAnil Gursel
 

Was ist angesagt? (20)

HBase RowKey design for Akka Persistence
HBase RowKey design for Akka PersistenceHBase RowKey design for Akka Persistence
HBase RowKey design for Akka Persistence
 
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
 
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
 
A Tale of Two APIs: Using Spark Streaming In Production
A Tale of Two APIs: Using Spark Streaming In ProductionA Tale of Two APIs: Using Spark Streaming In Production
A Tale of Two APIs: Using Spark Streaming In Production
 
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka StreamsFresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
 
Streaming all the things with akka streams
Streaming all the things with akka streams   Streaming all the things with akka streams
Streaming all the things with akka streams
 
Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
 
Laying down the smack on your data pipelines
Laying down the smack on your data pipelinesLaying down the smack on your data pipelines
Laying down the smack on your data pipelines
 
Reactive stream processing using Akka streams
Reactive stream processing using Akka streams Reactive stream processing using Akka streams
Reactive stream processing using Akka streams
 
Reactive streams processing using Akka Streams
Reactive streams processing using Akka StreamsReactive streams processing using Akka Streams
Reactive streams processing using Akka Streams
 
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
 
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous ArchitecturesUnderstanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
 
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
 
Asynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka StreamsAsynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka Streams
 
Building production spark streaming applications
Building production spark streaming applicationsBuilding production spark streaming applications
Building production spark streaming applications
 
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
 
Akka 2.4 plus new commercial features in Typesafe Reactive Platform
Akka 2.4 plus new commercial features in Typesafe Reactive PlatformAkka 2.4 plus new commercial features in Typesafe Reactive Platform
Akka 2.4 plus new commercial features in Typesafe Reactive Platform
 
Asynchronous Orchestration DSL on squbs
Asynchronous Orchestration DSL on squbsAsynchronous Orchestration DSL on squbs
Asynchronous Orchestration DSL on squbs
 

Andere mochten auch

Apache Flink - Akka for the Win!
Apache Flink - Akka for the Win!Apache Flink - Akka for the Win!
Apache Flink - Akka for the Win!Fabian Hueske
 
xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, TachyonxPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, TachyonClaudiu Barbura
 
PSUG #52 Dataflow and simplified reactive programming with Akka-streams
PSUG #52 Dataflow and simplified reactive programming with Akka-streamsPSUG #52 Dataflow and simplified reactive programming with Akka-streams
PSUG #52 Dataflow and simplified reactive programming with Akka-streamsStephane Manciot
 
A Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingA Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingAhmed Soliman
 
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Izzet Mustafaiev
 
Tachyon and Apache Spark
Tachyon and Apache SparkTachyon and Apache Spark
Tachyon and Apache Sparkrhatr
 
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsAkka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsNLJUG
 
Reactive streams
Reactive streamsReactive streams
Reactive streamscodepitbull
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeRoland Kuhn
 
Reactive Streams and RabbitMQ
Reactive Streams and RabbitMQReactive Streams and RabbitMQ
Reactive Streams and RabbitMQmkiedys
 
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)Claudiu Barbura
 
Micro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factorsMicro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factorsDejan Glozic
 
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM DeploymentJoe Kutner
 

Andere mochten auch (13)

Apache Flink - Akka for the Win!
Apache Flink - Akka for the Win!Apache Flink - Akka for the Win!
Apache Flink - Akka for the Win!
 
xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, TachyonxPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, Tachyon
 
PSUG #52 Dataflow and simplified reactive programming with Akka-streams
PSUG #52 Dataflow and simplified reactive programming with Akka-streamsPSUG #52 Dataflow and simplified reactive programming with Akka-streams
PSUG #52 Dataflow and simplified reactive programming with Akka-streams
 
A Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingA Journey to Reactive Function Programming
A Journey to Reactive Function Programming
 
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?
 
Tachyon and Apache Spark
Tachyon and Apache SparkTachyon and Apache Spark
Tachyon and Apache Spark
 
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsAkka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based Applications
 
Reactive streams
Reactive streamsReactive streams
Reactive streams
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in Practice
 
Reactive Streams and RabbitMQ
Reactive Streams and RabbitMQReactive Streams and RabbitMQ
Reactive Streams and RabbitMQ
 
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
 
Micro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factorsMicro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factors
 
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment
 

Ähnlich wie Resilient Applications with Akka Persistence - Scaladays 2014

Event-sourced architectures with Akka - Sander Mak
Event-sourced architectures with Akka - Sander MakEvent-sourced architectures with Akka - Sander Mak
Event-sourced architectures with Akka - Sander MakNLJUG
 
Embrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with RippleEmbrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with RippleSean Cribbs
 
Using Akka Persistence to build a configuration datastore
Using Akka Persistence to build a configuration datastoreUsing Akka Persistence to build a configuration datastore
Using Akka Persistence to build a configuration datastoreAnargyros Kiourkos
 
Scala in increasingly demanding environments - DATABIZ
Scala in increasingly demanding environments - DATABIZScala in increasingly demanding environments - DATABIZ
Scala in increasingly demanding environments - DATABIZDATABIZit
 
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...Scala Italy
 
Avoiding the Pit of Despair - Event Sourcing with Akka and Cassandra
Avoiding the Pit of Despair - Event Sourcing with Akka and CassandraAvoiding the Pit of Despair - Event Sourcing with Akka and Cassandra
Avoiding the Pit of Despair - Event Sourcing with Akka and CassandraLuke Tillman
 
Interactive Query in Kafka Streams: The Next Generation with Vasiliki Papavas...
Interactive Query in Kafka Streams: The Next Generation with Vasiliki Papavas...Interactive Query in Kafka Streams: The Next Generation with Vasiliki Papavas...
Interactive Query in Kafka Streams: The Next Generation with Vasiliki Papavas...HostedbyConfluent
 
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 PersistenceKonrad Dusza
 
Spark Summit 2014: Spark Job Server Talk
Spark Summit 2014:  Spark Job Server TalkSpark Summit 2014:  Spark Job Server Talk
Spark Summit 2014: Spark Job Server TalkEvan Chan
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceSachin Aggarwal
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaWO Community
 
Building a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and SparkBuilding a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and SparkEvan Chan
 
Akka persistence webinar
Akka persistence webinarAkka persistence webinar
Akka persistence webinarpatriknw
 
Implementing Server Side Data Synchronization for Mobile Apps
Implementing Server Side Data Synchronization for Mobile AppsImplementing Server Side Data Synchronization for Mobile Apps
Implementing Server Side Data Synchronization for Mobile AppsMichele Orselli
 
BPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep DiveBPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep DiveAlfresco Software
 
Event Sourcing - what could go wrong - Jfokus 2022
Event Sourcing - what could go wrong - Jfokus 2022Event Sourcing - what could go wrong - Jfokus 2022
Event Sourcing - what could go wrong - Jfokus 2022Andrzej Ludwikowski
 
Genji: Framework for building resilient near-realtime data pipelines
Genji: Framework for building resilient near-realtime data pipelinesGenji: Framework for building resilient near-realtime data pipelines
Genji: Framework for building resilient near-realtime data pipelinesSwami Sundaramurthy
 
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...DataStax Academy
 

Ähnlich wie Resilient Applications with Akka Persistence - Scaladays 2014 (20)

Event-sourced architectures with Akka - Sander Mak
Event-sourced architectures with Akka - Sander MakEvent-sourced architectures with Akka - Sander Mak
Event-sourced architectures with Akka - Sander Mak
 
Event-sourced architectures with Akka
Event-sourced architectures with AkkaEvent-sourced architectures with Akka
Event-sourced architectures with Akka
 
Embrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with RippleEmbrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with Ripple
 
Intro to ReactJS
Intro to ReactJSIntro to ReactJS
Intro to ReactJS
 
Using Akka Persistence to build a configuration datastore
Using Akka Persistence to build a configuration datastoreUsing Akka Persistence to build a configuration datastore
Using Akka Persistence to build a configuration datastore
 
Scala in increasingly demanding environments - DATABIZ
Scala in increasingly demanding environments - DATABIZScala in increasingly demanding environments - DATABIZ
Scala in increasingly demanding environments - DATABIZ
 
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
 
Avoiding the Pit of Despair - Event Sourcing with Akka and Cassandra
Avoiding the Pit of Despair - Event Sourcing with Akka and CassandraAvoiding the Pit of Despair - Event Sourcing with Akka and Cassandra
Avoiding the Pit of Despair - Event Sourcing with Akka and Cassandra
 
Interactive Query in Kafka Streams: The Next Generation with Vasiliki Papavas...
Interactive Query in Kafka Streams: The Next Generation with Vasiliki Papavas...Interactive Query in Kafka Streams: The Next Generation with Vasiliki Papavas...
Interactive Query in Kafka Streams: The Next Generation with Vasiliki Papavas...
 
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
 
Spark Summit 2014: Spark Job Server Talk
Spark Summit 2014:  Spark Job Server TalkSpark Summit 2014:  Spark Job Server Talk
Spark Summit 2014: Spark Job Server Talk
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault Tolerance
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
 
Building a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and SparkBuilding a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and Spark
 
Akka persistence webinar
Akka persistence webinarAkka persistence webinar
Akka persistence webinar
 
Implementing Server Side Data Synchronization for Mobile Apps
Implementing Server Side Data Synchronization for Mobile AppsImplementing Server Side Data Synchronization for Mobile Apps
Implementing Server Side Data Synchronization for Mobile Apps
 
BPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep DiveBPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep Dive
 
Event Sourcing - what could go wrong - Jfokus 2022
Event Sourcing - what could go wrong - Jfokus 2022Event Sourcing - what could go wrong - Jfokus 2022
Event Sourcing - what could go wrong - Jfokus 2022
 
Genji: Framework for building resilient near-realtime data pipelines
Genji: Framework for building resilient near-realtime data pipelinesGenji: Framework for building resilient near-realtime data pipelines
Genji: Framework for building resilient near-realtime data pipelines
 
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
 

Kürzlich hochgeladen

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
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-...Steffen Staab
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 

Kürzlich hochgeladen (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
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-...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 

Resilient Applications with Akka Persistence - Scaladays 2014

  • 1. Resilient Applications with Akka Persistence Patrik Nordwall
 @patriknw Konrad Malawski
 @ktosopl Björn Antonsson
 @bantonsson
  • 3. Resilient • Embrace Failure • Failure is a normal part of the application lifecycle • Self Heal • Failure is detected, isolated, and managed Akka  Persistence  ScalaDays  2014
  • 4. The Naïve Way • Write State to Database • Transactions Everywhere • Problem Solved? • Not Scalable, Responsive, Event-Driven! Akka  Persistence  ScalaDays  2014
  • 5. Command and Event Sourcing
  • 6. Command and Event Sourcing • State is the sum of Events • Events are persisted to Store • Append only • Scales well Akka  Persistence  ScalaDays  2014
  • 7. Command v.s. Event • Command • What someone wants me to do • Can be rejected • Event • Something that has already happened • An immutable fact Akka  Persistence  ScalaDays  2014
  • 8. Commands can Generate Events • If I accept a Command and change State • Persist Event to Store • If I crash • Replay Events to recover State Akka  Persistence  ScalaDays  2014
  • 9. Persist All Commands? • If I crash on a Command • I will likely crash during recovery • Like the Army • Don't question orders • Repeat until success Akka  Persistence  ScalaDays  2014
  • 10. Only Persist Events • Only accepted Commands generate Events • No surprises during recovery • Like a dieting method • You are what you eat Akka  Persistence  ScalaDays  2014
  • 11. Achievement Unlocked? • Resilient • State is recoverable • Scalable • Append only writes • Something Missing? • Queries Akka  Persistence  ScalaDays  2014
  • 13. CQRS • Separate Models • Command Model • Optimized for command processing • Query Model • Optimized data presentation Akka  Persistence  ScalaDays  2014
  • 14. Query Model from Events • Source the Events • Pick what fits • In Memory • SQL Database • Graph Database • Key Value Store Akka  Persistence  ScalaDays  2014
  • 15. Akka  Persistence  ScalaDays  2014 Client Service Query   Model Command Store Query Store Command   Model
  • 17. PersistentActor Processor & Eventsourced Processor Replaces: in Akka 2.3.4+
  • 18. super quick domain modelling! sealed trait Command! case class GiveMe(coins: Int) extends Command! case class TakeMy(coins: Int) extends Command Commands - what others “tell” us; not persisted case class Wallet(coins: Int) {! def updated(diff: Int) = State(coins + diff)! } State - reflection of a series of events sealed trait Event! case class BalanceChangedBy(coins: Int) extends Event! Events - reflect effects, past tense; persisted
  • 19. var state = S0 ! def processorId = “a” ! PersistentActor Command ! ! Journal
  • 20. PersistentActor var state = S0 ! def processorId = “a” ! ! ! Journal Generate Events
  • 21. PersistentActor var state = S0 ! def processorId = “a” ! ! ! Journal Generate Events E1
  • 24. PersistentActor ! ! Journal E1 var state = S1 ! def processorId = “a” ! E1 Okey!
  • 25. PersistentActor ! ! Journal E1 var state = S1 ! def processorId = “a” ! E1 Okey!
  • 26. PersistentActor ! ! Journal E1 var state = S1 ! def processorId = “a” ! E1 Ok, he got my $.
  • 27. PersistentActor class BitCoinWallet extends PersistentActor {! ! var state = Wallet(coins = 0)! ! def updateState(e: Event): State = {! case BalanceChangedBy(coins) => state.updatedWith(coins)! }! ! // API:! ! def receiveCommand = ??? // TODO! ! def receiveRecover = ??? // TODO! ! }!
  • 29. PersistentActor def receiveCommand = {! ! case TakeMy(coins) =>! persist(BalanceChangedBy(coins)) { changed =>! state = updateState(changed) ! }! ! ! ! ! ! ! } async callback
  • 30. PersistentActor: persist(){} def receiveCommand = {! ! ! ! ! ! ! case GiveMe(coins) if coins <= state.coins =>! persist(BalanceChangedBy(-coins)) { changed =>! state = updateState(changed) ! sender() ! TakeMy(coins)! }! } async callback Safe to mutate the Actor’s state
  • 31. PersistentActor def receiveCommand = {! ! ! ! ! ! ! case GiveMe(coins) if coins <= state.coins =>! persist(BalanceChangedBy(-coins)) { changed =>! state = updateState(changed) ! sender() ! TakeMy(coins)! }! } Safe to access sender here
  • 32. persist(){} - Ordering guarantees ! ! Journal E1 var state = S0 ! def processorId = “a” ! C1 C2 C3
  • 33. ! ! Journal E1 var state = S0 ! def processorId = “a” ! C1 C2 C3 Commands get “stashed” until processing C1’s events are acted upon. persist(){} - Ordering guarantees
  • 34. ! ! Journal var state = S0 ! def processorId = “a” ! C1 C2 C3 E1 E2 E2E1 events get applied in-order persist(){} - Ordering guarantees
  • 35. C2 ! ! Journal var state = S0 ! def processorId = “a” ! C3 E1 E2 E2E1 and the cycle repeats persist(){} - Ordering guarantees
  • 37. persistAsync(e) { e => } + defer(e) { e => }
  • 38. def receiveCommand = {! ! ! ! case Mark(id) =>! sender() ! InitMarking! persistAsync(Marker) { m =>! // update state...! }! ! ! ! ! } persistAsync PersistentActor: persistAsync(){} will NOT force stashing of commands
  • 39. PersistentActor: persistAsync(){} def receiveCommand = {! ! ! ! case Mark(id) =>! sender() ! InitMarking! persistAsync(Marker) { m =>! // update state...! }! ! defer(Marked(id)) { marked =>! sender() ! marked! }! } execute once all persistAsync handlers done NOT persisted
  • 40. persistAsync(){} - Ordering guarantees ! ! Journal var state = S0 ! def processorId = “a” ! C1 C2 C3
  • 41. persistAsync(){} - Ordering guarantees ! ! Journal var state = S0 ! def processorId = “a” !C2 C3
  • 42. persistAsync(){} - Ordering guarantees ! ! Journal var state = S0 ! def processorId = “a” ! C3
  • 43. persistAsync(){} - Ordering guarantees ! ! Journal var state = S0 ! def processorId = “a” ! C3 E1 E2
  • 44. persistAsync(){} - Ordering guarantees var state = S0 ! def processorId = “a” ! C3 E1 Akka  Persistence  ScalaDays ! ! Journal E1 E2
  • 45. persistAsync(){} - Ordering guarantees E1 var state = S1 ! def processorId = “a” ! E2 E1 E2 ! ! Journal Akka  Persistence  ScalaDays E2 E3E1
  • 46. persistAsync(){} - Ordering guarantees E1 var state = S2 ! def processorId = “a” ! E2 E1 E2 deferred handlers triggered M1 M2 ! ! Journal Akka  Persistence  ScalaDays E2 E3E1
  • 48. Eventsourced, recovery /** MUST NOT SIDE-EFFECT! */! def receiveRecover = {! case replayedEvent: Event => ! state = updateState(replayedEvent)! } re-using updateState, as seen in receiveCommand Akka  Persistence  ScalaDays
  • 50. Journal (DB) ! ! ! Views ! Processor ! def processorId = “a” ! polling Akka  Persistence  ScalaDays ! View ! def processorId = “a” ! ! !
  • 51. Journal (DB) ! ! ! Views ! Processor ! def processorId = “a” ! polling ! View ! def processorId = “a” ! ! ! polling different ActorPath, same processorId Akka  Persistence  ScalaDays ! View ! def processorId = “a” ! ! !
  • 52. View class DoublingCounterProcessor extends View {! var state = 0! 
 override val processorId = "counter"! ! def receive = {! case Persistent(payload, seqNr) =>! // “state += 2 * payload” ! ! }! } subject to change! Akka  Persistence  ScalaDays
  • 53. Views, as Reactive Streams Akka  Persistence  ScalaDays
  • 54. View, as ReactiveStream // Imports ...! ! import org.reactivestreams.api.Producer! ! import akka.stream._! import akka.stream.scaladsl.Flow! ! import akka.persistence._! import akka.persistence.stream._! 
 val materializer = FlowMaterializer(MaterializerSettings())! pull request by krasserm early preview Akka  Persistence  ScalaDays
  • 55. View, as ReactiveStream // 1 producer and 2 consumers:! val p1: Producer[Persistent] = PersistentFlow.! fromProcessor(“processor-1").! toProducer(materializer)! ! Flow(p1).! foreach(p => println(s"consumer-1: ${p.payload}”)).! consume(materializer)! ! Flow(p1).! foreach(p => println(s"consumer-2: ${p.payload}”)).! consume(materializer) pull request by krasserm early preview Akka  Persistence  ScalaDays
  • 56. View, as ReactiveStream // 2 producers (merged) and 1 consumer:! val p2: Producer[Persistent] = PersistentFlow.! fromProcessor(“processor-2").! toProducer(materializer)! 
 val p3: Producer[Persistent] = PersistentFlow.! fromProcessor(“processor-3").! toProducer(materializer)! ! Flow(p2).merge(p3). // triggers on “either”! foreach { p => println(s"consumer-3: ${p.payload}") }.! consume(materializer)! pull request by krasserm early preview Akka  Persistence  ScalaDays
  • 57. Akka  Persistence  ScalaDays  2014 Usage in a Cluster • distributed journal (http://akka.io/community/) • Cassandra • DynamoDB • HBase • MongoDB • shared LevelDB journal for testing • single writer • cluster singleton • cluster sharding
  • 58. Akka  Persistence  ScalaDays  2014 Cluster Singleton A B C D
  • 59. Akka  Persistence  ScalaDays  2014 Cluster Singleton A B C D role: backend-1 role: backend-1 role: backend-2 role: backend-2
  • 60. Akka  Persistence  ScalaDays  2014 Cluster Sharding A B C D
  • 61. Akka  Persistence  ScalaDays  2014 Cluster Sharding sender id:17 region
 node-­‐1 coordinator region
 node-­‐2 region
 node-­‐3 GetShardHome:17 id:17 ShardHome:17  -­‐>  node2 17  -­‐>  node2
  • 62. Akka  Persistence  ScalaDays  2014 Cluster Sharding sender region
 node-­‐1 coordinator region
 node-­‐2 region
 node-­‐3 id:17 id:17 GetShardHome:17 ShardHome:17  -­‐>  node2 id:17 17  -­‐>  node2 17  -­‐>  node2
  • 63. Akka  Persistence  ScalaDays  2014 Cluster Sharding 17 sender region
 node-­‐1 coordinator region
 node-­‐2 region
 node-­‐3 id:17 id:17 17  -­‐>  node2 17  -­‐>  node2 17  -­‐>  node2
  • 64. Akka  Persistence  ScalaDays  2014 Cluster Sharding 17 sender region
 node-­‐1 coordinator region
 node-­‐2 region
 node-­‐3 17  -­‐>  node2 17  -­‐>  node2 17  -­‐>  node2 id:17
  • 65. Akka  Persistence  ScalaDays  2014 Cluster Sharding 17 sender region
 node-­‐1 coordinator region
 node-­‐2 region
 node-­‐3 17  -­‐>  node2 17  -­‐>  node2 17  -­‐>  node2 id:17
  • 66. Cluster Sharding val idExtractor: ShardRegion.IdExtractor = { case cmd: Command => (cmd.postId, cmd) } ! val shardResolver: ShardRegion.ShardResolver = msg => msg match { case cmd: Command => (math.abs(cmd.postId.hashCode) % 100).toString } ClusterSharding(system).start( typeName = BlogPost.shardName, entryProps = Some(BlogPost.props()), idExtractor = BlogPost.idExtractor, shardResolver = BlogPost.shardResolver) val blogPostRegion: ActorRef = 
 ClusterSharding(context.system).shardRegion(BlogPost.shardName) ! val postId = UUID.randomUUID().toString blogPostRegion ! BlogPost.AddPost(postId, author, title)
  • 67. Akka  Persistence  ScalaDays  2014 Lost messages sender destination $
  • 68. Akka  Persistence  ScalaDays  2014 At-least-once delivery - duplicates sender destination $ ok $ $ $ ok Re-­‐send
  • 69. Akka  Persistence  ScalaDays  2014 M2 At-least-once delivery - unordered sender destination M1 ok  1 ok  2 M2 ok  3 M3 M1M3 M2 Re-­‐send
  • 70. Akka  Persistence  ScalaDays  2014 M2 At-least-once delivery - crash sender destination M1 ok  1 ok  2 M2 ok  3 M3 1. Sent  M1   2. Sent  M2   3. Sent  M3   M3 5.  M2  Confirmed   6.  M3  Confirmed 4.  M1  Confirmed sender M1M2 M3
  • 71. PersistentActor with AtLeastOnceDelivery case class Msg(deliveryId: Long, s: String) case class Confirm(deliveryId: Long) sealed trait Evt case class MsgSent(s: String) extends Evt case class MsgConfirmed(deliveryId: Long) extends Evt class Sender(destination: ActorPath) extends PersistentActor with AtLeastOnceDelivery { ! def receiveCommand: Receive = { case s: String => persist(MsgSent(s))(updateState) case Confirm(deliveryId) => persist(MsgConfirmed(deliveryId))(updateState) } ! def receiveRecover: Receive = { case evt: Evt => updateState(evt) } ! def updateState(evt: Evt): Unit = evt match { case MsgSent(s) => deliver(destination, deliveryId => Msg(deliveryId, s)) ! case MsgConfirmed(deliveryId) => confirmDelivery(deliveryId) } }
  • 72. Akka  Persistence  ScalaDays  2014 Next step • Documentation • http://doc.akka.io/docs/akka/2.3.3/scala/persistence.html • http://doc.akka.io/docs/akka/2.3.3/java/persistence.html • http://doc.akka.io/docs/akka/2.3.3/contrib/cluster-sharding.html • Typesafe Activator • https://typesafe.com/activator/template/akka-sample-persistence-scala • https://typesafe.com/activator/template/akka-sample-persistence-java • http://typesafe.com/activator/template/akka-cluster-sharding-scala • Mailing list • http://groups.google.com/group/akka-user • Migration guide from Eventsourced • http://doc.akka.io/docs/akka/2.3.3/project/migration-guide-eventsourced-2.3.x.html
  • 73. ©Typesafe 2014 – All Rights Reserved