How to stay Responsive with 400 Backends (JVMCON)

HOW TO STAYHOW TO STAY
RESPONSIVE WITH 400RESPONSIVE WITH 400
BACKENDSBACKENDS
@mthmulders
 
 
 
So, we need something that is...
 
Mobile First
Scalable
Secure
 
... but ...
 
doesn't store insurance data
retrieves that in real-time
from ~ 400 different companies!
 
 
START AS SIMPLE AS POSSIBLESTART AS SIMPLE AS POSSIBLE
All problems in computer science can be
solved by another abstraction layer.
-- not David Wheeler (1927 - 2004)
JUST MOVE THE PROBLEM AWAYJUST MOVE THE PROBLEM AWAY
Main Systems
Routing Engine
Insurer 01 Insurer 02 Insurer 03   ....    Insurer nn
FIRE UP YOUR IDE & START CODINGFIRE UP YOUR IDE & START CODING
Standardized interface for retrieving insurance data.
One endpoint address for each insurance company.
Retrieve data using link code that includes insurer ID.
 
Shouldn't be too hard!
 
 
YES, IT BREAKS...YES, IT BREAKS...
NOT RELATED, BUTNOT RELATED, BUT
ANALYSISANALYSIS
Blocking network calls
No time-outs
 
The whole JVM is waiting!
 
If an insurer is down, it will still be contacted.
This will slow down the system even further.
THE REACTIVE MANIFESTOTHE REACTIVE MANIFESTO
 
MESSAGE DRIVENMESSAGE DRIVEN
Reactive Systems rely on asynchronous
message-passing to establish a boundary
between components that ensures loose
coupling, isolation and location
transparency.
ELASTICELASTIC
The system stays responsive under varying
workload. Reactive Systems can react to
changes in the input rate by increasing or
decreasing the resources allocated to
service these inputs.
RESILIENTRESILIENT
The system stays responsive in the face of
failure. Failures are contained within each
component, [...] thereby ensuring that
parts of the system can fail and recover
without compromising the system as a
whole.
RESPONSIVERESPONSIVE
The system responds in a timely manner if
at all possible. Responsiveness is the
cornerstone of usability and utility [...].
Responsive systems focus on providing
rapid and consistent response times [...].
MEET... THE ACTOR MODELMEET... THE ACTOR MODEL
 
 
 
 
 
 
THE CIRCUIT BREAKERTHE CIRCUIT BREAKER
GIMME TEH CODEZ!GIMME TEH CODEZ!
INITIATE RETRIEVAL WITH TIME-OUTINITIATE RETRIEVAL WITH TIME-OUT
val actor = context.actorOf(
ConsultInsurersActor.props(), s"consult-$berrfnr" )
actor ! RetrieveAllPolicyData(linkingCode)
context.system.scheduler.scheduleOnce(2 seconds) {
self ! RetrievalTimeout(berrfnr, linkingCodes)
}
CONSULT ONE INSURERCONSULT ONE INSURER
// Send the request
val request = HttpRequest(POST, Uri(url), Nil, entity)
http ? request
 
// Receive the response
response.entity.as[ResponseData] match {
case Left(failure) => client ! Failure(failure)
case Right(data) => client ! PolicyDataRetrieved(data)
}
CONSULT INSURER (WITH CIRCUIT BREAKER)CONSULT INSURER (WITH CIRCUIT BREAKER)
val cb = new CircuitBreaker(system.scheduler,
maxFailures = 5,
callTimeout = 5 seconds,
resetTimeout = 1 minute) // or obtain from config
// Send the request
val request = HttpRequest(POST, Uri(url), Nil, entity)
cb.withCircuitBreaker(http ? request) pipeTo self
 
 
 
 
KEY TAKEAWAYSKEY TAKEAWAYS
Actor model enables building resilient solutions
Suitable for large portions of concurrent work
Think outside the box
Log unexpected messages
Use a whiteboard
THANKS!THANKS!
QUESTIONS?QUESTIONS?
IMAGESIMAGES
Insurance Policy by .
"Success Kid" a.k.a Sammy Griner by .
Blendtec founder/owner Tom Dickson by .
Reactive Manifesto by .
Actor Model by .
Pictures of Money (Flickr)
Laney Griner (Flickr)
Tim Provost
Wiljag Denekamp
Wiljag Denekamp
1 of 39

