SlideShare a Scribd company logo
1 of 35
Digital Transformation Specialist
Reactive Systems - introduction
Wojciech Nowak zJava VIII - 16.04.2019
“
© 2019 Objectivity Ltd Classification
Agenda
1. The Reactive Manifesto
2. Why we need Reactive Systems
3. Reactive Systems vs Reactive Programming
4. Sync vs async communication
5. Benefits of Reactive Systems
6. Main challenges
© 2019 Objectivity Ltd
What does the Reactive System term mean?
© 2019 Objectivity Ltd Classification
The Reactive Manifesto
Source: https://www.reactivemanifesto.org/
© 2019 Objectivity Ltd Classification
Responsiveness
• A cornerstone of modern system’s usability
• The consistent quality of service
• System responds in a timely fashion
• An experience that the system is responsive at all time, under any condition
• Some components of the system can operate in degraded state but they still work
• System’s optional features can be down but this should not impact the system as a whole
• Builds user’s positive experience, confidence level and encourages for further interactions
© 2019 Objectivity Ltd Classification
Resilience
• System stays responsive even in case of failure
• We don’t try to avoid or secure against failures, we are just prepared to handle them accordingly
• Recovery is delegated to separate component (supervisor)
• Failing service can be restarted so it needs to start up really quick
• Can be achieved by:
• Replication (data, services) – workload distribution (load balancing), redundant processing or mix
• Isolation and containment (bulkheading) – failures are not propagated to a client, failure in one
service shouldn’t cause failure in another service
• Delegation
© 2019 Objectivity Ltd Classification
Elasticity
• The system remains responsive under any load (especially peak loads)
• Able to react and accommodate to the current load (scale up and down)
• Provides cost-effective way of system operation
• No contention
• No bottleneck
© 2019 Objectivity Ltd Classification
Message driven
• Provides an async and non-blocking communication
• Communication by message passing
• Elasticity
• A target participant doesn’t necessarily need to be up & running at a given time for communication to succeed
• Provides traits like:
• A greater level of loose coupling between components (services)
• Facilitates isolation and containment
• Easies the implementation of the supervision
• Enables the location transparency
• Decouples in time and failure
• Prevents cascade failures
© 2019 Objectivity Ltd Classification
Why we need reactive software?
Business perspective Technical perspective
 Software is present in almost every business
 Business cannot afford unresponsive software
 Business is not able to operate without robust and
responsive systems
 Competition on software market enforces high
service quality and end-user satisfaction
 These days systems needs to handle radical
changes in load (peak loads) – Black Friday, Sales
 Business needs cost-effective software, it doesn’t
pay for the idle time of the system
 Nowadays software systems get bigger and bigger
 Serves, handles and processes more and more
data
 Systems just need to scale
 Architecture which favors isolation and
containment of failures
 Loose coupling, flexibility and elasticity
© 2019 Objectivity Ltd Classification
Reactive System vs reactive programming
Reactive System and reactive programming is not the same thing.
Futures
Reactive Streams
Promises
Reactive programming
Futures
Reactive Streams
Promises
Reactive programming
Blocking calls
Regular non-reactive
programming
Reactive Systemmicroservice microservice
microservice
© 2019 Objectivity Ltd Classification
Why not synchronous communication?
• Reduces availability
• Limited flexibility
Sync communication Async comunication
 Reduces availability
 Limited flexibility
 Simple architecture
 Location tranparency need to be provided by
separate component (load balancer, service
discovery)
 Couples in time
 Favors waterfall failures
 Holds resources
 It’s not how the real world communicates
 Increases availability
 Facilitates flexibility
 More complex architecture (message broker)
 Out-of-the box location transparency
 Decouples in time
 Enables isolation and containment
 Releases resources
 Represents the real world communication
