SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
Reactive MicroServices
Leveraging Reactive principles
in a technology agnostic way
Lorenzo Nicora
Senior Consultant @ OpenCredo
@nicusX
https://opencredo.com/author/lorenzo
“Reactive” is…
Reactive
Semantically overloaded term
adj. “Readily responsive to stimulus” [Merrian-Webster dictionary]
From Latin “reagere”: act in return
Lorenzo Nicora Reactive μServices
Reactive as…
Reactive as
Reactive Manifesto
Lorenzo Nicora Reactive μServices
Reactive Manifesto
Lorenzo Nicora Reactive μServices
ü Responsive à Low latency
ü Resilient à Stay responsive on failure
ü Elastic à Scale as needed
ü Message-Driven à Asynchronous messages
as only communication between components
Simplifying
Lorenzo Nicora Reactive μServices
✗ No Blocking operation
✗ No Synchronization à No Contention
✗ No Resource hogging
Reactive Manifesto promotes
Decoupling and isolation in…
üTime à Concurrent processing
üSpace à Components location decoupling
Lorenzo Nicora Reactive μServices
Reactive as..
Akka Spring Boot
a set of
Architectural
Patterns and Principles
Not necessarily
related to
a specific technology
a set of technologies
Lorenzo Nicora Reactive μServices
A set of architectural patterns and principles
applicable to MicroServices
ü Non-blocking processing
ü Message-based communication
ü Asynchronous delegation
ü Resilience: Isolation & Replication; Backpressure
ü Elasticity
ü Location transparency
Reactive as Architectural Patterns
Lorenzo Nicora Reactive μServices
a MicroService is..
• Communicate with others over the network
• Part of a distributed system
• Independently deployed
• Independently scalable
MicroServices
Lorenzo Nicora Reactive μServices
Macro level
at μService boundaries
Between Services; external resources
Across the MicroService Stack
Micro level
within the μService
Between internal components
Lorenzo Nicora Reactive μServices
Do not block threads
Never block a thread
doing nothing and
waiting for
an Input or a Response
Threads are limited resources
(Thread starving)
(React to Input / Response)
Lorenzo Nicora Reactive μServices
Non-blocking à Faster
Lorenzo Nicora Reactive μServices
Non-blocking Communication
Macro (at service boundaries)
✗ Limit Request/Response pattern
üOne-way messaging (fire and forget)
üPrefer messaging protocols rather than HTTP
Non-blocking
Lorenzo Nicora Reactive μServices
Non-blocking Communication and IO
Micro (within the Service)
✗ Limit blocking/direct method calls
üFutures, Promises, Callbacks
üInternal messaging (e.g. Actor model)
üNon-blocking IO and drivers
Non-blocking
Lorenzo Nicora Reactive μServices
Non-blocking + Blocking = Blocking
✗ Many resources only provide blocking API
• Prefer technologies with non-blocking API
✗ Do not block on a Future…
• To extract the result
• To handle exceptions
❗ Know where your thread come from
• Thread pools
Non-blocking pitfalls
Lorenzo Nicora Reactive μServices
Delegation
* External components
Delegate a task asynchronously
to other components*
Macro (at Service boundaries)
o Delegate tasks to other μServices
o Send Request as a Message
o When required, Response come back as a Message
Lorenzo Nicora Reactive μServices
Delegation
* Internal component
Delegate a task asynchronously
to other components*
Micro (within the Service)
o Execute sub-tasks in separate threads
• Futures/Promises, Callbacks…
o Run multiple tasks in parallel
Lorenzo Nicora Reactive μServices
Parallel Delegation
Lorenzo Nicora Reactive μServices
Resilience:
Stay responsive in face of failure
Resilience
Design expecting failure
Failure
happens!
Fail-Safe
Lorenzo Nicora Reactive μServices
• Failure (e.g. connection failure, timeout…)
• Unexpected event
• Not recoverable
• No meaningful response to your client
• Error (e.g. user input error)
• Expected condition
• A specific response to the client (your protocol)
Failure ≠ Error
Lorenzo Nicora Reactive μServices
Resilience: Isolation + Replication
Resilience à Isolation + Replication
Macro
o Deployment Isolation
o Bulkheads
• Prevent cascading failures
• Neither to peer services, nor upstream/downstream
Lorenzo Nicora Reactive μServices
Resilience à Isolation + Replication
o Replication
• Legacy (always valid) HA approach
• Multiple peer services
• Data Replication
Resilience: Isolation + Replication
Lorenzo Nicora Reactive μServices
Fail silent; Fail fast
then Recover, when possible
o Prevent cascading failures
o Isolate failing collaborators
• Downstream μServices
• External services
• Resources (DB…)
Resilience: Circuit Breakers
Lorenzo Nicora Reactive μServices
Expect Failure…
Resilience: Handle failure
… Handle Failure
Lorenzo Nicora Reactive μServices
Handle
Errors and Failures
separately
Consistently report Errors to your client
Error is part of your “protocol” (business logic)
Gracefully degrade on Failure
Avoid ”All or nothing” logic
à Partial Responses
Handling Failure
Lorenzo Nicora Reactive μServices
Explicitly set and handle timeouts
on every asynchronous interaction
Never rely on default
settings and handling
for timeouts
Timeouts - Failures
When collaboration is asynchronous (messaging)
a Failure becomes a Time-out
Lorenzo Nicora Reactive μServices
Prevent fast publishers
from overrunning slow consumers
✗ Drop messages (acceptable?)
✗ Cause catastrophic cascade failures
Back-pressure
Lorenzo Nicora Reactive μServices
Buffers overflow!
and will not save you
Back-pressure
à Backpressure
Consumer…
ü Give feedback to publisher
ü Drive the pace
Lorenzo Nicora Reactive μServices
Ability to scale when required
Macro
ü Scale services and resources
• Add/Remove VM, Container, Cluster nodes
❗ Scaling data (application state)
• Only Partitioning, Sharding
Elasticity
Scaling: an infrastructure concern,
but application must be designed for it
Lorenzo Nicora Reactive μServices
Your collaborator may be anywhere
Local or Remote
Architecture may evolve
Local à Remote
“There ain’t no such thing as a
transparent synchronous remotisation”
Async Messaging work the same local and remote
Location Transparency
Lorenzo Nicora Reactive μServices
You need to find your collaborator
o Service Discovery
• Dynamic service registration
• Heartbeat, Gossip, Health Check (is a service dead?)
• DNS
o Load Balancers
Location Transparency
Lorenzo Nicora Reactive μServices
Conclusions
Lorenzo Nicora Reactive μServices
ü Reactive as a set of
Architectural Patterns and Principles
Ø low latency/high throughput
Ø scale linearly
Ø resiliency
Ø …
ü When not using a ”Reactive” technology
apply discipline,
but still enforce Reactive Principles
ü Keep in mind when designing both…
Macro: μService architecture
Micro: internal software design
Conclusions
Lorenzo Nicora Reactive μServices
Reactive Manifesto: http://www.reactivemanifesto.org/
à Glossary http://www.reactivemanifesto.org/glossary
References
Lorenzo Nicora Reactive μServices
Q&A
Thanks.
Lorenzo Nicora Reactive μServices