Recommended

How To Stay Responsive With 400 Backends by
How To Stay Responsive With 400 BackendsHow To Stay Responsive With 400 Backends
How To Stay Responsive With 400 BackendsMaarten Mulders
453 views35 slides
CCNA Security by
CCNA SecurityCCNA Security
CCNA Securitysepand kabiry
135 views1 slide
300-208 Dumps by
300-208 Dumps300-208 Dumps
300-208 Dumpsmason210
44 views11 slides
SC-900 Capabilities of Microsoft Security Solutions by
SC-900 Capabilities of Microsoft Security SolutionsSC-900 Capabilities of Microsoft Security Solutions
SC-900 Capabilities of Microsoft Security SolutionsFredBrandonAuthorMCP
153 views46 slides
CA_Module_2.pdf by
CA_Module_2.pdfCA_Module_2.pdf
CA_Module_2.pdfEhabRushdy1
38 views23 slides
Automating security compliance for physical, virtual, cloud, and container en... by
Automating security compliance for physical, virtual, cloud, and container en...Automating security compliance for physical, virtual, cloud, and container en...
Automating security compliance for physical, virtual, cloud, and container en...Lucy Huh Kerner
1.6K views39 slides

More Related Content

Similar to How to stay Responsive with 400 Backends (JVMCON)

Automotive Cybersecurity: Test Like a Hacker by
Automotive Cybersecurity: Test Like a HackerAutomotive Cybersecurity: Test Like a Hacker
Automotive Cybersecurity: Test Like a HackerForAllSecure
86 views46 slides
A Pragmatic Union: Security and SRE by
A Pragmatic Union: Security and SREA Pragmatic Union: Security and SRE
A Pragmatic Union: Security and SREJames Wickett
229 views50 slides
1.3. (In)security Software by
1.3. (In)security Software1.3. (In)security Software
1.3. (In)security Softwaredefconmoscow
432 views31 slides
Microsot Azure IoT Security for IoT ALGYAN Tech Seminar 2020/2/6 by
Microsot Azure IoT Security for IoT ALGYAN Tech Seminar 2020/2/6Microsot Azure IoT Security for IoT ALGYAN Tech Seminar 2020/2/6
Microsot Azure IoT Security for IoT ALGYAN Tech Seminar 2020/2/6Knowledge & Experience
149 views25 slides
13. Neville Varnham - PeopleSoft Cyber Security by
13. Neville Varnham - PeopleSoft Cyber Security13. Neville Varnham - PeopleSoft Cyber Security
13. Neville Varnham - PeopleSoft Cyber SecurityCedar Consulting
334 views46 slides
Migrating_to_Cloud-Native_App_Architectures_Pivotal by
Migrating_to_Cloud-Native_App_Architectures_PivotalMigrating_to_Cloud-Native_App_Architectures_Pivotal
Migrating_to_Cloud-Native_App_Architectures_PivotalEstevan McCalley
232 views58 slides

Similar to How to stay Responsive with 400 Backends (JVMCON)(20)

