SlideShare a Scribd company logo
1 of 42
Download to read offline
Go Reactive 
Event-Driven, Scalable, Resilient & Responsive Systems 
Mirco Dotta 
@mircodotta
The Four Reactive Traits 
Reactive 
Applications 
2 
http://reactivemanifesto.org/
Starting Point: 
The User
The User browser
browser 
frontend 
server 
internal 
service storage 
internal 
service 
DB 
external 
service
Responsiveness 
! 
always available 
interactive 
(near) real-time
Bounded Latency 
6
Bounded Latency 
• fan-out in parallel and aggregate 
6
Bounded Latency 
• fan-out in parallel and aggregate 
6 
A B C
Bounded Latency 
• fan-out in parallel and aggregate 
6 
A 
B 
C
Bounded Latency 
• fan-out in parallel and aggregate 
6 
A 
B 
C 
e
Bounded Latency 
• fan-out in parallel and aggregate 
• use circuit breakers for graceful degradation 
7
Bounded Latency 
• fan-out in parallel and aggregate 
• use circuit breakers for graceful degradation 
7 
do work 
fail fast
Bounded Latency 
• fan-out in parallel and aggregate 
• use circuit breakers for graceful degradation 
• use bounded queues, measure flow rates 
8
Bounded Latency 
• fan-out in parallel and aggregate 
• use circuit breakers for graceful degradation 
• use bounded queues, measure flow rates 
8 
Use Bounded Queues: 
! 
Latency = QueueLength • ProcessingTime 
! 
(for reasonably stable average processing time)
Bounded Latency 
• fan-out in parallel and aggregate 
• use circuit breakers for graceful degradation 
• use bounded queues, measure flow rates 
8 
Use Bounded Queues: 
! 
Latency = QueueLength • ProcessingTime 
! 
(for reasonably stable average processing time) 
m
Resilience 
! 
Responsive in the Face of Failure
Handle Failure 
• software will fail 
• hardware will fail 
• humans will fail 
• system still needs to respond ➟ resilience 
10
Distribute! 
11
Asynchronous Failure 
• parallel fan-out & distribution 
➟ asynchronous execution 
• compartmentalization & isolation 
• no response? ➟ timeout events 
• someone else’s exception? ➟ supervision 
12
Asynchronous Failure 
• parallel fan-out & distribution 
➟ asynchronous execution 
• compartmentalization & isolation 
• no response? ➟ timeout events 
• someone else’s exception? ➟ supervision 
12
Asynchronous Failure 
• parallel fan-out & distribution 
➟ asynchronous execution 
• compartmentalization & isolation 
• no response? ➟ timeout events 
• someone else’s exception? ➟ supervision 
12 
Request 
Response 
Failure
Asynchronous Failure 
• parallel fan-out & distribution 
➟ asynchronous execution 
driven 
message-• compartmentalization & isolation 
• no response? ➟ timeout events 
• someone else’s exception? ➟ supervision 
12 
Request 
Response 
Failure
Asynchronous Failure 
• parallel fan-out & distribution 
➟ asynchronous execution 
• compartmentalization & isolation 
• no response? ➟ timeout events 
• someone else’s exception? ➟ supervision 
• location transparency ➟ seamless resilience 
12
Elasticity 
! 
Responsive in the Face of Changing Load
Handle Load 
14
Handle Load 
14
Handle Load 
• partition incoming work for distribution 
• share nothing 
• scale capacity up and down on demand 
• supervise and adapt 
• location transparency 
➟ seamless scalability 
14
Handle Load 
• partition incoming work for distribution 
• share nothing 
• scale capacity up and down on demand 
• supervise and adapt 
• location transparency 
➟ seamless scalability 
14 
m
… this has some interesting consequences!
Consequences 
• distribution & scalability 
➟ loss of strong consistency 
• CAP theorem? — not as relevant as you think 
• eventual consistency 
➟ gossip, heartbeats, dissemination of change 
! 
16
Consequences 
• distribution & scalability 
➟ loss of strong consistency 
• CAP theorem? — not as relevant as you think 
• eventual consistency 
➟ gossip, heartbeats, dissemination of change 
! 
16 
m
Corollary 
• Reactive needs to be applied all the way down 
17
But what about us, 
the developers?
Step 1: Take a Leap of Faith 
• thread-based models have made us defensive 
• “don’t let go of your thread!” 
• “asynchrony is suspicious” 
• “better return strict value, even if that needs blocking” 
19
Step 1: Take a Leap of Faith 
• thread-based models have made us defensive 
• “don’t let go of your thread!” 
• “asynchrony is suspicious” 
• “better return strict value, even if that needs blocking” 
• it is okay to write a method that returns a Future! 
19
Step 2: Rethink the Architecture 
• break out of the synchronous blocking prison 
• focus on communication & protocols 
• asynchronous program flow 
➟ no step-through debugging 
➟ tracing and monitoring 
• loose coupling 
20
Step 3: Profit! 
• clean business logic, 
separate from failure handling 
• distributable units of work 
• effortless parallelization 
21
Step 3: Profit! 
• clean business logic, 
separate from failure handling 
• distributable units of work 
• effortless parallelization 
• less assumptions ➟ lower maintenance cost 
21
Summary
The Four Reactive Traits 
Reactive 
Applications 
23 
http://reactivemanifesto.org/
All credit for this great slidedeck goes to Roland Kuhn (@rolandkuhn), 
while any inaccuracy is mine. 
©Typesafe 2014 – All Rights Reserved