Weitere ähnliche Inhalte

Andere mochten auch

Achieving best practice in delivering government information and services online
Achieving best practice in delivering government information and services onlineAchieving best practice in delivering government information and services online
Achieving best practice in delivering government information and services onlineeGovernment Resource Centre
 
Towards a Political Aesthetic of Everyday Life
Towards a Political Aesthetic of Everyday Life Towards a Political Aesthetic of Everyday Life
Towards a Political Aesthetic of Everyday Life Zeliha Uyurca
 
Government Controlled Mobile VoIP
Government Controlled Mobile VoIPGovernment Controlled Mobile VoIP
Government Controlled Mobile VoIPHabibur Rahman
 
Mobile Seva: Bringing Citizens and Government Together Through Mobiles, India
Mobile Seva: Bringing Citizens and Government Together Through Mobiles, IndiaMobile Seva: Bringing Citizens and Government Together Through Mobiles, India
Mobile Seva: Bringing Citizens and Government Together Through Mobiles, IndiaUNDP India
 
The importance of a mobile government
The importance of a mobile governmentThe importance of a mobile government
The importance of a mobile governmentCapgemini
 
Mobile Governance Applications
Mobile Governance ApplicationsMobile Governance Applications
Mobile Governance Applicationsachalkumar
 
Zia Government Solutions from Paper to Mobile
Zia Government Solutions from Paper to MobileZia Government Solutions from Paper to Mobile
Zia Government Solutions from Paper to MobileZia Consulting
 