Automotive Cybersecurity: Test Like a Hacker by ForAllSecure
Automotive Cybersecurity: Test Like a HackerAutomotive Cybersecurity: Test Like a Hacker
Automotive Cybersecurity: Test Like a Hacker
ForAllSecure86 views
A Pragmatic Union: Security and SRE by James Wickett
A Pragmatic Union: Security and SREA Pragmatic Union: Security and SRE
A Pragmatic Union: Security and SRE
James Wickett229 views
1.3. (In)security Software by defconmoscow
1.3. (In)security Software1.3. (In)security Software
1.3. (In)security Software
defconmoscow432 views
Microsot Azure IoT Security for IoT ALGYAN Tech Seminar 2020/2/6 by Knowledge & Experience
Microsot Azure IoT Security for IoT ALGYAN Tech Seminar 2020/2/6Microsot Azure IoT Security for IoT ALGYAN Tech Seminar 2020/2/6
Microsot Azure IoT Security for IoT ALGYAN Tech Seminar 2020/2/6
13. Neville Varnham - PeopleSoft Cyber Security by Cedar Consulting
13. Neville Varnham - PeopleSoft Cyber Security13. Neville Varnham - PeopleSoft Cyber Security
13. Neville Varnham - PeopleSoft Cyber Security
Cedar Consulting334 views
Migrating_to_Cloud-Native_App_Architectures_Pivotal by Estevan McCalley
Migrating_to_Cloud-Native_App_Architectures_PivotalMigrating_to_Cloud-Native_App_Architectures_Pivotal
Migrating_to_Cloud-Native_App_Architectures_Pivotal
Estevan McCalley232 views
Migrating to cloud-native_app_architectures_pivotal by kkdlavak3
Migrating to cloud-native_app_architectures_pivotalMigrating to cloud-native_app_architectures_pivotal
Migrating to cloud-native_app_architectures_pivotal
kkdlavak3258 views
Migrating_to_Cloud-Native_App_Architectures_Pivotal (2) by Tim Kirby
Migrating_to_Cloud-Native_App_Architectures_Pivotal (2)Migrating_to_Cloud-Native_App_Architectures_Pivotal (2)
Migrating_to_Cloud-Native_App_Architectures_Pivotal (2)
Tim Kirby528 views
Migrating_to_Cloud-Native_App_Architectures_Pivotal (2) by Dean Bruckman
Migrating_to_Cloud-Native_App_Architectures_Pivotal (2)Migrating_to_Cloud-Native_App_Architectures_Pivotal (2)
Migrating_to_Cloud-Native_App_Architectures_Pivotal (2)
Dean Bruckman160 views
ThreatStack Workshop: Stop Wasting Your Time: Focus on Security Practices tha... by Amazon Web Services
ThreatStack Workshop: Stop Wasting Your Time: Focus on Security Practices tha...ThreatStack Workshop: Stop Wasting Your Time: Focus on Security Practices tha...
ThreatStack Workshop: Stop Wasting Your Time: Focus on Security Practices tha...
Building security from scratch by Roman Zelenko
Building security from scratchBuilding security from scratch
Building security from scratch
Roman Zelenko173 views
Layer 7 Technologies: Web Services Hacking And Hardening by CA API Management
Layer 7 Technologies: Web Services Hacking And HardeningLayer 7 Technologies: Web Services Hacking And Hardening
Layer 7 Technologies: Web Services Hacking And Hardening
CA API Management2.9K views
Common NonStop security hacks and how to avoid them by Greg Swedosh
Common NonStop security hacks and how to avoid themCommon NonStop security hacks and how to avoid them
Common NonStop security hacks and how to avoid them
Greg Swedosh507 views
Chapter 5 overview by ali raza
Chapter 5 overviewChapter 5 overview
Chapter 5 overview
ali raza678 views
85320337 networking-case-study by homeworkping3
85320337 networking-case-study85320337 networking-case-study
85320337 networking-case-study
homeworkping31.6K views
CISSP Certification- Security Engineering-part1 by Hamed Moghaddam
CISSP Certification- Security Engineering-part1CISSP Certification- Security Engineering-part1
CISSP Certification- Security Engineering-part1
Hamed Moghaddam691 views
Why the cloud is more secure than your existing systems by Ernest Mueller
Why the cloud is more secure than your existing systemsWhy the cloud is more secure than your existing systems
Why the cloud is more secure than your existing systems
Ernest Mueller2.3K views

More from Maarten Mulders