© 2019 Objectivity Ltd Classification
Asynchronous service API
Service
Command
Query
Event
publisher
<<inbox>>
<<outbox>>
<<event channel>>
message:
• command
• query/response
• event
event
© 2019 Objectivity Ltd Classification
Command vs event
Command Event
• Represents an intent
• Can be discarded
• Represents a fact
• Cannot be discarded
Message
Both carried by
01
02
03
04
© 2019 Objectivity Ltd Classification
Isolation in Reactive Systems
Isolation in space
Service can be deployed anywhere
Service can be restarted, replaced, moved around
during its lifetime (to different host, networks, data
centers)
location transparency != transparent remoting
Isolation in state Isolation in time
Request can go successfully even if target is
not available in a given time
Asnynchronous, non-blocking communication
Isolation in failure
Failures are not propagated to clients
Failures of one service should not cause
failure of other service
System stays operational even in case of
failures
Data is private to service
An access to data is only available though
service APIa
No data sharing through database sharing
© 2019 Objectivity Ltd Classification
Main concerns
• Autonomicity
• Consistency
• Reliability
• Preserving a message order
• Isolation of the „transaction”
© 2019 Objectivity Ltd Classification
Autonomous services – no isolation (sync)
Service A Service B
© 2019 Objectivity Ltd Classification
Autonomous services – no isolation (sync)
Service A Service B
© 2019 Objectivity Ltd Classification
Autonomous services – no isolation
Service A Service B
© 2019 Objectivity Ltd Classification
Autonomous services – no isolation (sync)
Service A Service B
© 2019 Objectivity Ltd Classification
Autonomous services – with isolation (sync), cache
Service A Service B
cache
© 2019 Objectivity Ltd Classification
Autonomous services – with isolation (sync), cache
Service A Service B
cacheHIT
© 2019 Objectivity Ltd Classification
Autonomous services – with isolation (sync), cache
Service A Service B
cacheMISS
© 2019 Objectivity Ltd Classification
Autonomous services – with isolation (sync), cache
Service A Service B
cacheMISS
© 2019 Objectivity Ltd Classification
Autonomous services – async
Service A Service B
<<subscribe>> <<publish>>
Event stream / event store
© 2019 Objectivity Ltd Classification
Autonomous services – async
Service A Service B
<<subscribe>>
Event stream / event store
© 2019 Objectivity Ltd Classification
Consistency - problem
Service A
Service C
<<command>>
Service B
1
<<command>>
2
<<response>>
3
<<command>>
4
<<error>>
5
2
How to deal with
already commited
local transaction
triggered by
In fact of ?5
© 2019 Objectivity Ltd Classification
Consistency - orchestration
Service A
Service C
<<command>>
Service B
1
<<command>>
2
<<response>>
3
<<command>>
4
<<error>>
5
Saga
<<compensation_of_2>>
6
© 2019 Objectivity Ltd Classification
Consistency - choreography
Service A
Service C
<<command>>
Service B
1
<<event>>
2
<<event>>
3
<<event>>
3
<<event>>
5
Message
broker
<<event>>
2
<<event>>
5
<<event>>
5
© 2019 Objectivity Ltd Classification
Consistency – orchestration by events
Service A
Service C
<<command>>
Service B
1
<<event>>
2
<<command>>
3
<<command>>
5
<<event>>
6
Message
broker
<<event>>
2
<<command>>
8
<<command>>
7
Service A Saga
<<command>>
3
<<event>>
4
<<event>>
4
<<command>>
5
<<event>>
6
<<command>>
7 8
© 2019 Objectivity Ltd Classification
Reliability – do we really need it?
Delivery guarantees:
• At most once
• At least once
• Exactly once
Do we really need it to be provided by messaging protocol?
Service A Service B
Service A Service B
A
A
A
at-most-once delivery
at-least-once delivery
Message duplication handling:
• Idempotency of business operation
• Explicitly provided by business logic
© 2019 Objectivity Ltd Classification
Out of order processing in scaled up services - problem
Service A
Service B1
A
Message
broker
B
A
B
Service B2
A
B
<<processed>>
<<processed>>
© 2019 Objectivity Ltd Classification
Out of order processing in scaled up services - solution
Service A
Service B1
Message
broker
C
B
Service B2
<<processed>>
<<processed>>
Service A
shards / partitions
AC
A
A
C
DB D
D
B C A
B D
partition
partition
…
© 2019 Objectivity Ltd Classification
Isolation of distributed „transactions”
Problems
• Lost updates
• Dirty reads
• Non-repeatable reads
Possible solutions
• Semantic lock
• Commutative updates
• Pessimistic View
• Reread value
© 2019 Objectivity Ltd Classification
Worth looking at
1. Reactive courses - https://www.lightbend.com/learn/lightbend-reactive-architecture
2. Nobody needs reliable messaging - https://www.infoq.com/articles/no-reliable-messaging
3. Life Beyond the Illusion of Present - https://www.youtube.com/watch?v=Nhz5jMXS8gE
4. Data on the Outside versus Data on the Inside - http://cidrdb.org/cidr2005/papers/P12.pdf
5. Eventually Consistent, Revisited - https://www.allthingsdistributed.com/2008/12/eventually_consistent.html
6. Life beyond Distributed Transactions - http://adrianmarriott.net/logosroot/papers/LifeBeyondTxns.pdf
7. Memories, Guesses, & Apologies – http://cidrdb.org/cidr2007/gongshow/15Helland.ppt
8. Microservices Patterns (book) - https://www.manning.com/books/microservices-patterns
© 2019 Objectivity Ltd Classification
Thank you!