OECD GOV Observatory for Public Sector Innovation
OECD GOV Observatory for Public Sector InnovationOECD GOV Observatory for Public Sector Innovation
OECD GOV Observatory for Public Sector Innovationadamlerouge
 
ICT, Knowledge-based Society and Innovation 2.0
ICT, Knowledge-based Society and Innovation 2.0ICT, Knowledge-based Society and Innovation 2.0
ICT, Knowledge-based Society and Innovation 2.0songgang
 
OECD GOV Open government data
OECD GOV Open government dataOECD GOV Open government data
OECD GOV Open government dataadamlerouge
 
Google Apps for Government - GovLoop LIVE CHAT
Google Apps for Government - GovLoop LIVE CHATGoogle Apps for Government - GovLoop LIVE CHAT
Google Apps for Government - GovLoop LIVE CHATGovLoop
 
Transcending e-Government: a Case of Mobile Government in Beijing
Transcending e-Government: a Case of Mobile Government in BeijingTranscending e-Government: a Case of Mobile Government in Beijing
Transcending e-Government: a Case of Mobile Government in Beijingsonggang
 
m-government & android application development
m-government & android application developmentm-government & android application development
m-government & android application developmentArif Huda
 
Open Data Strategies & Mobile Government (GCC Perspective)
Open Data Strategies & Mobile Government (GCC Perspective)Open Data Strategies & Mobile Government (GCC Perspective)
Open Data Strategies & Mobile Government (GCC Perspective)Dr Usman Zafar
 
Government on the move: trends in mobile technology and how government can ge...
Government on the move: trends in mobile technology and how government can ge...Government on the move: trends in mobile technology and how government can ge...
Government on the move: trends in mobile technology and how government can ge...eGovernment Resource Centre
 
MOBILE SOLUTIONS GUIDE FOR GOVERNMENT
MOBILE SOLUTIONS GUIDE FOR GOVERNMENTMOBILE SOLUTIONS GUIDE FOR GOVERNMENT
MOBILE SOLUTIONS GUIDE FOR GOVERNMENTNGINX at F5
 
E commerece,m-commerece & m-governance
E commerece,m-commerece & m-governanceE commerece,m-commerece & m-governance
E commerece,m-commerece & m-governanceSai Mahesh
 
Empowering citizens and local government with mobile data
Empowering citizens and local government with mobile dataEmpowering citizens and local government with mobile data
Empowering citizens and local government with mobile dataTim Willoughby
 

Andere mochten auch (20)

Achieving best practice in delivering government information and services online
Achieving best practice in delivering government information and services onlineAchieving best practice in delivering government information and services online
Achieving best practice in delivering government information and services online
 
Towards a Political Aesthetic of Everyday Life
Towards a Political Aesthetic of Everyday Life Towards a Political Aesthetic of Everyday Life
Towards a Political Aesthetic of Everyday Life
 
Government Controlled Mobile VoIP
Government Controlled Mobile VoIPGovernment Controlled Mobile VoIP
Government Controlled Mobile VoIP
 
MGov2010
MGov2010MGov2010
MGov2010
 
