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)
PPTX
Building Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
PPTX
Reactive Design Pattern
ODP
Reactive programming with scala and akka
PPT
Reactive programming with examples
PDF
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
PPTX
Reactive programming at scale
PDF
Moving towards Reactive Programming
PDF
Reactive meetup 0 copy
PDF
Reactive Architecture
PDF
Reactive Web-Applications @ LambdaDays
PDF
Reactive systems
PDF
A Journey to Reactive Function Programming
PDF
Reactive: Programming -> Systems -> Architecture
PPTX
Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
PDF
Take a Look at Akka+Java (English version)
PDF
The Reactive Manifesto: Message-driven, Resilient, Elastic, Responsive - Stef...
PDF
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems (Soft-Sha...
PPTX
Designing distributed systems
PPT
Reactive java programming for the impatient
Reactive Programming or Reactive Systems? (spoiler: both)
Building Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
Reactive Design Pattern
Reactive programming with scala and akka
Reactive programming with examples
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Reactive programming at scale
Moving towards Reactive Programming
Reactive meetup 0 copy
Reactive Architecture
Reactive Web-Applications @ LambdaDays
Reactive systems
A Journey to Reactive Function Programming
Reactive: Programming -> Systems -> Architecture
Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
Take a Look at Akka+Java (English version)
The Reactive Manifesto: Message-driven, Resilient, Elastic, Responsive - Stef...
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems (Soft-Sha...
Designing distributed systems
Reactive java programming for the impatient
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)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation theory and applications.pdf
PPT
Teaching material agriculture food technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Spectroscopy.pptx food analysis technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Cloud computing and distributed systems.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Machine learning based COVID-19 study performance prediction
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation theory and applications.pdf
Teaching material agriculture food technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Network Security Unit 5.pdf for BCA BBA.
Reach Out and Touch Someone: Haptics and Empathic Computing
Programs and apps: productivity, graphics, security and other tools
Spectroscopy.pptx food analysis technology
Advanced methodologies resolving dimensionality complications for autism neur...
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
“AI and Expert System Decision Support & Business Intelligence Systems”
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Unlocking AI with Model Context Protocol (MCP)
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MYSQL Presentation for SQL database connectivity
Machine learning based COVID-19 study performance prediction

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