More Related Content

What's hot

Securing Your Infrastructure: Identity Management and Data Protection
Securing Your Infrastructure: Identity Management and Data ProtectionSecuring Your Infrastructure: Identity Management and Data Protection
Securing Your Infrastructure: Identity Management and Data Protection
Lumension
 
An Introduction to SaaS and Cloud Computing
An Introduction toSaaS and Cloud ComputingAn Introduction toSaaS and Cloud Computing
An Introduction to SaaS and Cloud Computing
elliando dias
 
Clextra platform
Clextra platformClextra platform
Clextra platform
Edgevalue
 

What's hot (20)

Travelers 360 degree health assessment of microservices on the pivotal platform
Travelers 360 degree health assessment of microservices on the pivotal platformTravelers 360 degree health assessment of microservices on the pivotal platform
Travelers 360 degree health assessment of microservices on the pivotal platform
 
Securing Your Infrastructure: Identity Management and Data Protection
Securing Your Infrastructure: Identity Management and Data ProtectionSecuring Your Infrastructure: Identity Management and Data Protection
Securing Your Infrastructure: Identity Management and Data Protection
 
Troubleshooting the Most Common Citrix Complaints for Remote Workers
Troubleshooting the Most Common Citrix Complaints for Remote WorkersTroubleshooting the Most Common Citrix Complaints for Remote Workers
Troubleshooting the Most Common Citrix Complaints for Remote Workers
 
Scaling Enterprise Observability on Tanzu Foundations
Scaling Enterprise Observability on Tanzu FoundationsScaling Enterprise Observability on Tanzu Foundations
Scaling Enterprise Observability on Tanzu Foundations
 
Service Level Agreement
Service Level AgreementService Level Agreement
Service Level Agreement
 
An Introduction to SaaS and Cloud Computing
An Introduction toSaaS and Cloud ComputingAn Introduction toSaaS and Cloud Computing
An Introduction to SaaS and Cloud Computing
 
Sla in cloud
Sla in cloudSla in cloud
Sla in cloud
 
Clextra platform
Clextra platformClextra platform
Clextra platform
 
Integrating Salesforce.com and Oracle ERP Using IBM WebSphere Cast Iron
Integrating Salesforce.com and Oracle ERP Using IBM WebSphere Cast IronIntegrating Salesforce.com and Oracle ERP Using IBM WebSphere Cast Iron
Integrating Salesforce.com and Oracle ERP Using IBM WebSphere Cast Iron
 
Hewlett Packard Enterprise (HPE) Service Virtualization (SV)
Hewlett Packard Enterprise (HPE) Service Virtualization (SV)Hewlett Packard Enterprise (HPE) Service Virtualization (SV)
Hewlett Packard Enterprise (HPE) Service Virtualization (SV)
 