Mobile Seva: Bringing Citizens and Government Together Through Mobiles, India
Mobile Seva: Bringing Citizens and Government Together Through Mobiles, IndiaMobile Seva: Bringing Citizens and Government Together Through Mobiles, India
Mobile Seva: Bringing Citizens and Government Together Through Mobiles, India
 
The importance of a mobile government
The importance of a mobile governmentThe importance of a mobile government
The importance of a mobile government
 
Mobile Governance Applications
Mobile Governance ApplicationsMobile Governance Applications
Mobile Governance Applications
 
Zia Government Solutions from Paper to Mobile
Zia Government Solutions from Paper to MobileZia Government Solutions from Paper to Mobile
Zia Government Solutions from Paper to Mobile
 
OECD GOV Observatory for Public Sector Innovation
OECD GOV Observatory for Public Sector InnovationOECD GOV Observatory for Public Sector Innovation
OECD GOV Observatory for Public Sector Innovation
 
ICT, Knowledge-based Society and Innovation 2.0
ICT, Knowledge-based Society and Innovation 2.0ICT, Knowledge-based Society and Innovation 2.0
ICT, Knowledge-based Society and Innovation 2.0
 
OECD GOV Open government data
OECD GOV Open government dataOECD GOV Open government data
OECD GOV Open government data
 
Google Apps for Government - GovLoop LIVE CHAT
Google Apps for Government - GovLoop LIVE CHATGoogle Apps for Government - GovLoop LIVE CHAT
Google Apps for Government - GovLoop LIVE CHAT
 
Transcending e-Government: a Case of Mobile Government in Beijing
Transcending e-Government: a Case of Mobile Government in BeijingTranscending e-Government: a Case of Mobile Government in Beijing
Transcending e-Government: a Case of Mobile Government in Beijing
 
m-government & android application development
m-government & android application developmentm-government & android application development
m-government & android application development
 
M-Government
M-GovernmentM-Government
M-Government
 
Open Data Strategies & Mobile Government (GCC Perspective)
Open Data Strategies & Mobile Government (GCC Perspective)Open Data Strategies & Mobile Government (GCC Perspective)
Open Data Strategies & Mobile Government (GCC Perspective)
 
Government on the move: trends in mobile technology and how government can ge...
Government on the move: trends in mobile technology and how government can ge...Government on the move: trends in mobile technology and how government can ge...
Government on the move: trends in mobile technology and how government can ge...
 
MOBILE SOLUTIONS GUIDE FOR GOVERNMENT
MOBILE SOLUTIONS GUIDE FOR GOVERNMENTMOBILE SOLUTIONS GUIDE FOR GOVERNMENT
MOBILE SOLUTIONS GUIDE FOR GOVERNMENT
 
E commerece,m-commerece & m-governance
E commerece,m-commerece & m-governanceE commerece,m-commerece & m-governance
E commerece,m-commerece & m-governance
 
Empowering citizens and local government with mobile data
Empowering citizens and local government with mobile dataEmpowering citizens and local government with mobile data
Empowering citizens and local government with mobile data
 

Ähnlich wie Reactive Principles and Microservices

Reactive - Is it really a Magic Pill?
Reactive - Is it really a Magic Pill?Reactive - Is it really a Magic Pill?
Reactive - Is it really a Magic Pill?Tech Triveni
 
Spring Boot Microservices vs Akka Actor Cluster
Spring Boot Microservices vs Akka Actor Cluster Spring Boot Microservices vs Akka Actor Cluster
Spring Boot Microservices vs Akka Actor Cluster OpenCredo
 
Azure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challengesAzure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challengesIvo Andreev
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Rick Hightower
 
Microservices for Mortals by Bert Ertman at Codemotion Dubai
 Microservices for Mortals by Bert Ertman at Codemotion Dubai Microservices for Mortals by Bert Ertman at Codemotion Dubai
Microservices for Mortals by Bert Ertman at Codemotion DubaiCodemotion Dubai
 
