SlideShare a Scribd company logo
MANCHESTER LONDON NEW YORK
CC BY-NC 3.0
CC BY-NC 3.0
Screenshot
CC BY-NC 3.0
Before: the mess
CC BY-NC 3.0
Before: the mess
CC BY-NC 3.0
Before: the mess
Cassandra
Akka & Spray
C++ & CUDA
RabbitMQ
CC BY-NC 3.0
Before: the mess
scene topic
identity topic
(Map[String, String],
Array[Byte])
(Map[String, String],
Array[Byte])
CC BY-NC 3.0
Before: the mess
_tmp_x topics
JSON
scene topic
identity topic
(Map[String, String],
Array[Byte])
(Map[String, String],
Array[Byte])
CC BY-NC 3.0
Before: the mess
fire-and-forget at-most-once
non-durable
fire-and-forgetat-most-once
CC BY-NC 3.0
Asynchronous request–response orchestration
class Orchestrator extends Actor with ActorFSM[Orchestrator.State, Orchestrator.Data] {
startWith(Idle, UninitializedData)
when(Idle, idleTimeout)(idleSF)
when(ImageProcessing, stepTimeout)(imageProcessingSF)
when(WaitingForProcessingResult, stepTimeout)(waitingForProcessingSF)
whenUnhandled(timeoutSF)
onTransition {
case _ -> Aborted => ???
...
}
def idleSF: StateFunction = ???
def imageProcessingSF: StateFunction = ???
def waitingForProcessingSF: StateFunction = ???
def timeoutSF: StateFunction = {
case Event(StateTimeout, data: RunningTransactionData) => goto(Aborted)
}
}
CC BY-NC 3.0
After: proper microservices
scene
identity
ingest dashboard
CC BY-NC 3.0
After: proper microservices
scene
identity
ingest dashboard
CC BY-NC 3.0
After: proper microservices
scene
identity
ingest dashboard
Akka
Cassandra
Kafka
CC BY-NC 3.0
After: proper microservices
scene
identity
ingest dashboard
tweet-image topic
identity group
scene group
scene topic
identity topic
CC BY-NC 3.0
After: proper microservices
scene
identity
ingest dashboard
tweet-image topic
scene topic
identity topic
message Scene { … }
message Identity { … }
bytes image;
message Envelope {
int32 version = 1;
int64 processingTimestamp = 2;
int64 ingestionTimestamp = 3;
string correlationId = 4;
string messageId = 5;
string messageType = 6;
bytes payload = 7;
}
CC BY-NC 3.0
After: proper microservices
scene
identity
ingest dashboard
at-least-once I
at-least-once II
at-most-oncefire-and-forget
CC BY-NC 3.0
Persistence and formats
message Envelope {

int32 version = 1;

int64 processingTimestamp = 2;

int64 ingestionTimestamp = 3;

string correlationId = 4;

string messageId = 5;

string messageType = 6;

bytes payload = 7;

}
CC BY-NC 3.0
Persistence and formats
message Scene {
message Label {

string label = 1;

double score = 2;

}


repeated Label labels = 3;

}
CC BY-NC 3.0
Persistence and formats
message Identity {

oneof face {

IdentifiedFace identifiedFace = 1;

UnknownFace unknownFace = 2;

}



message IdentifiedFace {

string name = 1;

double score = 2;

}



message UnknownFace { }

}
CC BY-NC 3.0
Persistence and formats
message IdentifyFace {

int64 ingestionTimestamp = 2;

string correlationId = 3;

string handle = 4;

bytes image = 5;

}



message IdentifyFaces {

repeated IdentifyFace identifyFaces = 1;

}