What's cooking in Maven? (Devoxx FR) by
What's cooking in Maven? (Devoxx FR)What's cooking in Maven? (Devoxx FR)
What's cooking in Maven? (Devoxx FR)Maarten Mulders
173 views25 slides
Making Maven Marvellous (Devnexus) by
Making Maven Marvellous (Devnexus)Making Maven Marvellous (Devnexus)
Making Maven Marvellous (Devnexus)Maarten Mulders
149 views13 slides
Making Maven Marvellous (Java.il) by
Making Maven Marvellous (Java.il)Making Maven Marvellous (Java.il)
Making Maven Marvellous (Java.il)Maarten Mulders
146 views13 slides
Making Maven Marvellous (JavaZone) by
Making Maven Marvellous (JavaZone)Making Maven Marvellous (JavaZone)
Making Maven Marvellous (JavaZone)Maarten Mulders
90 views13 slides
Dapr: Dinosaur or Developer's Dream? (v1) by
Dapr: Dinosaur or Developer's Dream? (v1)Dapr: Dinosaur or Developer's Dream? (v1)
Dapr: Dinosaur or Developer's Dream? (v1)Maarten Mulders
132 views42 slides
Dapr: Dinosaur or Developer Dream? (J-Fall) by
Dapr: Dinosaur or Developer Dream? (J-Fall)Dapr: Dinosaur or Developer Dream? (J-Fall)
Dapr: Dinosaur or Developer Dream? (J-Fall)Maarten Mulders
137 views42 slides

More from Maarten Mulders(20)

What's cooking in Maven? (Devoxx FR) by Maarten Mulders
What's cooking in Maven? (Devoxx FR)What's cooking in Maven? (Devoxx FR)
What's cooking in Maven? (Devoxx FR)
Maarten Mulders173 views
Making Maven Marvellous (Devnexus) by Maarten Mulders
Making Maven Marvellous (Devnexus)Making Maven Marvellous (Devnexus)
Making Maven Marvellous (Devnexus)
Maarten Mulders149 views
Making Maven Marvellous (Java.il) by Maarten Mulders
Making Maven Marvellous (Java.il)Making Maven Marvellous (Java.il)
Making Maven Marvellous (Java.il)
Maarten Mulders146 views
Dapr: Dinosaur or Developer's Dream? (v1) by Maarten Mulders
Dapr: Dinosaur or Developer's Dream? (v1)Dapr: Dinosaur or Developer's Dream? (v1)
Dapr: Dinosaur or Developer's Dream? (v1)
Maarten Mulders132 views
Dapr: Dinosaur or Developer Dream? (J-Fall) by Maarten Mulders
Dapr: Dinosaur or Developer Dream? (J-Fall)Dapr: Dinosaur or Developer Dream? (J-Fall)
Dapr: Dinosaur or Developer Dream? (J-Fall)
Maarten Mulders137 views
React in 40 minutes (Voxxed Days Romania) by Maarten Mulders
React in 40 minutes (Voxxed Days Romania) React in 40 minutes (Voxxed Days Romania)
React in 40 minutes (Voxxed Days Romania)
Maarten Mulders93 views
React in 50 minutes (Bucharest Software Craftsmanship Community) by Maarten Mulders
React in 50 minutes (Bucharest Software Craftsmanship Community)React in 50 minutes (Bucharest Software Craftsmanship Community)
React in 50 minutes (Bucharest Software Craftsmanship Community)
Maarten Mulders244 views
React in 50 Minutes (JNation) by Maarten Mulders
 React in 50 Minutes (JNation)  React in 50 Minutes (JNation)
React in 50 Minutes (JNation)
Maarten Mulders143 views
Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour) by Maarten Mulders
Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)
Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)
Maarten Mulders127 views
SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour) by Maarten Mulders
SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)
SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)
Maarten Mulders114 views
SSL/TLS for Mortals (UtrechtJUG) by Maarten Mulders
SSL/TLS for Mortals (UtrechtJUG)SSL/TLS for Mortals (UtrechtJUG)
SSL/TLS for Mortals (UtrechtJUG)
Maarten Mulders202 views
Building a DSL with GraalVM (javaBin online) by Maarten Mulders
Building a DSL with GraalVM (javaBin online)Building a DSL with GraalVM (javaBin online)
Building a DSL with GraalVM (javaBin online)
Maarten Mulders221 views
SSL/TLS for Mortals (Lockdown Lecture) by Maarten Mulders
SSL/TLS for Mortals (Lockdown Lecture)SSL/TLS for Mortals (Lockdown Lecture)
SSL/TLS for Mortals (Lockdown Lecture)
Maarten Mulders122 views
React in 50 Minutes (OpenValue) by Maarten Mulders
React in 50 Minutes (OpenValue) React in 50 Minutes (OpenValue)
React in 50 Minutes (OpenValue)
Maarten Mulders162 views
React in 50 Minutes (DevNexus) by Maarten Mulders
React in 50 Minutes (DevNexus) React in 50 Minutes (DevNexus)
React in 50 Minutes (DevNexus)
Maarten Mulders114 views