Udvikling af apps til mobile enheder med IBM Worklight, Christina Møller, IBM
Udvikling af apps til mobile enheder med IBM Worklight, Christina Møller, IBMUdvikling af apps til mobile enheder med IBM Worklight, Christina Møller, IBM
Udvikling af apps til mobile enheder med IBM Worklight, Christina Møller, IBM
 
Microsoft Volume Licensing Basics
Microsoft Volume Licensing BasicsMicrosoft Volume Licensing Basics
Microsoft Volume Licensing Basics
 
Application Consolidation and Retirement
Application Consolidation and RetirementApplication Consolidation and Retirement
Application Consolidation and Retirement
 
A Review on Data Protection of Cloud Computing Security, Benefits, Risks and ...
A Review on Data Protection of Cloud Computing Security, Benefits, Risks and ...A Review on Data Protection of Cloud Computing Security, Benefits, Risks and ...
A Review on Data Protection of Cloud Computing Security, Benefits, Risks and ...
 
Cloud monitoring overview
Cloud monitoring overviewCloud monitoring overview
Cloud monitoring overview
 
Adapters and EAI
Adapters and EAIAdapters and EAI
Adapters and EAI
 
IBM Application Acceleration Data Sheet
IBM Application Acceleration Data SheetIBM Application Acceleration Data Sheet
IBM Application Acceleration Data Sheet
 
What the Internet of Things means for the mobile enterprise - Ian Evans, AirW...
What the Internet of Things means for the mobile enterprise - Ian Evans, AirW...What the Internet of Things means for the mobile enterprise - Ian Evans, AirW...
What the Internet of Things means for the mobile enterprise - Ian Evans, AirW...
 
Deployment Automation for Hybrid Cloud and Multi-Platform Environments
Deployment Automation for Hybrid Cloud and Multi-Platform EnvironmentsDeployment Automation for Hybrid Cloud and Multi-Platform Environments
Deployment Automation for Hybrid Cloud and Multi-Platform Environments
 
What's New in Smarter Process and C&I
What's New in Smarter Process and C&IWhat's New in Smarter Process and C&I
What's New in Smarter Process and C&I
 

Similar to Reactive systems zJava VIII

Enterprise Briefing Document - Service Transformation
Enterprise Briefing Document - Service TransformationEnterprise Briefing Document - Service Transformation
Enterprise Briefing Document - Service Transformation
Jacqueline Stork
 
Microservices: Why Should Businesses Care?
Microservices: Why Should Businesses Care?Microservices: Why Should Businesses Care?
Microservices: Why Should Businesses Care?
Akana
 

Similar to Reactive systems zJava VIII (20)

Application resilience: challenges and good practice
Application resilience: challenges and good practiceApplication resilience: challenges and good practice
Application resilience: challenges and good practice
 
Enabling and accelerating multi-tenancy with Capgemini Digital Cloud Platform...
Enabling and accelerating multi-tenancy with Capgemini Digital Cloud Platform...Enabling and accelerating multi-tenancy with Capgemini Digital Cloud Platform...
Enabling and accelerating multi-tenancy with Capgemini Digital Cloud Platform...
 
So you want to provision a test environment...
So you want to provision a test environment...So you want to provision a test environment...
So you want to provision a test environment...
 
Engineering Software Products: 6. microservices architecture
Engineering Software Products: 6. microservices architectureEngineering Software Products: 6. microservices architecture
Engineering Software Products: 6. microservices architecture
 
Chandra Gundlapalli ServiceKnow K20
Chandra Gundlapalli ServiceKnow K20Chandra Gundlapalli ServiceKnow K20
Chandra Gundlapalli ServiceKnow K20
 
Sciencelogic - A Leader in IT Transformation
Sciencelogic - A Leader in IT Transformation Sciencelogic - A Leader in IT Transformation
Sciencelogic - A Leader in IT Transformation
 