Observables in Angular
Observables in AngularObservables in Angular
Observables in AngularKnoldus Inc.
 
[WSO2Con EU 2017] Resilience Patterns with Ballerina
[WSO2Con EU 2017] Resilience Patterns with Ballerina[WSO2Con EU 2017] Resilience Patterns with Ballerina
[WSO2Con EU 2017] Resilience Patterns with BallerinaWSO2
 
Reactive Micro Services with Java seminar
Reactive Micro Services with Java seminarReactive Micro Services with Java seminar
Reactive Micro Services with Java seminarGal Marder
 
Resisting to The Shocks
Resisting to The ShocksResisting to The Shocks
Resisting to The ShocksStefano Fago
 
Reactive Programming
Reactive ProgrammingReactive Programming
Reactive ProgrammingKnoldus Inc.
 
Not my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructureNot my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructureYshay Yaacobi
 
Cut your Dependencies with - Dependency Injection for South Bay.NET User Grou...
Cut your Dependencies with - Dependency Injection for South Bay.NET User Grou...Cut your Dependencies with - Dependency Injection for South Bay.NET User Grou...
Cut your Dependencies with - Dependency Injection for South Bay.NET User Grou...Theo Jungeblut
 
Building Cloud Ready Apps
Building Cloud Ready AppsBuilding Cloud Ready Apps
Building Cloud Ready AppsVMware Tanzu
 
Advance Microservice Patterns - Event Souring , CQRS
Advance Microservice Patterns - Event Souring , CQRSAdvance Microservice Patterns - Event Souring , CQRS
Advance Microservice Patterns - Event Souring , CQRSMohit Mittal
 
Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency InjectionTheo Jungeblut
 
Tef con2016 (1)
Tef con2016 (1)Tef con2016 (1)
Tef con2016 (1)ggarber
 

Ähnlich wie Reactive Principles and Microservices (20)

Reactive - Is it really a Magic Pill?
Reactive - Is it really a Magic Pill?Reactive - Is it really a Magic Pill?
Reactive - Is it really a Magic Pill?
 
Spring Boot Microservices vs Akka Actor Cluster
Spring Boot Microservices vs Akka Actor Cluster Spring Boot Microservices vs Akka Actor Cluster
Spring Boot Microservices vs Akka Actor Cluster
 
Azure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challengesAzure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challenges
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)
 
Microservices for Mortals by Bert Ertman at Codemotion Dubai
 Microservices for Mortals by Bert Ertman at Codemotion Dubai Microservices for Mortals by Bert Ertman at Codemotion Dubai
Microservices for Mortals by Bert Ertman at Codemotion Dubai
 
Observables in Angular
Observables in AngularObservables in Angular
Observables in Angular
 
[WSO2Con EU 2017] Resilience Patterns with Ballerina
[WSO2Con EU 2017] Resilience Patterns with Ballerina[WSO2Con EU 2017] Resilience Patterns with Ballerina
[WSO2Con EU 2017] Resilience Patterns with Ballerina
 
Rx Swift
Rx SwiftRx Swift
Rx Swift
 
Asynchronyin net
Asynchronyin netAsynchronyin net
Asynchronyin net
 
Reactive Micro Services with Java seminar
Reactive Micro Services with Java seminarReactive Micro Services with Java seminar
Reactive Micro Services with Java seminar
 
Resisting to The Shocks
Resisting to The ShocksResisting to The Shocks
Resisting to The Shocks
 
Reactive programming
Reactive programmingReactive programming
Reactive programming
 
Surviving microservices
Surviving microservicesSurviving microservices
Surviving microservices
 
Reactive Programming
Reactive ProgrammingReactive Programming
Reactive Programming
 
Not my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructureNot my problem - Delegating responsibility to infrastructure
Not my problem - Delegating responsibility to infrastructure
 