Recently uploaded

DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ... by
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...Deltares
10 views32 slides
SUGCON ANZ Presentation V2.1 Final.pptx by
SUGCON ANZ Presentation V2.1 Final.pptxSUGCON ANZ Presentation V2.1 Final.pptx
SUGCON ANZ Presentation V2.1 Final.pptxJack Spektor
22 views34 slides
Quality Engineer: A Day in the Life by
Quality Engineer: A Day in the LifeQuality Engineer: A Day in the Life
Quality Engineer: A Day in the LifeJohn Valentino
5 views18 slides
Fleet Management Software in India by
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India Fleetable
11 views1 slide
AI and Ml presentation .pptx by
AI and Ml presentation .pptxAI and Ml presentation .pptx
AI and Ml presentation .pptxFayazAli87
11 views15 slides
Airline Booking Software by
Airline Booking SoftwareAirline Booking Software
Airline Booking SoftwareSharmiMehta
5 views26 slides

Recently uploaded(20)

DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ... by Deltares
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
Deltares10 views
SUGCON ANZ Presentation V2.1 Final.pptx by Jack Spektor
SUGCON ANZ Presentation V2.1 Final.pptxSUGCON ANZ Presentation V2.1 Final.pptx
SUGCON ANZ Presentation V2.1 Final.pptx
Jack Spektor22 views
Quality Engineer: A Day in the Life by John Valentino
Quality Engineer: A Day in the LifeQuality Engineer: A Day in the Life
Quality Engineer: A Day in the Life
John Valentino5 views
Fleet Management Software in India by Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 views
AI and Ml presentation .pptx by FayazAli87
AI and Ml presentation .pptxAI and Ml presentation .pptx
AI and Ml presentation .pptx
FayazAli8711 views
Airline Booking Software by SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta5 views
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
Deltares17 views
Navigating container technology for enhanced security by Niklas Saari by Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy13 views
360 graden fabriek by info33492
360 graden fabriek360 graden fabriek
360 graden fabriek
info3349237 views
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the... by Deltares
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...
Deltares6 views
Copilot Prompting Toolkit_All Resources.pdf by Riccardo Zamana
Copilot Prompting Toolkit_All Resources.pdfCopilot Prompting Toolkit_All Resources.pdf
Copilot Prompting Toolkit_All Resources.pdf
Riccardo Zamana8 views
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... by Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri795 views
Dapr Unleashed: Accelerating Microservice Development by Miroslav Janeski
Dapr Unleashed: Accelerating Microservice DevelopmentDapr Unleashed: Accelerating Microservice Development
Dapr Unleashed: Accelerating Microservice Development
Miroslav Janeski10 views
Generic or specific? Making sensible software design decisions by Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... by Deltares
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
Deltares9 views