message FaceImage {

double confidence = 1;

int32 x = 2;

int32 y = 3;

int32 w = 4;

int32 h = 5;

bytes rgbBitmap = 6;

}
CC BY-NC 3.0
Fire–and–forget send
object Act {
def props(config: Config): Props = {
val producerConf = KafkaProducer.Conf(config.getConfig("..."),
new StringSerializer, KafkaSerializer[Envelope](_.toByteArray))
Props(classOf[Act], producerConf)
}
}
class Act(producerConf: KafkaProducer.Conf[String, Envelope]) extends Actor {
private[this] val producer = KafkaProducer(conf = producerConf)
override def receive: Receive = {
case TweetImage(handle, content) =>
producer.send(KafkaProducerRecord("tweet-image", handle,
Envelope(version = 100,
ingestionTimestamp = System.nanoTime(),
processingTimestamp = System.nanoTime(),
messageId = UUID.randomUUID().toString,
correlationId = UUID.randomUUID().toString,
payload = content)))
}
}
CC BY-NC 3.0
At least once delivery I
class SceneClassifierActor(…) extends Actor {
private[this] val kafkaConsumerActor = context.actorOf(…)
private[this] val producer = KafkaProducer(…)
override def receive: Receive = {
case extractor(consumerRecords) =>
val futures = consumerRecords.pairs.flatMap {
case (Some(handle), envelope) =>
val outEnvelope = …
Some(producer.send(KafkaProducerRecord("scene", handle, outEnvelope)))
}
import context.dispatcher
Future.sequence(futures).onSuccess {
case _ => kafkaConsumerActor ! Confirm(consumerRecords.offsets, commit = true)
}
}
}
CC BY-NC 3.0
At least once delivery II
class IdentityMatcherActor(...) extends PersistentActor with AtLeastOnceDelivery {
override val persistenceId: String = "identity-matcher-actor"
def identifyFacesAndSend(identifyFaces: Seq[IdentifyFace])(implicit executor: ExecutionContext): Future[Unit] = {
// Future.sequence(producer.send(...))
}
def handleIdentifyFace: Receive = {
case (deliveryId: Long, identifyFaces: IdentifyFaces) =>
import context.dispatcher
identifyFacesAndSend(identifyFaces.identifyFaces).onSuccess { case _ => confirmDelivery(deliveryId) }
case IdentifyFaces(faces) =>
import context.dispatcher
identifyFacesAndSend(faces).onFailure { case _ => self ! Kill }
}
override def receiveRecover: Receive = handleIdentifyFace
override def receiveCommand: Receive = handleIdentifyFace orElse {
case extractor(consumerRecords) =>
val identifyFaces = consumerRecords.pairs.flatMap {
case (Some(handle), envelope) =>
Some(IdentifyFace(envelope.ingestionTimestamp, envelope.correlationId, handle, envelope.payload))
}
persist(IdentifyFaces(identifyFaces = identifyFaces)) { result =>
deliver(self.path)(deliveryId => (deliveryId, result))
sender() ! Confirm(consumerRecords.offsets, commit = true)
}
}
}
CC BY-NC 3.0
At most once delivery
class DashboardSinkActor(...) extends Actor {
private[this] val kafkaConsumerActor = context.actorOf(...)
override def receive: Receive = {
case extractor(consumerRecords) =>
consumerRecords.pairs.foreach {
case (None, _) =>
case (Some(handle), envelope) =>
context.system.eventStream.publish(
TweetEnvelope(version = 100,
handle = handle,
ingestionTimestamp = envelope.ingestionTimestamp,
messageId = envelope.messageId,
messageType = envelope.messageType,
payload = envelope.payload))
}
kafkaConsumerActor ! Confirm(consumerRecords.offsets, commit = true)
}
}
CC BY-NC 3.0
ENOUGH SLIDES!
CC BY-NC 3.0
After: proper microservices
scene
identity
ingest dashboard
MANCHESTER LONDON NEW YORK
CC BY-NC 3.0
github.com/eigengo/reactive-summit-2016
rsa16-models.s3-website-eu-west-1.amazonaws.com/{identity,scene}/{config,labels,params}
@honzam399
janm@cakesolutions.net
@cakesolutions
(347) 708-1518
enquiries@cakesolutions.net
MANCHESTER LONDON NEW YORK
CC BY-NC 3.0

More Related Content

What's hot

Senior design project code for PPG
Senior design project code for PPGSenior design project code for PPG
Senior design project code for PPG
FrankDin1
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
aleks-f
 
Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup
Claudio Capobianco
 
Clojure ♥ cassandra
Clojure ♥ cassandra Clojure ♥ cassandra
Clojure ♥ cassandra
Max Penet
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
Caridy Patino
 
Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012
aleks-f
 
Lambda expressions in C++
Lambda expressions in C++Lambda expressions in C++
Lambda expressions in C++
Dimitrios Platis
 
