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
F# and SignalR for a FastWeb
KEY
The Joy Of Functional Programming
PDF
Let it crash! The Erlang Approach to Building Reliable Services
PPTX
Introduction to actor model with examples on Akka.NET
PPTX
Net Scheme English Version
PPTX
Reactiveness All The Way - SW Architecture 2015 Conference
PDF
FME World Tour 2015 Dublin - Waterford City and County Council - Jon Hawkins
PDF
You Used To Inject Me In Your Constructor
F# and SignalR for a FastWeb
The Joy Of Functional Programming
Let it crash! The Erlang Approach to Building Reliable Services
Introduction to actor model with examples on Akka.NET
Net Scheme English Version
Reactiveness All The Way - SW Architecture 2015 Conference
FME World Tour 2015 Dublin - Waterford City and County Council - Jon Hawkins
You Used To Inject Me In Your Constructor

Similar to Beyond Fault Tolerance with Actor Programming (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
Life & Work of Butler Lampson | Turing100@Persistent
PPTX
Being Elastic -- Evolving Programming for the Cloud
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
Life & Work of Butler Lampson | Turing100@Persistent
Being Elastic -- Evolving Programming for the Cloud
Ad

More from Fabio Tiriticco (12)

PDF
Intro slides - Global Reactive Meetup - Move over JDBC!
PDF
Planespotting - From Zero To Deep Learning
PDF
From Zero To Deep Learning With Scala
PDF
Reactive Amsterdam - Maxim Burgerhout - Quarkus Intro
PDF
Ten Frustrations From The Community Trenches (And How To Deal With Them)
PDF
We all need friends and Akka just found Kubernetes
PDF
Cloud native akka and kubernetes holy grail to elasticity
PDF
Reactive Summit 2017 Highlights!
PDF
Akka Streams at Weeronline
PDF
Reactive in Android and Beyond Rx
PDF
Reactive Android: RxJava and beyond
PDF
WebSockets wiith Scala and Play! Framework
Intro slides - Global Reactive Meetup - Move over JDBC!
Planespotting - From Zero To Deep Learning
From Zero To Deep Learning With Scala
Reactive Amsterdam - Maxim Burgerhout - Quarkus Intro
Ten Frustrations From The Community Trenches (And How To Deal With Them)
We all need friends and Akka just found Kubernetes
Cloud native akka and kubernetes holy grail to elasticity
Reactive Summit 2017 Highlights!
Akka Streams at Weeronline
Reactive in Android and Beyond Rx
Reactive Android: RxJava and beyond
WebSockets wiith Scala and Play! Framework
Ad

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
cuic standard and advanced reporting.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Machine Learning_overview_presentation.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Assigned Numbers - 2025 - Bluetooth® Document
“AI and Expert System Decision Support & Business Intelligence Systems”
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Dropbox Q2 2025 Financial Results & Investor Presentation
cuic standard and advanced reporting.pdf
Approach and Philosophy of On baking technology
Per capita expenditure prediction using model stacking based on satellite ima...
MIND Revenue Release Quarter 2 2025 Press Release
Big Data Technologies - Introduction.pptx
Machine Learning_overview_presentation.pptx
A comparative analysis of optical character recognition models for extracting...
Network Security Unit 5.pdf for BCA BBA.
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Assigned Numbers - 2025 - Bluetooth® Document

Beyond Fault Tolerance with Actor Programming

  • 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