How to stay Responsive with 400 Backends (JVMCON)

  • 1. HOW TO STAYHOW TO STAY RESPONSIVE WITH 400RESPONSIVE WITH 400 BACKENDSBACKENDS @mthmulders
  • 2.  
  • 3.  
  • 4.  
  • 5. So, we need something that is...   Mobile First Scalable Secure   ... but ...   doesn't store insurance data retrieves that in real-time from ~ 400 different companies!
  • 6.  
  • 7.  
  • 8. START AS SIMPLE AS POSSIBLESTART AS SIMPLE AS POSSIBLE
  • 9. All problems in computer science can be solved by another abstraction layer. -- not David Wheeler (1927 - 2004)
  • 10. JUST MOVE THE PROBLEM AWAYJUST MOVE THE PROBLEM AWAY Main Systems Routing Engine Insurer 01 Insurer 02 Insurer 03   ....    Insurer nn
  • 11. FIRE UP YOUR IDE & START CODINGFIRE UP YOUR IDE & START CODING Standardized interface for retrieving insurance data. One endpoint address for each insurance company. Retrieve data using link code that includes insurer ID.   Shouldn't be too hard!
  • 12.  
  • 13.  
  • 14. YES, IT BREAKS...YES, IT BREAKS...
  • 15. NOT RELATED, BUTNOT RELATED, BUT ANALYSISANALYSIS Blocking network calls No time-outs   The whole JVM is waiting!   If an insurer is down, it will still be contacted. This will slow down the system even further.
  • 16. THE REACTIVE MANIFESTOTHE REACTIVE MANIFESTO
  • 17.  
  • 18. MESSAGE DRIVENMESSAGE DRIVEN Reactive Systems rely on asynchronous message-passing to establish a boundary between components that ensures loose coupling, isolation and location transparency.
  • 19. ELASTICELASTIC The system stays responsive under varying workload. Reactive Systems can react to changes in the input rate by increasing or decreasing the resources allocated to service these inputs.
  • 20. RESILIENTRESILIENT The system stays responsive in the face of failure. Failures are contained within each component, [...] thereby ensuring that parts of the system can fail and recover without compromising the system as a whole.
  • 21. RESPONSIVERESPONSIVE The system responds in a timely manner if at all possible. Responsiveness is the cornerstone of usability and utility [...]. Responsive systems focus on providing rapid and consistent response times [...].
  • 22. MEET... THE ACTOR MODELMEET... THE ACTOR MODEL
  • 23.  
  • 24.  
  • 25.  
  • 26.  
  • 27.  
  • 28.  
  • 29. THE CIRCUIT BREAKERTHE CIRCUIT BREAKER
  • 30. GIMME TEH CODEZ!GIMME TEH CODEZ!
  • 31. INITIATE RETRIEVAL WITH TIME-OUTINITIATE RETRIEVAL WITH TIME-OUT val actor = context.actorOf( ConsultInsurersActor.props(), s"consult-$berrfnr" ) actor ! RetrieveAllPolicyData(linkingCode) context.system.scheduler.scheduleOnce(2 seconds) { self ! RetrievalTimeout(berrfnr, linkingCodes) }
  • 32. CONSULT ONE INSURERCONSULT ONE INSURER // Send the request val request = HttpRequest(POST, Uri(url), Nil, entity) http ? request   // Receive the response response.entity.as[ResponseData] match { case Left(failure) => client ! Failure(failure) case Right(data) => client ! PolicyDataRetrieved(data) }
  • 33. CONSULT INSURER (WITH CIRCUIT BREAKER)CONSULT INSURER (WITH CIRCUIT BREAKER) val cb = new CircuitBreaker(system.scheduler, maxFailures = 5, callTimeout = 5 seconds, resetTimeout = 1 minute) // or obtain from config // Send the request val request = HttpRequest(POST, Uri(url), Nil, entity) cb.withCircuitBreaker(http ? request) pipeTo self
  • 34.  
  • 35.  
  • 36.  
  • 37.  
  • 38. KEY TAKEAWAYSKEY TAKEAWAYS Actor model enables building resilient solutions Suitable for large portions of concurrent work Think outside the box Log unexpected messages Use a whiteboard
  • 39. THANKS!THANKS! QUESTIONS?QUESTIONS? IMAGESIMAGES Insurance Policy by . "Success Kid" a.k.a Sammy Griner by . Blendtec founder/owner Tom Dickson by . Reactive Manifesto by . Actor Model by . Pictures of Money (Flickr) Laney Griner (Flickr) Tim Provost Wiljag Denekamp Wiljag Denekamp