Using QString effectively
Using QString effectivelyUsing QString effectively
Using QString effectively
Roman Okolovich
 
Dynamic programming burglar_problem
Dynamic programming burglar_problemDynamic programming burglar_problem
Dynamic programming burglar_problem
Russell Childs
 
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Dimitrios Platis
 
An Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB PluginsAn Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB PluginsTakahiro Inoue
 
04 - Qt Data
04 - Qt Data04 - Qt Data
04 - Qt Data
Andreas Jakl
 
HexRaysCodeXplorer: make object-oriented RE easier
HexRaysCodeXplorer: make object-oriented RE easierHexRaysCodeXplorer: make object-oriented RE easier
HexRaysCodeXplorer: make object-oriented RE easier
Alex Matrosov
 
Class 31: Deanonymizing
Class 31: DeanonymizingClass 31: Deanonymizing
Class 31: Deanonymizing
David Evans
 
Writing a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 CanvasWriting a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 Canvas
Steve Purkis
 
CUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : NotesCUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : Notes
Subhajit Sahu
 
CUDA by Example : Introduction to CUDA C : Notes
CUDA by Example : Introduction to CUDA C : NotesCUDA by Example : Introduction to CUDA C : Notes
CUDA by Example : Introduction to CUDA C : Notes
Subhajit Sahu
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live Hacking
Tobias Trelle
 

What's hot (20)

Senior design project code for PPG
Senior design project code for PPGSenior design project code for PPG
Senior design project code for PPG
 
Lecture1 classes3
Lecture1 classes3Lecture1 classes3
Lecture1 classes3
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
 
cpp_sample
cpp_samplecpp_sample
cpp_sample
 
Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup
 
Clojure ♥ cassandra
Clojure ♥ cassandra Clojure ♥ cassandra
Clojure ♥ cassandra
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
 
Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012
 
Lambda expressions in C++
Lambda expressions in C++Lambda expressions in C++
Lambda expressions in C++
 
Using QString effectively
Using QString effectivelyUsing QString effectively
Using QString effectively
 
Dynamic programming burglar_problem
Dynamic programming burglar_problemDynamic programming burglar_problem
Dynamic programming burglar_problem
 
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
 
An Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB PluginsAn Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB Plugins
 
04 - Qt Data
04 - Qt Data04 - Qt Data
04 - Qt Data
 
HexRaysCodeXplorer: make object-oriented RE easier
HexRaysCodeXplorer: make object-oriented RE easierHexRaysCodeXplorer: make object-oriented RE easier
HexRaysCodeXplorer: make object-oriented RE easier
 
Class 31: Deanonymizing
Class 31: DeanonymizingClass 31: Deanonymizing
Class 31: Deanonymizing
 
Writing a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 CanvasWriting a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 Canvas
 
CUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : NotesCUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : Notes
 
CUDA by Example : Introduction to CUDA C : Notes
CUDA by Example : Introduction to CUDA C : NotesCUDA by Example : Introduction to CUDA C : Notes
CUDA by Example : Introduction to CUDA C : Notes
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live Hacking
 

Viewers also liked

Supercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactSupercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-react
John McClean
 
NI100SMG
NI100SMGNI100SMG
Sun_City_Group__Inc_Presentation
Sun_City_Group__Inc_PresentationSun_City_Group__Inc_Presentation
Sun_City_Group__Inc_PresentationAdrian Provencio
 
Adarsh credit advisor booklet
Adarsh credit advisor bookletAdarsh credit advisor booklet
Adarsh credit advisor booklet
adarshcredit
 
ciencias del deporte
ciencias del deporte ciencias del deporte
ciencias del deporte
lurasu
 
Diapositivas gestion ramiro priale
Diapositivas gestion ramiro prialeDiapositivas gestion ramiro priale
Diapositivas gestion ramiro priale
Club Girasoles
 
Final Presentation
Final PresentationFinal Presentation
Final PresentationRoss Harris
 
Проект Госуправление 2.0.
Проект Госуправление 2.0. Проект Госуправление 2.0.
Проект Госуправление 2.0.
lenobl
 
Myrichestcelebritiesblog
MyrichestcelebritiesblogMyrichestcelebritiesblog
Myrichestcelebritiesblog
BryiosunKiosutz
 
презентация1
презентация1презентация1
презентация1
A P
 