Enterprise Briefing Document - Service Transformation
Enterprise Briefing Document - Service TransformationEnterprise Briefing Document - Service Transformation
Enterprise Briefing Document - Service Transformation
 
NoOps in a Serverless World
NoOps in a Serverless WorldNoOps in a Serverless World
NoOps in a Serverless World
 
Microservices: Why Should Businesses Care?
Microservices: Why Should Businesses Care?Microservices: Why Should Businesses Care?
Microservices: Why Should Businesses Care?
 
O2E Brands Case Study: Managing Technical Debt as part of a proactive IT heal...
O2E Brands Case Study: Managing Technical Debt as part of a proactive IT heal...O2E Brands Case Study: Managing Technical Debt as part of a proactive IT heal...
O2E Brands Case Study: Managing Technical Debt as part of a proactive IT heal...
 
5 reasons to adopt cloud collaboration services
5 reasons to adopt cloud collaboration services5 reasons to adopt cloud collaboration services
5 reasons to adopt cloud collaboration services
 
Balancing cloud innovation and security - GRC317 - AWS re:Inforce 2019
Balancing cloud innovation and security - GRC317 - AWS re:Inforce 2019 Balancing cloud innovation and security - GRC317 - AWS re:Inforce 2019
Balancing cloud innovation and security - GRC317 - AWS re:Inforce 2019
 
Presentation rate&bill
Presentation rate&bill Presentation rate&bill
Presentation rate&bill
 
Infrastructure Monitoring Maturity: Modeling Technology, Process, & Culture
Infrastructure Monitoring Maturity: Modeling Technology, Process, & CultureInfrastructure Monitoring Maturity: Modeling Technology, Process, & Culture
Infrastructure Monitoring Maturity: Modeling Technology, Process, & Culture
 
Self Service Cloud Operations: Safely Delegate the Management of your Cloud ...
Self Service Cloud Operations:  Safely Delegate the Management of your Cloud ...Self Service Cloud Operations:  Safely Delegate the Management of your Cloud ...
Self Service Cloud Operations: Safely Delegate the Management of your Cloud ...
 
Business Proposal for Project
Business Proposal for ProjectBusiness Proposal for Project
Business Proposal for Project
 
Apq Qms Project Plan
Apq Qms Project PlanApq Qms Project Plan
Apq Qms Project Plan
 
How to Select High Impact Use Cases to Drive a Successful Network Automation ...
How to Select High Impact Use Cases to Drive a Successful Network Automation ...How to Select High Impact Use Cases to Drive a Successful Network Automation ...
How to Select High Impact Use Cases to Drive a Successful Network Automation ...
 
BPM and Microservices: Opposites Attract?
BPM and Microservices: Opposites Attract?BPM and Microservices: Opposites Attract?
BPM and Microservices: Opposites Attract?
 
