SlideShare a Scribd company logo
HOW REACTIVE CAN YOU BE?
AMSTERDAM 16-17th MAY 2017
Beyond Fault Tolerance: Achieve
Resilience with Actor Programming
A little info about myself - Fabio Tiriticco
Tech Lead /
Software Architect
@ticofab
Reactive Amsterdam meetup
Reactive Amsterdam meetup
1. Reactive Programming
2. Reactive Systems
3. Reactive Programming vs Reactive Systems
4. Actor programming
5. Resilience through Actor Programming
Outline
1.
Reactive Programming
Reactive Programming & its benefits
1. Stream-like processing
2. Easy management of back pressure
3. Conciseness
4. Simplification of parallel / threaded work
“A paradigm where the logic is driven forward
by the availability of new information”
“As soon as there is new input, react to it”
The World is a Streaming Place
Many processes can be modelled as a stream.
The World is a Streaming Place
Many processes can be modelled as a stream.
The World is a Streaming Place
Many processes can be modelled as a stream.
The World is a Streaming Place
One challenge: different speed of producer and consumer
100 op/sec 10 op/sec
Backpressure
==
“Dear sender,
please slow down!”
Observable.from(myCats)
Reactive Programming example (RxJava on Android)
List<Cat> myCats;
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.filter(cat -> cat.isWhite())
.map(cat -> cat.fetchPicture())
.map(picture -> Filter.applyFilter(picture))
.subscribe(filteredPicture -> display(filteredPicture));
.onBackpressureBuffer(16)
1. Stream-like processing
2. Conciseness
3. Simplification of threaded work
4. Easy management of back pressure
2.
Reactive Systems
Goal
“Reactive Systems strive to increase productivity and make
sure that development and maintenance of components
reduce the accidental complexity to a minimum.”
the ability to react quickly
and appropriately to change
agility
əˈdʒɪlɪti/
Software Architect
increase productivity
facilitate development
facilitate maintenance
reduce accidental complexity
Company as whole
The Reactive Principles
Define a way of thinking about system architectures in a
modern and distributed environment. In a Reactive System,
the interaction between the parts makes the difference.
The Reactive Manifesto, 2013
A reactive computer system must Trait
React to its users Responsive
React to failure and stay available Resilient
React to varying load conditions Elastic
Its components must react to inputs Message-driven
Reactive System traits (the Reactive Manifesto)
J. Boner, R. Kuhn, D. Farley, M. Thompson - The Reactive Manifesto
3.
Reactive Programming
vs Reactive Systems
Reactive Programming vs Reactive Systems
What is Good for Applicability Productive for
Reactive
Programming
Implementation
technique
Asynchronous
dataflow
management
Single node or
service
Developers
Reactive Systems
Set of design
principles
Orchestration of
complex systems
The whole system
(from single node to
the total sum)
Architects
J. Boner, V. Klang - Reactive Programming vs Reactive Systems
From Principles to implementation
Reactive
Principles
Reactive
Patterns
Reactive
Tools
R. Roestemburg, R. Bakker, R. Williams - Akka in action
R. Kuhn, J. Allen, B. Hanafee - Reactive Design Patterns
Trait Business value
Runs on the JVM Very mature runtime + compatibility with everything written in Java
Higher level of abstraction
Lifting the level of abstraction has proven to be the most effective measure in
increasing the productivity of programmers.
Functional programming
Fosters reusability, composability, and it makes it easier to work in distributed,
scalable systems. Separation between side effects and business logic.
Encourages immutability Mutations are the most difficult thing to get right in distributed environments
Concise Less code means less bugs, faster understanding and faster innovation
Statically typed Compiler checks enable better performance, more testability and less bugs.
The best ecosystem for
data processing
No need to cobble together tooling of various kinds
Fun! Developers enjoy their work!
Why Scala?
Why Scala?
Scala:
class Person(val name: String, val surname: String)
Java:
public class Person {
private final String name;
private final String surname;
public Person(String name, String surname) {
this.name = name;
this.surname = surname;
}
public String getName() {
return this.name;
}
public String getSurname() {
return this.surname;
}
}
• less code
• thus simpler to understand
• thus less bugs
• thus less expensive
• and enables faster innovation
Why Scala?
D. Ghosh - Functional and
Reactive Domain Modeling
4.
Actor Programming
Simple Component Pattern
“One component should do only one thing but do it in
full. The aim is to maximise cohesion and minimise
coupling between components.”
Actor 1
Actor 3
Actor 2
• contains state &
behaviour logic
Actor model
Supervisor
Simple Component Pattern
• has a mailbox to
receive and send
messages
• has a supervisor
myActor3.getCounter()
2
2
The benefits of Asynchronous Messaging
• Separation between components
• Sender - receiver interaction
• Error containment - avoid chain failures
• Domain mapping closer to reality
Asynchronous messaging enables:Actor 1
Actor 3
Actor 2
Supervisor
2
2
Ping Pong Actor example
Pong
Actor
Ping
Actor
Ping
Pong(n)
5.
Achieve Resilience with
Actor Programming
Let it Crash Pattern
"Prefer a full component restart to
complex internal failure handling".
• failure conditions WILL occur
• they might be rare and hard to reproduce
• easier to start clean than to try to recover
Actor supervision example
Actor 1
Actor 2
Supervisor
WhateverException!
X
Restart
(doing something else…)(yay!)
Let it Crash Pattern
Scenario:
The machine is out of
coffee beans
Failure!
( not an error )
Let it Crash Pattern
Let it Crash Pattern
The CoffeeMachine, implemented
User
Coffee
Machine
Supervisor
Give Me Caffeine
Here is your coffee
1. Reactive Programming
2. Reactive Systems
3. Reactive Programming vs Reactive Systems
4. Actor programming
5. Resilience through Actor Programming
Recap
https://github.com/ticofab/ActorDemo
Thanks!
@ticofab
http://weeronline.nl
All pictures belong
to their respective authors