More Related Content

Similar to Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems (Soft-Shake 2014)

Building a Smarter Application Stack
Building a Smarter Application StackBuilding a Smarter Application Stack
Building a Smarter Application Stack
Docker, Inc.
 
Tiger oracle
Tiger oracleTiger oracle
Tiger oracle
d0nn9n
 

Similar to Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems (Soft-Shake 2014) (20)

What is Reactive programming?
What is Reactive programming?What is Reactive programming?
What is Reactive programming?
 
Building Highly Available Apps on Cassandra (Robbie Strickland, Weather Compa...
Building Highly Available Apps on Cassandra (Robbie Strickland, Weather Compa...Building Highly Available Apps on Cassandra (Robbie Strickland, Weather Compa...
Building Highly Available Apps on Cassandra (Robbie Strickland, Weather Compa...
 
Working With Concurrency In Java 8
Working With Concurrency In Java 8Working With Concurrency In Java 8
Working With Concurrency In Java 8
 
Go Reactive: Building Responsive, Resilient, Elastic & Message-Driven Systems
Go Reactive: Building Responsive, Resilient, Elastic & Message-Driven SystemsGo Reactive: Building Responsive, Resilient, Elastic & Message-Driven Systems
Go Reactive: Building Responsive, Resilient, Elastic & Message-Driven Systems
 
CAP Theorem - Theory, Implications and Practices
CAP Theorem - Theory, Implications and PracticesCAP Theorem - Theory, Implications and Practices
CAP Theorem - Theory, Implications and Practices
 
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of SimplicityLarge Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
 
Building a smarter application stack - service discovery and wiring for Docker
Building a smarter application stack - service discovery and wiring for DockerBuilding a smarter application stack - service discovery and wiring for Docker
Building a smarter application stack - service discovery and wiring for Docker
 
Building a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from YelpBuilding a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from Yelp
 
Building a Smarter Application Stack
Building a Smarter Application StackBuilding a Smarter Application Stack
Building a Smarter Application Stack
 
Object-oriented design principles
Object-oriented design principlesObject-oriented design principles
Object-oriented design principles
 
Building on quicksand microservices indicthreads
Building on quicksand microservices  indicthreadsBuilding on quicksand microservices  indicthreads
Building on quicksand microservices indicthreads
 
Fault tolerant presentation
Fault tolerant presentationFault tolerant presentation
Fault tolerant presentation
 
Designing Fault Tolerant Microservices
Designing Fault Tolerant MicroservicesDesigning Fault Tolerant Microservices
Designing Fault Tolerant Microservices
 
Fault Tolerance in Distributed Environment
Fault Tolerance in Distributed EnvironmentFault Tolerance in Distributed Environment
Fault Tolerance in Distributed Environment
 
Parallel programming in .NET
Parallel programming in .NETParallel programming in .NET
Parallel programming in .NET
 
Scaling Your Architecture for the Long Term
Scaling Your Architecture for the Long TermScaling Your Architecture for the Long Term
Scaling Your Architecture for the Long Term
 
Design for Scale / Surge 2010
Design for Scale / Surge 2010Design for Scale / Surge 2010
Design for Scale / Surge 2010
 
Patterns of Distributed Application Design
Patterns of Distributed Application DesignPatterns of Distributed Application Design
Patterns of Distributed Application Design
 
MongoDB World 2018: Tutorial - MongoDB Meets Chaos Monkey
MongoDB World 2018: Tutorial - MongoDB Meets Chaos MonkeyMongoDB World 2018: Tutorial - MongoDB Meets Chaos Monkey
MongoDB World 2018: Tutorial - MongoDB Meets Chaos Monkey
 
Tiger oracle
Tiger oracleTiger oracle
Tiger oracle
 

More from mircodotta

Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)
mircodotta
 
Effective Scala (SoftShake 2013)
Effective Scala (SoftShake 2013)Effective Scala (SoftShake 2013)
Effective Scala (SoftShake 2013)
mircodotta
 
Scala: Simplifying Development
Scala: Simplifying DevelopmentScala: Simplifying Development
Scala: Simplifying Development
mircodotta
 

More from mircodotta (10)

Scala Past, Present & Future
Scala Past, Present & FutureScala Past, Present & Future
Scala Past, Present & Future
 
Lightbend Lagom: Microservices Just Right (Scala Days 2016 Berlin)
Lightbend Lagom: Microservices Just Right (Scala Days 2016 Berlin)Lightbend Lagom: Microservices Just Right (Scala Days 2016 Berlin)
Lightbend Lagom: Microservices Just Right (Scala Days 2016 Berlin)
 
Lightbend Lagom: Microservices Just Right
Lightbend Lagom: Microservices Just RightLightbend Lagom: Microservices Just Right
Lightbend Lagom: Microservices Just Right
 
Akka streams scala italy2015
Akka streams scala italy2015Akka streams scala italy2015
Akka streams scala italy2015
 
Akka streams
Akka streamsAkka streams
Akka streams
 
Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)
 
Effective Scala (SoftShake 2013)
Effective Scala (SoftShake 2013)Effective Scala (SoftShake 2013)
Effective Scala (SoftShake 2013)
 
Scala: Simplifying Development
Scala: Simplifying DevelopmentScala: Simplifying Development
Scala: Simplifying Development
 
Managing Binary Compatibility in Scala (Scala Lift Off 2011)
Managing Binary Compatibility in Scala (Scala Lift Off 2011)Managing Binary Compatibility in Scala (Scala Lift Off 2011)
Managing Binary Compatibility in Scala (Scala Lift Off 2011)
 
Managing Binary Compatibility in Scala (Scala Days 2011)
Managing Binary Compatibility in Scala (Scala Days 2011)Managing Binary Compatibility in Scala (Scala Days 2011)
Managing Binary Compatibility in Scala (Scala Days 2011)
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems (Soft-Shake 2014)

  • 1. Go Reactive Event-Driven, Scalable, Resilient & Responsive Systems Mirco Dotta @mircodotta
  • 2. The Four Reactive Traits Reactive Applications 2 http://reactivemanifesto.org/
  • 5. browser frontend server internal service storage internal service DB external service
  • 6. Responsiveness ! always available interactive (near) real-time
  • 8. Bounded Latency • fan-out in parallel and aggregate 6
  • 9. Bounded Latency • fan-out in parallel and aggregate 6 A B C
  • 10. Bounded Latency • fan-out in parallel and aggregate 6 A B C
  • 11. Bounded Latency • fan-out in parallel and aggregate 6 A B C e
  • 12. Bounded Latency • fan-out in parallel and aggregate • use circuit breakers for graceful degradation 7
  • 13. Bounded Latency • fan-out in parallel and aggregate • use circuit breakers for graceful degradation 7 do work fail fast
  • 14. Bounded Latency • fan-out in parallel and aggregate • use circuit breakers for graceful degradation • use bounded queues, measure flow rates 8
  • 15. Bounded Latency • fan-out in parallel and aggregate • use circuit breakers for graceful degradation • use bounded queues, measure flow rates 8 Use Bounded Queues: ! Latency = QueueLength • ProcessingTime ! (for reasonably stable average processing time)
  • 16. Bounded Latency • fan-out in parallel and aggregate • use circuit breakers for graceful degradation • use bounded queues, measure flow rates 8 Use Bounded Queues: ! Latency = QueueLength • ProcessingTime ! (for reasonably stable average processing time) m
  • 17. Resilience ! Responsive in the Face of Failure
  • 18. Handle Failure • software will fail • hardware will fail • humans will fail • system still needs to respond ➟ resilience 10
  • 20. Asynchronous Failure • parallel fan-out & distribution ➟ asynchronous execution • compartmentalization & isolation • no response? ➟ timeout events • someone else’s exception? ➟ supervision 12
  • 21. Asynchronous Failure • parallel fan-out & distribution ➟ asynchronous execution • compartmentalization & isolation • no response? ➟ timeout events • someone else’s exception? ➟ supervision 12
  • 22. Asynchronous Failure • parallel fan-out & distribution ➟ asynchronous execution • compartmentalization & isolation • no response? ➟ timeout events • someone else’s exception? ➟ supervision 12 Request Response Failure
  • 23. Asynchronous Failure • parallel fan-out & distribution ➟ asynchronous execution driven message-• compartmentalization & isolation • no response? ➟ timeout events • someone else’s exception? ➟ supervision 12 Request Response Failure
  • 24. Asynchronous Failure • parallel fan-out & distribution ➟ asynchronous execution • compartmentalization & isolation • no response? ➟ timeout events • someone else’s exception? ➟ supervision • location transparency ➟ seamless resilience 12
  • 25. Elasticity ! Responsive in the Face of Changing Load
  • 28. Handle Load • partition incoming work for distribution • share nothing • scale capacity up and down on demand • supervise and adapt • location transparency ➟ seamless scalability 14
  • 29. Handle Load • partition incoming work for distribution • share nothing • scale capacity up and down on demand • supervise and adapt • location transparency ➟ seamless scalability 14 m
  • 30. … this has some interesting consequences!
  • 31. Consequences • distribution & scalability ➟ loss of strong consistency • CAP theorem? — not as relevant as you think • eventual consistency ➟ gossip, heartbeats, dissemination of change ! 16
  • 32. Consequences • distribution & scalability ➟ loss of strong consistency • CAP theorem? — not as relevant as you think • eventual consistency ➟ gossip, heartbeats, dissemination of change ! 16 m
  • 33. Corollary • Reactive needs to be applied all the way down 17
  • 34. But what about us, the developers?
  • 35. Step 1: Take a Leap of Faith • thread-based models have made us defensive • “don’t let go of your thread!” • “asynchrony is suspicious” • “better return strict value, even if that needs blocking” 19
  • 36. Step 1: Take a Leap of Faith • thread-based models have made us defensive • “don’t let go of your thread!” • “asynchrony is suspicious” • “better return strict value, even if that needs blocking” • it is okay to write a method that returns a Future! 19
  • 37. Step 2: Rethink the Architecture • break out of the synchronous blocking prison • focus on communication & protocols • asynchronous program flow ➟ no step-through debugging ➟ tracing and monitoring • loose coupling 20
  • 38. Step 3: Profit! • clean business logic, separate from failure handling • distributable units of work • effortless parallelization 21
  • 39. Step 3: Profit! • clean business logic, separate from failure handling • distributable units of work • effortless parallelization • less assumptions ➟ lower maintenance cost 21
  • 41. The Four Reactive Traits Reactive Applications 23 http://reactivemanifesto.org/
  • 42. All credit for this great slidedeck goes to Roland Kuhn (@rolandkuhn), while any inaccuracy is mine. ©Typesafe 2014 – All Rights Reserved