SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

Senior design project code for PPG
Senior design project code for PPGSenior design project code for PPG
Senior design project code for PPGFrankDin1
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013aleks-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 JavaScriptCaridy 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 2012aleks-f
 
Using QString effectively
Using QString effectivelyUsing QString effectively
Using QString effectivelyRoman Okolovich
 
Dynamic programming burglar_problem
Dynamic programming burglar_problemDynamic programming burglar_problem
Dynamic programming burglar_problemRussell 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
 
HexRaysCodeXplorer: make object-oriented RE easier
HexRaysCodeXplorer: make object-oriented RE easierHexRaysCodeXplorer: make object-oriented RE easier
HexRaysCodeXplorer: make object-oriented RE easierAlex Matrosov
 
Class 31: Deanonymizing
Class 31: DeanonymizingClass 31: Deanonymizing
Class 31: DeanonymizingDavid 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 CanvasSteve 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 : NotesSubhajit 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 : NotesSubhajit Sahu
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live HackingTobias Trelle
 

Mais procurados (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
 

Destaque

Supercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactSupercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactJohn McClean
 
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 bookletadarshcredit
 
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 prialeClub Girasoles
 
Final Presentation
Final PresentationFinal Presentation
Final PresentationRoss Harris
 
Проект Госуправление 2.0.
Проект Госуправление 2.0. Проект Госуправление 2.0.
Проект Госуправление 2.0. lenobl
 
Myrichestcelebritiesblog
MyrichestcelebritiesblogMyrichestcelebritiesblog
MyrichestcelebritiesblogBryiosunKiosutz
 
презентация1
презентация1презентация1
презентация1A 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
 

Destaque (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
 

Semelhante a Monolith to Reactive Microservices

ReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better TogetherReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better TogetherColin 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 TechnicsAlex Fruzenshtein
 
Finagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ KnoldusFinagle By Twitter Engineer @ Knoldus
Finagle By Twitter Engineer @ KnoldusKnoldus 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.pdfpicscamshoppe
 
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 Performanceaaronmorton
 
Apache Con NA 2013 - Cassandra Internals
Apache Con NA 2013 - Cassandra InternalsApache Con NA 2013 - Cassandra Internals
Apache Con NA 2013 - Cassandra Internalsaaronmorton
 
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 computingLuciano 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 180Mahmoud Samir Fayed
 
Analysis of Microsoft Code Contracts
Analysis of Microsoft Code ContractsAnalysis of Microsoft Code Contracts
Analysis of Microsoft Code ContractsPVS-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 HexraysCodeXplorerAlex 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 interfaceRyan Boland
 
Cassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, OverviewCassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, OverviewJoshua 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-esMongoDB
 
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 31Mahmoud Samir Fayed
 

Semelhante a 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
 

Mais de Reactivesummit

Distributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaDistributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaReactivesummit
 
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.xReactivesummit
 
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 checklistsReactivesummit
 
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
 
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
 

Mais de 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...
 

Último

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

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