More Related Content

PDF
Microservices: 5 things I wish I'd known - Vincent Kok - Codemotion Amsterdam...
PDF
App engine ja night 9 beertalk2
PDF
Webinar: Queues with RabbitMQ - Lorna Mitchell
PDF
Introducing Apache Airflow and how we are using it
PPTX
Top 10 RxJs Operators in Angular
PDF
React Development with the MERN Stack
PDF
Kafka Summit NYC 2017 - The Source of Truth: Why the New York Times Stores Ev...
PPTX
Continuous deployment of Rails apps on AWS OpsWorks
Microservices: 5 things I wish I'd known - Vincent Kok - Codemotion Amsterdam...
App engine ja night 9 beertalk2
Webinar: Queues with RabbitMQ - Lorna Mitchell
Introducing Apache Airflow and how we are using it
Top 10 RxJs Operators in Angular
React Development with the MERN Stack
Kafka Summit NYC 2017 - The Source of Truth: Why the New York Times Stores Ev...
Continuous deployment of Rails apps on AWS OpsWorks

What's hot (20)

PDF
Building Robust Pipelines with Airflow
PDF
Gatling @ Scala.Io 2013
PPTX
Airflow at WePay
PDF
Writing Rust Command Line Applications
PDF
Cortex: Prometheus as a Service, One Year On
PPT
Rubyon Rails
PPTX
How fluentd fits into the modern software landscape
PPTX
Gobblin on-aws
PPTX
Apache Airflow Introduction
PDF
Monitoring kubernetes with prometheus
PDF
rx-java-presentation
PDF
Shipping & Visualize Your Data With ELK
PDF
Load test REST APIs using gatling
PPT
Super Fast Gevent Introduction
PPTX
Lifting the Blinds: Monitoring Windows Server 2012
PDF
Kafka Workshop
PPTX
Celery workshop
PDF
Introduce Flux & react in practices (KKBOX)
PDF
"Frameworks in 2015" Андрей Листочкин
PPTX
Intro to RxJS
Building Robust Pipelines with Airflow
Gatling @ Scala.Io 2013
Airflow at WePay
Writing Rust Command Line Applications
Cortex: Prometheus as a Service, One Year On
Rubyon Rails
How fluentd fits into the modern software landscape
Gobblin on-aws
Apache Airflow Introduction
Monitoring kubernetes with prometheus
rx-java-presentation
Shipping & Visualize Your Data With ELK
Load test REST APIs using gatling
Super Fast Gevent Introduction
Lifting the Blinds: Monitoring Windows Server 2012
Kafka Workshop
Celery workshop
Introduce Flux & react in practices (KKBOX)
"Frameworks in 2015" Андрей Листочкин
Intro to RxJS
Ad