Industry Perspective: DevOps - What it Means for the Average Business
Industry Perspective: DevOps - What it Means for the Average BusinessIndustry Perspective: DevOps - What it Means for the Average Business
Industry Perspective: DevOps - What it Means for the Average Business
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Reactive systems zJava VIII

  • 1. Digital Transformation Specialist Reactive Systems - introduction Wojciech Nowak zJava VIII - 16.04.2019
  • 2. “ © 2019 Objectivity Ltd Classification Agenda 1. The Reactive Manifesto 2. Why we need Reactive Systems 3. Reactive Systems vs Reactive Programming 4. Sync vs async communication 5. Benefits of Reactive Systems 6. Main challenges
  • 3. © 2019 Objectivity Ltd What does the Reactive System term mean?
  • 4. © 2019 Objectivity Ltd Classification The Reactive Manifesto Source: https://www.reactivemanifesto.org/
  • 5. © 2019 Objectivity Ltd Classification Responsiveness • A cornerstone of modern system’s usability • The consistent quality of service • System responds in a timely fashion • An experience that the system is responsive at all time, under any condition • Some components of the system can operate in degraded state but they still work • System’s optional features can be down but this should not impact the system as a whole • Builds user’s positive experience, confidence level and encourages for further interactions
  • 6. © 2019 Objectivity Ltd Classification Resilience • System stays responsive even in case of failure • We don’t try to avoid or secure against failures, we are just prepared to handle them accordingly • Recovery is delegated to separate component (supervisor) • Failing service can be restarted so it needs to start up really quick • Can be achieved by: • Replication (data, services) – workload distribution (load balancing), redundant processing or mix • Isolation and containment (bulkheading) – failures are not propagated to a client, failure in one service shouldn’t cause failure in another service • Delegation
  • 7. © 2019 Objectivity Ltd Classification Elasticity • The system remains responsive under any load (especially peak loads) • Able to react and accommodate to the current load (scale up and down) • Provides cost-effective way of system operation • No contention • No bottleneck
  • 8. © 2019 Objectivity Ltd Classification Message driven • Provides an async and non-blocking communication • Communication by message passing • Elasticity • A target participant doesn’t necessarily need to be up & running at a given time for communication to succeed • Provides traits like: • A greater level of loose coupling between components (services) • Facilitates isolation and containment • Easies the implementation of the supervision • Enables the location transparency • Decouples in time and failure • Prevents cascade failures
  • 9. © 2019 Objectivity Ltd Classification Why we need reactive software? Business perspective Technical perspective  Software is present in almost every business  Business cannot afford unresponsive software  Business is not able to operate without robust and responsive systems  Competition on software market enforces high service quality and end-user satisfaction  These days systems needs to handle radical changes in load (peak loads) – Black Friday, Sales  Business needs cost-effective software, it doesn’t pay for the idle time of the system  Nowadays software systems get bigger and bigger  Serves, handles and processes more and more data  Systems just need to scale  Architecture which favors isolation and containment of failures  Loose coupling, flexibility and elasticity
  • 10. © 2019 Objectivity Ltd Classification Reactive System vs reactive programming Reactive System and reactive programming is not the same thing. Futures Reactive Streams Promises Reactive programming Futures Reactive Streams Promises Reactive programming Blocking calls Regular non-reactive programming Reactive Systemmicroservice microservice microservice
  • 11. © 2019 Objectivity Ltd Classification Why not synchronous communication? • Reduces availability • Limited flexibility Sync communication Async comunication  Reduces availability  Limited flexibility  Simple architecture  Location tranparency need to be provided by separate component (load balancer, service discovery)  Couples in time  Favors waterfall failures  Holds resources  It’s not how the real world communicates  Increases availability  Facilitates flexibility  More complex architecture (message broker)  Out-of-the box location transparency  Decouples in time  Enables isolation and containment  Releases resources  Represents the real world communication
  • 12. © 2019 Objectivity Ltd Classification Asynchronous service API Service Command Query Event publisher <<inbox>> <<outbox>> <<event channel>> message: • command • query/response • event event
  • 13. © 2019 Objectivity Ltd Classification Command vs event Command Event • Represents an intent • Can be discarded • Represents a fact • Cannot be discarded Message Both carried by
  • 14. 01 02 03 04 © 2019 Objectivity Ltd Classification Isolation in Reactive Systems Isolation in space Service can be deployed anywhere Service can be restarted, replaced, moved around during its lifetime (to different host, networks, data centers) location transparency != transparent remoting Isolation in state Isolation in time Request can go successfully even if target is not available in a given time Asnynchronous, non-blocking communication Isolation in failure Failures are not propagated to clients Failures of one service should not cause failure of other service System stays operational even in case of failures Data is private to service An access to data is only available though service APIa No data sharing through database sharing
  • 15. © 2019 Objectivity Ltd Classification Main concerns • Autonomicity • Consistency • Reliability • Preserving a message order • Isolation of the „transaction”
  • 16. © 2019 Objectivity Ltd Classification Autonomous services – no isolation (sync) Service A Service B
  • 17. © 2019 Objectivity Ltd Classification Autonomous services – no isolation (sync) Service A Service B
  • 18. © 2019 Objectivity Ltd Classification Autonomous services – no isolation Service A Service B
  • 19. © 2019 Objectivity Ltd Classification Autonomous services – no isolation (sync) Service A Service B
  • 20. © 2019 Objectivity Ltd Classification Autonomous services – with isolation (sync), cache Service A Service B cache
  • 21. © 2019 Objectivity Ltd Classification Autonomous services – with isolation (sync), cache Service A Service B cacheHIT
  • 22. © 2019 Objectivity Ltd Classification Autonomous services – with isolation (sync), cache Service A Service B cacheMISS
  • 23. © 2019 Objectivity Ltd Classification Autonomous services – with isolation (sync), cache Service A Service B cacheMISS
  • 24. © 2019 Objectivity Ltd Classification Autonomous services – async Service A Service B <<subscribe>> <<publish>> Event stream / event store
  • 25. © 2019 Objectivity Ltd Classification Autonomous services – async Service A Service B <<subscribe>> Event stream / event store
  • 26. © 2019 Objectivity Ltd Classification Consistency - problem Service A Service C <<command>> Service B 1 <<command>> 2 <<response>> 3 <<command>> 4 <<error>> 5 2 How to deal with already commited local transaction triggered by In fact of ?5
  • 27. © 2019 Objectivity Ltd Classification Consistency - orchestration Service A Service C <<command>> Service B 1 <<command>> 2 <<response>> 3 <<command>> 4 <<error>> 5 Saga <<compensation_of_2>> 6
  • 28. © 2019 Objectivity Ltd Classification Consistency - choreography Service A Service C <<command>> Service B 1 <<event>> 2 <<event>> 3 <<event>> 3 <<event>> 5 Message broker <<event>> 2 <<event>> 5 <<event>> 5
  • 29. © 2019 Objectivity Ltd Classification Consistency – orchestration by events Service A Service C <<command>> Service B 1 <<event>> 2 <<command>> 3 <<command>> 5 <<event>> 6 Message broker <<event>> 2 <<command>> 8 <<command>> 7 Service A Saga <<command>> 3 <<event>> 4 <<event>> 4 <<command>> 5 <<event>> 6 <<command>> 7 8
  • 30. © 2019 Objectivity Ltd Classification Reliability – do we really need it? Delivery guarantees: • At most once • At least once • Exactly once Do we really need it to be provided by messaging protocol? Service A Service B Service A Service B A A A at-most-once delivery at-least-once delivery Message duplication handling: • Idempotency of business operation • Explicitly provided by business logic
  • 31. © 2019 Objectivity Ltd Classification Out of order processing in scaled up services - problem Service A Service B1 A Message broker B A B Service B2 A B <<processed>> <<processed>>
  • 32. © 2019 Objectivity Ltd Classification Out of order processing in scaled up services - solution Service A Service B1 Message broker C B Service B2 <<processed>> <<processed>> Service A shards / partitions AC A A C DB D D B C A B D partition partition …
  • 33. © 2019 Objectivity Ltd Classification Isolation of distributed „transactions” Problems • Lost updates • Dirty reads • Non-repeatable reads Possible solutions • Semantic lock • Commutative updates • Pessimistic View • Reread value
  • 34. © 2019 Objectivity Ltd Classification Worth looking at 1. Reactive courses - https://www.lightbend.com/learn/lightbend-reactive-architecture 2. Nobody needs reliable messaging - https://www.infoq.com/articles/no-reliable-messaging 3. Life Beyond the Illusion of Present - https://www.youtube.com/watch?v=Nhz5jMXS8gE 4. Data on the Outside versus Data on the Inside - http://cidrdb.org/cidr2005/papers/P12.pdf 5. Eventually Consistent, Revisited - https://www.allthingsdistributed.com/2008/12/eventually_consistent.html 6. Life beyond Distributed Transactions - http://adrianmarriott.net/logosroot/papers/LifeBeyondTxns.pdf 7. Memories, Guesses, & Apologies – http://cidrdb.org/cidr2007/gongshow/15Helland.ppt 8. Microservices Patterns (book) - https://www.manning.com/books/microservices-patterns
  • 35. © 2019 Objectivity Ltd Classification Thank you!