Bahner Richard HR eROI Execution at Deutsche Bank
Bahner Richard HR eROI Execution at Deutsche BankBahner Richard HR eROI Execution at Deutsche Bank
Bahner Richard HR eROI Execution at Deutsche BankRichard Bahner
 

Viewers also liked (11)

Supercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactSupercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-react
 
NI100SMG
NI100SMGNI100SMG
NI100SMG
 
Sun_City_Group__Inc_Presentation
Sun_City_Group__Inc_PresentationSun_City_Group__Inc_Presentation
Sun_City_Group__Inc_Presentation
 
Adarsh credit advisor booklet
Adarsh credit advisor bookletAdarsh credit advisor booklet
Adarsh credit advisor booklet
 
ciencias del deporte
ciencias del deporte ciencias del deporte
ciencias del deporte
 
Diapositivas gestion ramiro priale
Diapositivas gestion ramiro prialeDiapositivas gestion ramiro priale
Diapositivas gestion ramiro priale
 
Final Presentation
Final PresentationFinal Presentation
Final Presentation
 
Проект Госуправление 2.0.
Проект Госуправление 2.0. Проект Госуправление 2.0.
Проект Госуправление 2.0.
 
Myrichestcelebritiesblog
MyrichestcelebritiesblogMyrichestcelebritiesblog
Myrichestcelebritiesblog
 
презентация1
презентация1презентация1
презентация1
 
Bahner Richard HR eROI Execution at Deutsche Bank
Bahner Richard HR eROI Execution at Deutsche BankBahner Richard HR eROI Execution at Deutsche Bank
Bahner Richard HR eROI Execution at Deutsche Bank
 

Similar to Monolith to Reactive Microservices

ReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better TogetherReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better Together
Colin Eberhardt
 
Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...
Docker, Inc.
 
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Codemotion
 
Akka: Actor Design & Communication Technics
Akka: Actor Design & Communication TechnicsAkka: Actor Design & Communication Technics
Akka: Actor Design & Communication Technics
Alex Fruzenshtein
 
Finagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ KnoldusFinagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ Knoldus
Knoldus Inc.
 
Using Java I know its a lot of information but with the U.pdf
Using Java I know its a lot of information but with the U.pdfUsing Java I know its a lot of information but with the U.pdf
Using Java I know its a lot of information but with the U.pdf
picscamshoppe
 
Apache Cassandra in Bangalore - Cassandra Internals and Performance
Apache Cassandra in Bangalore - Cassandra Internals and PerformanceApache Cassandra in Bangalore - Cassandra Internals and Performance
Apache Cassandra in Bangalore - Cassandra Internals and Performance
aaronmorton
 
Apache Con NA 2013 - Cassandra Internals
Apache Con NA 2013 - Cassandra InternalsApache Con NA 2013 - Cassandra Internals
Apache Con NA 2013 - Cassandra Internals
aaronmorton
 
Luciano Mammino - Cracking JWT tokens: a tale of magic, Node.JS and parallel...
Luciano Mammino  - Cracking JWT tokens: a tale of magic, Node.JS and parallel...Luciano Mammino  - Cracking JWT tokens: a tale of magic, Node.JS and parallel...
Luciano Mammino - Cracking JWT tokens: a tale of magic, Node.JS and parallel...
Codemotion
 
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingCracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Luciano Mammino
 
The Ring programming language version 1.5.1 book - Part 43 of 180
The Ring programming language version 1.5.1 book - Part 43 of 180The Ring programming language version 1.5.1 book - Part 43 of 180
The Ring programming language version 1.5.1 book - Part 43 of 180
Mahmoud Samir Fayed
 
Analysis of Microsoft Code Contracts
Analysis of Microsoft Code ContractsAnalysis of Microsoft Code Contracts
Analysis of Microsoft Code Contracts
PVS-Studio
 