Similar to Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion Amsterdam 2017 (20)

PDF
Reactive Programming or Reactive Systems? (spoiler: both)
PDF
Being Reactive with Spring
PPTX
Орхан Гасимов: "Reactive Applications in Java with Akka"
PDF
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
PPT
Reactive programming with examples
PPTX
Microservices Part 4: Functional Reactive Programming
PPTX
CQRS Evolved - CQRS + Akka.NET
PPTX
Developing Actors in Azure with .net
PPTX
Oop2011 actor presentation_stal
PDF
IPT High Performance Reactive Java BGOUG 2016
PDF
Reactive Applications with Apache Pulsar and Spring Boot
PDF
Actor model in F# and Akka.NET
PPTX
CrawlerLD - Distributed crawler for linked data
PPTX
Functional reactive programming
PPTX
What’s expected in Spring 5
PPTX
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
PPTX
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
PPTX
Reactive programming intro
PPTX
Reactiveness All The Way - SW Architecture 2015 Conference
PPTX
Life & Work of Butler Lampson | Turing100@Persistent
Reactive Programming or Reactive Systems? (spoiler: both)
Being Reactive with Spring
Орхан Гасимов: "Reactive Applications in Java with Akka"
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive programming with examples
Microservices Part 4: Functional Reactive Programming
CQRS Evolved - CQRS + Akka.NET
Developing Actors in Azure with .net
Oop2011 actor presentation_stal
IPT High Performance Reactive Java BGOUG 2016
Reactive Applications with Apache Pulsar and Spring Boot
Actor model in F# and Akka.NET
CrawlerLD - Distributed crawler for linked data
Functional reactive programming
What’s expected in Spring 5
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
Reactive programming intro
Reactiveness All The Way - SW Architecture 2015 Conference
Life & Work of Butler Lampson | Turing100@Persistent
Ad

More from Codemotion (20)