Cut your Dependencies with - Dependency Injection for South Bay.NET User Grou...
Cut your Dependencies with - Dependency Injection for South Bay.NET User Grou...Cut your Dependencies with - Dependency Injection for South Bay.NET User Grou...
Cut your Dependencies with - Dependency Injection for South Bay.NET User Grou...
 
Building Cloud Ready Apps
Building Cloud Ready AppsBuilding Cloud Ready Apps
Building Cloud Ready Apps
 
Advance Microservice Patterns - Event Souring , CQRS
Advance Microservice Patterns - Event Souring , CQRSAdvance Microservice Patterns - Event Souring , CQRS
Advance Microservice Patterns - Event Souring , CQRS
 
Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency Injection
 
Tef con2016 (1)
Tef con2016 (1)Tef con2016 (1)
Tef con2016 (1)
 

Kürzlich hochgeladen

Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 

Kürzlich hochgeladen (20)

Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

Reactive Principles and Microservices

  • 1. Reactive MicroServices Leveraging Reactive principles in a technology agnostic way Lorenzo Nicora Senior Consultant @ OpenCredo @nicusX https://opencredo.com/author/lorenzo
  • 2. “Reactive” is… Reactive Semantically overloaded term adj. “Readily responsive to stimulus” [Merrian-Webster dictionary] From Latin “reagere”: act in return Lorenzo Nicora Reactive μServices
  • 3. Reactive as… Reactive as Reactive Manifesto Lorenzo Nicora Reactive μServices
  • 4. Reactive Manifesto Lorenzo Nicora Reactive μServices
  • 5. ü Responsive à Low latency ü Resilient à Stay responsive on failure ü Elastic à Scale as needed ü Message-Driven à Asynchronous messages as only communication between components Simplifying Lorenzo Nicora Reactive μServices
  • 6. ✗ No Blocking operation ✗ No Synchronization à No Contention ✗ No Resource hogging Reactive Manifesto promotes Decoupling and isolation in… üTime à Concurrent processing üSpace à Components location decoupling Lorenzo Nicora Reactive μServices
  • 7. Reactive as.. Akka Spring Boot a set of Architectural Patterns and Principles Not necessarily related to a specific technology a set of technologies Lorenzo Nicora Reactive μServices
  • 8. A set of architectural patterns and principles applicable to MicroServices ü Non-blocking processing ü Message-based communication ü Asynchronous delegation ü Resilience: Isolation & Replication; Backpressure ü Elasticity ü Location transparency Reactive as Architectural Patterns Lorenzo Nicora Reactive μServices
  • 9. a MicroService is.. • Communicate with others over the network • Part of a distributed system • Independently deployed • Independently scalable MicroServices Lorenzo Nicora Reactive μServices
  • 10. Macro level at μService boundaries Between Services; external resources Across the MicroService Stack Micro level within the μService Between internal components Lorenzo Nicora Reactive μServices
  • 11. Do not block threads Never block a thread doing nothing and waiting for an Input or a Response Threads are limited resources (Thread starving) (React to Input / Response) Lorenzo Nicora Reactive μServices
  • 12. Non-blocking à Faster Lorenzo Nicora Reactive μServices
  • 13. Non-blocking Communication Macro (at service boundaries) ✗ Limit Request/Response pattern üOne-way messaging (fire and forget) üPrefer messaging protocols rather than HTTP Non-blocking Lorenzo Nicora Reactive μServices
  • 14. Non-blocking Communication and IO Micro (within the Service) ✗ Limit blocking/direct method calls üFutures, Promises, Callbacks üInternal messaging (e.g. Actor model) üNon-blocking IO and drivers Non-blocking Lorenzo Nicora Reactive μServices
  • 15. Non-blocking + Blocking = Blocking ✗ Many resources only provide blocking API • Prefer technologies with non-blocking API ✗ Do not block on a Future… • To extract the result • To handle exceptions ❗ Know where your thread come from • Thread pools Non-blocking pitfalls Lorenzo Nicora Reactive μServices
  • 16. Delegation * External components Delegate a task asynchronously to other components* Macro (at Service boundaries) o Delegate tasks to other μServices o Send Request as a Message o When required, Response come back as a Message Lorenzo Nicora Reactive μServices
  • 17. Delegation * Internal component Delegate a task asynchronously to other components* Micro (within the Service) o Execute sub-tasks in separate threads • Futures/Promises, Callbacks… o Run multiple tasks in parallel Lorenzo Nicora Reactive μServices
  • 18. Parallel Delegation Lorenzo Nicora Reactive μServices
  • 19. Resilience: Stay responsive in face of failure Resilience Design expecting failure Failure happens! Fail-Safe Lorenzo Nicora Reactive μServices
  • 20. • Failure (e.g. connection failure, timeout…) • Unexpected event • Not recoverable • No meaningful response to your client • Error (e.g. user input error) • Expected condition • A specific response to the client (your protocol) Failure ≠ Error Lorenzo Nicora Reactive μServices
  • 21. Resilience: Isolation + Replication Resilience à Isolation + Replication Macro o Deployment Isolation o Bulkheads • Prevent cascading failures • Neither to peer services, nor upstream/downstream Lorenzo Nicora Reactive μServices
  • 22. Resilience à Isolation + Replication o Replication • Legacy (always valid) HA approach • Multiple peer services • Data Replication Resilience: Isolation + Replication Lorenzo Nicora Reactive μServices
  • 23. Fail silent; Fail fast then Recover, when possible o Prevent cascading failures o Isolate failing collaborators • Downstream μServices • External services • Resources (DB…) Resilience: Circuit Breakers Lorenzo Nicora Reactive μServices
  • 24. Expect Failure… Resilience: Handle failure … Handle Failure Lorenzo Nicora Reactive μServices
  • 25. Handle Errors and Failures separately Consistently report Errors to your client Error is part of your “protocol” (business logic) Gracefully degrade on Failure Avoid ”All or nothing” logic à Partial Responses Handling Failure Lorenzo Nicora Reactive μServices
  • 26. Explicitly set and handle timeouts on every asynchronous interaction Never rely on default settings and handling for timeouts Timeouts - Failures When collaboration is asynchronous (messaging) a Failure becomes a Time-out Lorenzo Nicora Reactive μServices
  • 27. Prevent fast publishers from overrunning slow consumers ✗ Drop messages (acceptable?) ✗ Cause catastrophic cascade failures Back-pressure Lorenzo Nicora Reactive μServices
  • 28. Buffers overflow! and will not save you Back-pressure à Backpressure Consumer… ü Give feedback to publisher ü Drive the pace Lorenzo Nicora Reactive μServices
  • 29. Ability to scale when required Macro ü Scale services and resources • Add/Remove VM, Container, Cluster nodes ❗ Scaling data (application state) • Only Partitioning, Sharding Elasticity Scaling: an infrastructure concern, but application must be designed for it Lorenzo Nicora Reactive μServices
  • 30. Your collaborator may be anywhere Local or Remote Architecture may evolve Local à Remote “There ain’t no such thing as a transparent synchronous remotisation” Async Messaging work the same local and remote Location Transparency Lorenzo Nicora Reactive μServices
  • 31. You need to find your collaborator o Service Discovery • Dynamic service registration • Heartbeat, Gossip, Health Check (is a service dead?) • DNS o Load Balancers Location Transparency Lorenzo Nicora Reactive μServices
  • 33. ü Reactive as a set of Architectural Patterns and Principles Ø low latency/high throughput Ø scale linearly Ø resiliency Ø … ü When not using a ”Reactive” technology apply discipline, but still enforce Reactive Principles ü Keep in mind when designing both… Macro: μService architecture Micro: internal software design Conclusions Lorenzo Nicora Reactive μServices
  • 34. Reactive Manifesto: http://www.reactivemanifesto.org/ à Glossary http://www.reactivemanifesto.org/glossary References Lorenzo Nicora Reactive μServices