Consuming web services asynchronously with Futures and Rx Observables (svcc, ...
Consuming web services asynchronously with Futures and Rx Observables (svcc, ...Consuming web services asynchronously with Futures and Rx Observables (svcc, ...
Consuming web services asynchronously with Futures and Rx Observables (svcc, ...
Chris Richardson
 
Object Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorerObject Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorer
Alex Matrosov
 
NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)
Chris Richardson
 
Config interface
Config interfaceConfig interface
Config interface
Ryan Boland
 
DIWE - Advanced PHP Concepts
DIWE - Advanced PHP ConceptsDIWE - Advanced PHP Concepts
DIWE - Advanced PHP Concepts
Rasan Samarasinghe
 
Cassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, OverviewCassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, Overview
Joshua McKenzie
 
MongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-es
MongoDB
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
Mahmoud Samir Fayed
 

Similar to Monolith to Reactive Microservices (20)

ReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better TogetherReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better Together
 
Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...
 
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
 
Akka: Actor Design & Communication Technics
Akka: Actor Design & Communication TechnicsAkka: Actor Design & Communication Technics
Akka: Actor Design & Communication Technics
 
Finagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ KnoldusFinagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ Knoldus
 
Using Java I know its a lot of information but with the U.pdf
Using Java I know its a lot of information but with the U.pdfUsing Java I know its a lot of information but with the U.pdf
Using Java I know its a lot of information but with the U.pdf
 
Apache Cassandra in Bangalore - Cassandra Internals and Performance
Apache Cassandra in Bangalore - Cassandra Internals and PerformanceApache Cassandra in Bangalore - Cassandra Internals and Performance
Apache Cassandra in Bangalore - Cassandra Internals and Performance
 
Apache Con NA 2013 - Cassandra Internals
Apache Con NA 2013 - Cassandra InternalsApache Con NA 2013 - Cassandra Internals
Apache Con NA 2013 - Cassandra Internals
 
Luciano Mammino - Cracking JWT tokens: a tale of magic, Node.JS and parallel...
Luciano Mammino  - Cracking JWT tokens: a tale of magic, Node.JS and parallel...Luciano Mammino  - Cracking JWT tokens: a tale of magic, Node.JS and parallel...
Luciano Mammino - Cracking JWT tokens: a tale of magic, Node.JS and parallel...
 
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingCracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
 
The Ring programming language version 1.5.1 book - Part 43 of 180
The Ring programming language version 1.5.1 book - Part 43 of 180The Ring programming language version 1.5.1 book - Part 43 of 180
The Ring programming language version 1.5.1 book - Part 43 of 180
 
Analysis of Microsoft Code Contracts
Analysis of Microsoft Code ContractsAnalysis of Microsoft Code Contracts
Analysis of Microsoft Code Contracts
 
Consuming web services asynchronously with Futures and Rx Observables (svcc, ...
Consuming web services asynchronously with Futures and Rx Observables (svcc, ...Consuming web services asynchronously with Futures and Rx Observables (svcc, ...
Consuming web services asynchronously with Futures and Rx Observables (svcc, ...
 
Object Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorerObject Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorer
 
NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)
 
Config interface
Config interfaceConfig interface
Config interface
 
DIWE - Advanced PHP Concepts
DIWE - Advanced PHP ConceptsDIWE - Advanced PHP Concepts
DIWE - Advanced PHP Concepts
 
Cassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, OverviewCassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, Overview
 
MongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-es
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
 

More from Reactivesummit

Distributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaDistributed stream processing with Apache Kafka
Distributed stream processing with Apache Kafka
Reactivesummit
 
Reactive Polyglot Microservices with OpenShift and Vert.x
Reactive Polyglot Microservices with OpenShift and Vert.xReactive Polyglot Microservices with OpenShift and Vert.x
Reactive Polyglot Microservices with OpenShift and Vert.x
Reactivesummit
 
Microservices: The danger of overhype and importance of checklists
Microservices: The danger of overhype and importance of checklistsMicroservices: The danger of overhype and importance of checklists
Microservices: The danger of overhype and importance of checklists
Reactivesummit
 
Orchestrated Chaos: Applying Failure Testing Research at Scale.
Orchestrated Chaos: Applying Failure Testing Research at Scale.Orchestrated Chaos: Applying Failure Testing Research at Scale.
Orchestrated Chaos: Applying Failure Testing Research at Scale.
Reactivesummit
 
The Zen Of Erlang
The Zen Of ErlangThe Zen Of Erlang
The Zen Of Erlang
Reactivesummit
 
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
Reactivesummit
 

More from Reactivesummit (6)

Distributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaDistributed stream processing with Apache Kafka
Distributed stream processing with Apache Kafka
 
Reactive Polyglot Microservices with OpenShift and Vert.x
Reactive Polyglot Microservices with OpenShift and Vert.xReactive Polyglot Microservices with OpenShift and Vert.x
Reactive Polyglot Microservices with OpenShift and Vert.x
 
Microservices: The danger of overhype and importance of checklists
Microservices: The danger of overhype and importance of checklistsMicroservices: The danger of overhype and importance of checklists
Microservices: The danger of overhype and importance of checklists
 
Orchestrated Chaos: Applying Failure Testing Research at Scale.
Orchestrated Chaos: Applying Failure Testing Research at Scale.Orchestrated Chaos: Applying Failure Testing Research at Scale.
Orchestrated Chaos: Applying Failure Testing Research at Scale.
 
The Zen Of Erlang
The Zen Of ErlangThe Zen Of Erlang
The Zen Of Erlang
 
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
 

Recently uploaded

Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 

Recently uploaded (20)

Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 

Monolith to Reactive Microservices

  • 1. MANCHESTER LONDON NEW YORK CC BY-NC 3.0
  • 5. CC BY-NC 3.0 Before: the mess Cassandra Akka & Spray C++ & CUDA RabbitMQ
  • 6. CC BY-NC 3.0 Before: the mess scene topic identity topic (Map[String, String], Array[Byte]) (Map[String, String], Array[Byte])
  • 7. CC BY-NC 3.0 Before: the mess _tmp_x topics JSON scene topic identity topic (Map[String, String], Array[Byte]) (Map[String, String], Array[Byte])
  • 8. CC BY-NC 3.0 Before: the mess fire-and-forget at-most-once non-durable fire-and-forgetat-most-once
  • 9. CC BY-NC 3.0 Asynchronous request–response orchestration class Orchestrator extends Actor with ActorFSM[Orchestrator.State, Orchestrator.Data] { startWith(Idle, UninitializedData) when(Idle, idleTimeout)(idleSF) when(ImageProcessing, stepTimeout)(imageProcessingSF) when(WaitingForProcessingResult, stepTimeout)(waitingForProcessingSF) whenUnhandled(timeoutSF) onTransition { case _ -> Aborted => ??? ... } def idleSF: StateFunction = ??? def imageProcessingSF: StateFunction = ??? def waitingForProcessingSF: StateFunction = ??? def timeoutSF: StateFunction = { case Event(StateTimeout, data: RunningTransactionData) => goto(Aborted) } }
  • 10. CC BY-NC 3.0 After: proper microservices scene identity ingest dashboard
  • 11. CC BY-NC 3.0 After: proper microservices scene identity ingest dashboard
  • 12. CC BY-NC 3.0 After: proper microservices scene identity ingest dashboard Akka Cassandra Kafka
  • 13. CC BY-NC 3.0 After: proper microservices scene identity ingest dashboard tweet-image topic identity group scene group scene topic identity topic
  • 14. CC BY-NC 3.0 After: proper microservices scene identity ingest dashboard tweet-image topic scene topic identity topic message Scene { … } message Identity { … } bytes image; message Envelope { int32 version = 1; int64 processingTimestamp = 2; int64 ingestionTimestamp = 3; string correlationId = 4; string messageId = 5; string messageType = 6; bytes payload = 7; }
  • 15. CC BY-NC 3.0 After: proper microservices scene identity ingest dashboard at-least-once I at-least-once II at-most-oncefire-and-forget
  • 16. CC BY-NC 3.0 Persistence and formats message Envelope {
 int32 version = 1;
 int64 processingTimestamp = 2;
 int64 ingestionTimestamp = 3;
 string correlationId = 4;
 string messageId = 5;
 string messageType = 6;
 bytes payload = 7;
 }
  • 17. CC BY-NC 3.0 Persistence and formats message Scene { message Label {
 string label = 1;
 double score = 2;
 } 
 repeated Label labels = 3;
 }
  • 18. CC BY-NC 3.0 Persistence and formats message Identity {
 oneof face {
 IdentifiedFace identifiedFace = 1;
 UnknownFace unknownFace = 2;
 }
 
 message IdentifiedFace {
 string name = 1;
 double score = 2;
 }
 
 message UnknownFace { }
 }
  • 19. CC BY-NC 3.0 Persistence and formats message IdentifyFace {
 int64 ingestionTimestamp = 2;
 string correlationId = 3;
 string handle = 4;
 bytes image = 5;
 }
 
 message IdentifyFaces {
 repeated IdentifyFace identifyFaces = 1;
 }
 
 message FaceImage {
 double confidence = 1;
 int32 x = 2;
 int32 y = 3;
 int32 w = 4;
 int32 h = 5;
 bytes rgbBitmap = 6;
 }
  • 20. CC BY-NC 3.0 Fire–and–forget send object Act { def props(config: Config): Props = { val producerConf = KafkaProducer.Conf(config.getConfig("..."), new StringSerializer, KafkaSerializer[Envelope](_.toByteArray)) Props(classOf[Act], producerConf) } } class Act(producerConf: KafkaProducer.Conf[String, Envelope]) extends Actor { private[this] val producer = KafkaProducer(conf = producerConf) override def receive: Receive = { case TweetImage(handle, content) => producer.send(KafkaProducerRecord("tweet-image", handle, Envelope(version = 100, ingestionTimestamp = System.nanoTime(), processingTimestamp = System.nanoTime(), messageId = UUID.randomUUID().toString, correlationId = UUID.randomUUID().toString, payload = content))) } }
  • 21. CC BY-NC 3.0 At least once delivery I class SceneClassifierActor(…) extends Actor { private[this] val kafkaConsumerActor = context.actorOf(…) private[this] val producer = KafkaProducer(…) override def receive: Receive = { case extractor(consumerRecords) => val futures = consumerRecords.pairs.flatMap { case (Some(handle), envelope) => val outEnvelope = … Some(producer.send(KafkaProducerRecord("scene", handle, outEnvelope))) } import context.dispatcher Future.sequence(futures).onSuccess { case _ => kafkaConsumerActor ! Confirm(consumerRecords.offsets, commit = true) } } }
  • 22. CC BY-NC 3.0 At least once delivery II class IdentityMatcherActor(...) extends PersistentActor with AtLeastOnceDelivery { override val persistenceId: String = "identity-matcher-actor" def identifyFacesAndSend(identifyFaces: Seq[IdentifyFace])(implicit executor: ExecutionContext): Future[Unit] = { // Future.sequence(producer.send(...)) } def handleIdentifyFace: Receive = { case (deliveryId: Long, identifyFaces: IdentifyFaces) => import context.dispatcher identifyFacesAndSend(identifyFaces.identifyFaces).onSuccess { case _ => confirmDelivery(deliveryId) } case IdentifyFaces(faces) => import context.dispatcher identifyFacesAndSend(faces).onFailure { case _ => self ! Kill } } override def receiveRecover: Receive = handleIdentifyFace override def receiveCommand: Receive = handleIdentifyFace orElse { case extractor(consumerRecords) => val identifyFaces = consumerRecords.pairs.flatMap { case (Some(handle), envelope) => Some(IdentifyFace(envelope.ingestionTimestamp, envelope.correlationId, handle, envelope.payload)) } persist(IdentifyFaces(identifyFaces = identifyFaces)) { result => deliver(self.path)(deliveryId => (deliveryId, result)) sender() ! Confirm(consumerRecords.offsets, commit = true) } } }
  • 23. CC BY-NC 3.0 At most once delivery class DashboardSinkActor(...) extends Actor { private[this] val kafkaConsumerActor = context.actorOf(...) override def receive: Receive = { case extractor(consumerRecords) => consumerRecords.pairs.foreach { case (None, _) => case (Some(handle), envelope) => context.system.eventStream.publish( TweetEnvelope(version = 100, handle = handle, ingestionTimestamp = envelope.ingestionTimestamp, messageId = envelope.messageId, messageType = envelope.messageType, payload = envelope.payload)) } kafkaConsumerActor ! Confirm(consumerRecords.offsets, commit = true) } }
  • 25. CC BY-NC 3.0 After: proper microservices scene identity ingest dashboard
  • 26. MANCHESTER LONDON NEW YORK CC BY-NC 3.0 github.com/eigengo/reactive-summit-2016 rsa16-models.s3-website-eu-west-1.amazonaws.com/{identity,scene}/{config,labels,params} @honzam399 janm@cakesolutions.net