Editor's Notes

  1. it’s not a new thing Reactive Systems is a response for looking by different people for solutions for the same problems – unified, documented outline of solution Reactive Manifesto is just a try to address people concers, what peple tried to achive so far to achive the same goal
  2. Failure is contained in single component – recovery is delegated to separate component
  3. decouples components allows to scale them independently
  4. If software doesn’t work in the Reactive way or for a specific period of time – you are not able to work, company cannot operate normally, which brings a real many losses. Not only software failures makes the business not operating properly – slow / unresponsive / hanging systems as well From one end software is not the same one as years back, but also software users and their expectations are different People rely on software to do their jobs The more World is driven by software the higher expectations regarding it Non responsive software is quickly thrown out of the marker – there are alteratives – market is compet
  5. Reactive Systems - Reactive features from system architectural level, all architetural componetns (microservices) interacts in the Reactive eway Reactive Programing – doesn’t actually mean that you build Reactive System but it’s often used to build one. Reactivness at microservice level. You don’t need Reactive Programming to build Reactive systems. Both provides Reactive features but on different levels
  6. it’s still monolit * location transparency * one-to-one, one-to-many * it’s like with eventual consistency, that’s not like the world works
  7. Same thing when it comes to transportation media, just name and interpretation differs Events reverts the dependencies between services – I can add another participant (observer of events without chaning source service) Event-Carried State transfer – event brings all data so the event oberver has all necessary information and don’t need to fetch additional data
  8. Fully aunotomous service has no dependencies, but this is really rare case The less dependencies the better The closer to fully anotomous service the better Ideal anatomous services can scale indefinately. Anatomous systems can tolerate any number of its dependencies’ failures, the entire world can fail around and they still stay resposive Asynchronous communication increases autonomy of the service
  9. Same thing when it comes to transportation media, just name and interpretation differs
  10. Same thing when it comes to transportation media, just name and interpretation differs
  11. Same thing when it comes to transportation media, just name and interpretation differs
  12. Same thing when it comes to transportation media, just name and interpretation differs
  13. Same thing when it comes to transportation media, just name and interpretation differs
  14. Same thing when it comes to transportation media, just name and interpretation differs
  15. Same thing when it comes to transportation media, just name and interpretation differs
  16. Same thing when it comes to transportation media, just name and interpretation differs
  17. Same thing when it comes to transportation media, just name and interpretation differs
  18. Same thing when it comes to transportation media, just name and interpretation differs
  19. Same thing when it comes to transportation media, just name and interpretation differs
  20. Same thing when it comes to transportation media, just name and interpretation differs
  21. Same thing when it comes to transportation media, just name and interpretation differs
  22. Reliabiable delivery – quarantee that the message is delived once and only once WS-ReliableMessaging provides Reliability at a communication level through SOAP headers - business layer is independent of the messaging layer – business logic has no burden of Reliability guarantee – provides all kinds of quarantee + „in order” Reliable messaging solves this issues on the pictures by acknowledgments, duplicate detection and removal Duplicated sequence numer in message header and message body (business content) If we don’t need „in order” delivery why do we need a delivery mean to delay the message until it gets message with lower sequence numer Even if we deliver message in proper order does that mean the got processed in that order? Is the delivery quarantee a real quarantee that the message has been processed? Acknowledgement after verification that the message is syntacticly correct (validation)? Acknowledgment after processing? What if the processing fails… do we need both acknowledge and response of failure? Delivery acks are rather useless we need business ack. What if the same message is send again (maybe by mistake) by source service (not resent by message system). Business logic should process it again?
  23. Comutative updates can be done in any order Pesimistic view – reordering steps of saga to minimize the risk of dirty reads Reread value – reread first from database and then check if the record has changed Lost updates, dirty reads, fuzzy/non-repeatable reads
  24. Comutative updates can be done in any order Pesimistic view – reordering steps of saga to minimize the risk of dirty reads Reread value – reread first from database and then check if the record has changed Lost updates, dirty reads, fuzzy/non-repeatable reads