PDF
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
PDF
Pompili - From hero to_zero: The FatalNoise neverending story
PPTX
Pastore - Commodore 65 - La storia
PPTX
Pennisi - Essere Richard Altwasser
PPTX
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
PPTX
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
PPTX
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
PPTX
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
PDF
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
PDF
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
PDF
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
PDF
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
PDF
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
PDF
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
PPTX
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
PPTX
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
PDF
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
PDF
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
PDF
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
PDF
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Pompili - From hero to_zero: The FatalNoise neverending story
Pastore - Commodore 65 - La storia
Pennisi - Essere Richard Altwasser
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Empathic Computing: Creating Shared Understanding
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Cloud computing and distributed systems.
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
sap open course for s4hana steps from ECC to s4
“AI and Expert System Decision Support & Business Intelligence Systems”
Empathic Computing: Creating Shared Understanding
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Chapter 3 Spatial Domain Image Processing.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
Programs and apps: productivity, graphics, security and other tools
Spectroscopy.pptx food analysis technology
Cloud computing and distributed systems.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Unlocking AI with Model Context Protocol (MCP)
Understanding_Digital_Forensics_Presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Reach Out and Touch Someone: Haptics and Empathic Computing
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Weekly Chronicles - August'25 Week I
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
sap open course for s4hana steps from ECC to s4

Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion Amsterdam 2017

  • 1. HOW REACTIVE CAN YOU BE? AMSTERDAM 16-17th MAY 2017 Beyond Fault Tolerance: Achieve Resilience with Actor Programming
  • 2. A little info about myself - Fabio Tiriticco Tech Lead / Software Architect @ticofab
  • 5. 1. Reactive Programming 2. Reactive Systems 3. Reactive Programming vs Reactive Systems 4. Actor programming 5. Resilience through Actor Programming Outline
  • 7. Reactive Programming & its benefits 1. Stream-like processing 2. Easy management of back pressure 3. Conciseness 4. Simplification of parallel / threaded work “A paradigm where the logic is driven forward by the availability of new information” “As soon as there is new input, react to it”
  • 8. The World is a Streaming Place Many processes can be modelled as a stream.
  • 9. The World is a Streaming Place Many processes can be modelled as a stream.
  • 10. The World is a Streaming Place Many processes can be modelled as a stream.
  • 11. The World is a Streaming Place
  • 12. One challenge: different speed of producer and consumer 100 op/sec 10 op/sec Backpressure == “Dear sender, please slow down!”
  • 13. Observable.from(myCats) Reactive Programming example (RxJava on Android) List<Cat> myCats; .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .filter(cat -> cat.isWhite()) .map(cat -> cat.fetchPicture()) .map(picture -> Filter.applyFilter(picture)) .subscribe(filteredPicture -> display(filteredPicture)); .onBackpressureBuffer(16) 1. Stream-like processing 2. Conciseness 3. Simplification of threaded work 4. Easy management of back pressure
  • 15. Goal “Reactive Systems strive to increase productivity and make sure that development and maintenance of components reduce the accidental complexity to a minimum.” the ability to react quickly and appropriately to change agility əˈdʒɪlɪti/ Software Architect increase productivity facilitate development facilitate maintenance reduce accidental complexity Company as whole
  • 16. The Reactive Principles Define a way of thinking about system architectures in a modern and distributed environment. In a Reactive System, the interaction between the parts makes the difference.
  • 17. The Reactive Manifesto, 2013 A reactive computer system must Trait React to its users Responsive React to failure and stay available Resilient React to varying load conditions Elastic Its components must react to inputs Message-driven
  • 18. Reactive System traits (the Reactive Manifesto) J. Boner, R. Kuhn, D. Farley, M. Thompson - The Reactive Manifesto
  • 20. Reactive Programming vs Reactive Systems What is Good for Applicability Productive for Reactive Programming Implementation technique Asynchronous dataflow management Single node or service Developers Reactive Systems Set of design principles Orchestration of complex systems The whole system (from single node to the total sum) Architects J. Boner, V. Klang - Reactive Programming vs Reactive Systems
  • 21. From Principles to implementation Reactive Principles Reactive Patterns Reactive Tools R. Roestemburg, R. Bakker, R. Williams - Akka in action R. Kuhn, J. Allen, B. Hanafee - Reactive Design Patterns
  • 22. Trait Business value Runs on the JVM Very mature runtime + compatibility with everything written in Java Higher level of abstraction Lifting the level of abstraction has proven to be the most effective measure in increasing the productivity of programmers. Functional programming Fosters reusability, composability, and it makes it easier to work in distributed, scalable systems. Separation between side effects and business logic. Encourages immutability Mutations are the most difficult thing to get right in distributed environments Concise Less code means less bugs, faster understanding and faster innovation Statically typed Compiler checks enable better performance, more testability and less bugs. The best ecosystem for data processing No need to cobble together tooling of various kinds Fun! Developers enjoy their work! Why Scala?
  • 23. Why Scala? Scala: class Person(val name: String, val surname: String) Java: public class Person { private final String name; private final String surname; public Person(String name, String surname) { this.name = name; this.surname = surname; } public String getName() { return this.name; } public String getSurname() { return this.surname; } } • less code • thus simpler to understand • thus less bugs • thus less expensive • and enables faster innovation
  • 24. Why Scala? D. Ghosh - Functional and Reactive Domain Modeling
  • 26. Simple Component Pattern “One component should do only one thing but do it in full. The aim is to maximise cohesion and minimise coupling between components.”
  • 27. Actor 1 Actor 3 Actor 2 • contains state & behaviour logic Actor model Supervisor Simple Component Pattern • has a mailbox to receive and send messages • has a supervisor myActor3.getCounter() 2 2
  • 28. The benefits of Asynchronous Messaging • Separation between components • Sender - receiver interaction • Error containment - avoid chain failures • Domain mapping closer to reality Asynchronous messaging enables:Actor 1 Actor 3 Actor 2 Supervisor 2 2
  • 29. Ping Pong Actor example Pong Actor Ping Actor Ping Pong(n)
  • 31. Let it Crash Pattern "Prefer a full component restart to complex internal failure handling". • failure conditions WILL occur • they might be rare and hard to reproduce • easier to start clean than to try to recover
  • 32. Actor supervision example Actor 1 Actor 2 Supervisor WhateverException! X Restart (doing something else…)(yay!) Let it Crash Pattern
  • 33. Scenario: The machine is out of coffee beans Failure! ( not an error ) Let it Crash Pattern
  • 34. Let it Crash Pattern
  • 36. 1. Reactive Programming 2. Reactive Systems 3. Reactive Programming vs Reactive Systems 4. Actor programming 5. Resilience through Actor Programming Recap https://github.com/ticofab/ActorDemo