SlideShare a Scribd company logo
1 of 71
Download to read offline
Nov 2019
Reactive Architecture
Is it a Magic Pill ?
Agenda
Reactive Architecture
03
04
05
01 Introduction to Reactive
Systems
01
02 Reactive Principles ?
03 Reactive Microservices
04 CQRS and Event Sourcing
0405 Key Considerations
Base Concept
Reactive Architecture
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
If you cannot solve a problem without
programming, you cannot solve a problem with
programming.
Victor Klang
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
Overview
Reactive Architecture
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
In this talk we will explore the domain of the Reactive
Applications.
● Domain Driven Design (DDD) to model the domain.
● How our domain can be partitioned into Reactive Microservices.
● Discuss concerns around scalability, consistency, and availability
● Analyze different messaging patterns.
● Command Query Responsibility Segregation and how it can be
combined with Event Sourcing.
Introduction to
Reactive Systems
The problem
Reactive Architecture
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
The software landscape has undergone remarkable change
● Earlier
○ Tens of nodes
○ GB’s of data (often at rest)
○ Long maintenance windows
● Now
○ Hundreds and thousands of nodes
○ PB’s of data (often streaming)
○ Almost 100% uptime
User Expectations
Reactive Architecture
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
User expectations are huge from software today
● Modern users rely on software to do critical jobs - cannot
expect downtime.
● Software is expected to respond immediately
● Unresponsive software leads to dissatisfaction - users would
find a better software
Discussion
Unresponsive Software
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
Have you encountered an unresponsive software?
● What was your reaction?
● Did you reconsider the use of software?
● Did it change your impression about the company that built it?
● What did you do to overcome the challenge?
Goal
of Reactive Architecture
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
To build software
● Which scales from 10 to 10M users
● Consumes resources relevant for the current load only
● Gracefully handles failures
● Can we easily distributed across nodes, geographies
● Can give consistent level of quality irrespective of the load and
stress on the system
Reactive
Principles
Reactive Principles
Responsive
Most Important Reactive Principle
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
A responsive system is quick to react to all users —
under blue skies and grey skies — in order to ensure a
consistently positive user experience.
Responsive
Resilience
Reactive Principle
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
A resilient system applies proper design and
architecture principles in order to ensure
responsiveness under grey skies as well as blue.
Resilience
Elastic
Reactive Principle
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
A scalable system is easily upgraded on demand in
order to ensure responsiveness under various load
conditions.
Elastic
Message Driven
Reactive Principle
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
A message-driven architecture is the foundation of
Reactive applications. A message-driven application
may be event-driven, actor-based, or a combination of
the two.
Message Driven
Discussion
Responsive Software
Lorem Ipsum comes from section Contrary to
popular belief, Lorem Ipsum is not simply random
text.
Have you encountered a Responsive software?
● What was your reaction and impression?
● Do you think it was using reactive principles?
● Did it change your impression about the company that
built it?
● Have you built a reactive software?
○ What benefits did you achieve?
Reactive Programming and Systems
● Reactive systems apply reactive
principals to the architecture
● Reactive programming are
languages which support
building reactive systems like
Futures, Promises, Async
communication, streams etc
Summary
● Responsive and Unresponsive software
● Reactive Manifesto and Principles
○ Responsive
○ Resilient
○ Elastic
○ Message Driven
● Reactive programming and systems
Reactive
Microservices
Monoliths
Reactive Architecture
● The ball of mud represents the worst case
scenario for a Monolith.
● No clear isolation in the application.
● Complex dependencies.
● Hard to understand and harder to modify.
● Deployed as a single unit.
● Single shared database.
● Communicate with synchronous method calls.
● Deep coupling between libraries and components (often
through the DB).
● "Big Bang" style releases.
● Long cycle times (weeks to months).
● Teams carefully synchronize features and releases.
Characteristics of a monolith
Reactive Architecture
Scaling a Monolith
Reactive Architecture
● Multiple copies of the monolith are deployed.
● Each copy is independent. They don't
communicate with each other.
● The database provides consistency between
deployed instances.
● Easy Cross Module Refactoring.
● Easier to maintain consistency.
● Single deployment process.
● Single thing to monitor.
● Simple scalability model.
Advantages
Reactive Architecture
● Limited by the maximum size of a single physical machine.
● Only scales as far as the database will allow.
● Components must be scaled as a group.
● Deep coupling leads to inflexibility.
● Development is typically slow (change is difficult, build times long).
● Serious failures in one component often bring down the whole
● monolith.
● Redistribution of load can cause cascading failures.
Disadvantages
Reactive Architecture
Next step - SOA
Reactive Architecture
● We can isolate our Monolith using Service
Oriented Architecture.
● Services don't share a database.
● All access must go through the API exposed by
the service.
● Services may live in the same process (monolith)
or separate (microservices).
Microservices
Reactive Architecture
● Microservices are a subset of SOA.
● Logical components are separated into isolated
microservices.
● Microservices can be physically separated and
independently deployed.
● Each component/microservice has its own
independent data store.
● Microservices are independent and self
governing.
Event Sourcing / CQRS
Event Sourcing in Real Life
How we used to do it
Once Upon a Time
How we used to do it
Scaling Up..
How we used to do it
Let's Improve - Go Asynchronous .
How we used to do it
Command Vs Event
Command Results in an Event
Results
Command to Event
Journey of Command to Event
Event Sourcing
Journey of Command to Event
CQRS
What About Reads
Old Wine in New Improved Bottle
What About Reads
ES and CQRS
What About Reads
Backward Compatibility in Events
Key Considerations
A class should have only one reason to change.
Robert C. Martin
● The Single Responsibility Principle applies to object oriented classes,
but works for Microservices as well.
● A microservice should have a single responsibility (eg. managing
accounts).
● A change to the internals of one microservice should not necessitate
a change to another microservice.
SRP
Reactive Architecture
● Bounded Contexts are a good place to start building microservices.
● They define a context in which a specific model applies.
● Further subdivision of the Bounded Context is possible.
Bounded Context
Reactive Architecture
● Scalability: A system is scalable if it can meet increases in demand
while remaining responsive.
● Consistency: A system is consistent if all members of a system have
the same view or state.
● Availability: A system is available if it remains responsive despite
failures.
Definitions
● Isolation provides reduced coupling and increased scalability.
● Reactive Microservices are isolated in:
○ State
○ Space
○ Time
○ Failure
Principles of Isolation
Reactive Architecture
Isolation of State
Reactive Architecture
● All access to a Microservice state
must go through its API.
● No backdoor access via the
database.
● Allows the microservice to evolve
internally without affecting the
outside.
Isolation of Space
Reactive Architecture
● Microservices should not care
where other microservices are
deployed.
● It should be possible to move a
microservice to another machine,
possibly in a different data center
without issue.
● Allows the microservice to be scaled
up/down to meet demand.
Isolation in Time
Reactive Architecture
● Microservices should not wait for each other.
Requests are asynchronous and non-blocking.
○ More efficient use of resources.
Resources can be freed immediately,
rather than waiting for a request to finish.
● Between microservices we expect eventual
consistency.
○ Provides increased scalability. Total
consistency requires central coordination
which limits scalability (more on this
later).
Isolation of Failure
Reactive Architecture
● Reactive Microservices also isolate
failure.
● A failure in one Microservice should
not cause another to fail.
● Allows the system to remain
operational in spite of failure.
Discussion
General rules
Two trees fall in the forest. Two people hear the sound. Both trees fall at the
same time.
Each person is closer to a different tree. Sound travels at 340 m/s.
● If we were to ask Martin and Grace what time each tree fell at, would they give
us the same answer?
● If we were to ask Martin and Grace which tree fell first, would they give us the
same answer?
● Distributed Systems are systems that are separated by space.
● Physics puts an upper limit on information speed (The Speed of Light)
● When two systems are separated by space, there is always time
required to reach consensus.
● In the time it takes to transfer the information, the state of the
original sender may have changed.
Problem with distributed systems
● Because it takes time to transfer information, the information being
received is always stale.
● This applies whether we are talking about Computer systems,
people, or even just the physical world.
● Reality is therefore Eventually Consistent
Reality is eventual
Eventual Consistency
Eventual consistency guarantees that, in the
absence of new updates, all accesses to a specific
piece of data will eventually return the most recent
value.
Strong Consistency
An update to a piece of data needs agreement
from all nodes before it becomes visible.
Strong Consistency
Reactive Architecture
● Traditional architectures were built for
Strong Consistency.
● Physics prevents Strong Consistency, so
instead we simulate it.
● Locks and Transactions allow us to simulate
Strong Consistency.
● The distributed problem is isolated it to a
non-distributed resource.
● These techniques introduce overhead in the
form of contention.
● Any two things that contend for a single limited resource are in
competition.
● This competition can only have one winner.
● Others are forced to wait for the winner to complete.
● As the number of things competing increases, the time to free up the
● resource increases.
● As load increases we will eventually exceed acceptable time limits.
Contention
Discussion
General rules
Two people are collaborating on code. Strong Consistency will require that Martin
and Grace both have the exact same view of the code at all times.
A model based on locks will require Martin to lock the code when he wants to edit
it.
● How will the need for Strong Consistency affect Grace's workflow if she also
wants to edit the code?
● How do source control tools actually achieve consistency?
● Reactive Systems put an emphasis on asynchronous, non-blocking
messages.
● Messages are sent without waiting for a response.
● The sender may be interested in a response, but it comes
asynchronously.
● Is there a place in a Reactive System for Synchronous Messaging?
Messaging in Reactive Systems
● Async messages form the backbone of Reactive Systems, but
sometimes synchronous make more sense.
● Synchronous requirements can often be relaxed. In most scenarios
asynchronous messaging just works fine
● Can you acknowledge the receipt of a message synchronously, but
process it asynchronously?
Synchronous Messaging
● The need for synchronous messages should be driven by domain
requirements rather than technical ones.
● Best Practice: Use asynchronous by default, fallback to synchronous
only when forced.
● Understand the consequences of the choice.
Synchronous Messaging
● In a monolithic architecture, coordination and consensus building is
often done using transactions.
● Microservices, Distributed Systems, and Async Messages all make
transactions more difficult.
● Holding transactions open for long periods results in slow, brittle
systems.
● How can we manage long running transactions that span multiple
microservices?
Cost of Async Messaging
Sagas
Reactive Architecture
● The Saga Pattern is a way of representing a long running
transaction.
● Multiple requests are managed by a Saga.
● Individual requests are run in sequence or in parallel.
● When all requests complete, the Saga is complete.
● What happens when a request fails?
Failure In Sagas
Reactive Architecture
● Each request is paired with a compensating action.
● If any request fails, compensating actions are executed for all
completed steps.
● The Saga is then completed with a failure.
● If a compensating action fails, then it is retried. This requires
idempotence.
Timeout in Distributed System
Reactive Architecture
Timeout in Distributed System
Reactive Architecture
● In a Distributed System, timeouts present a difficult problem.
● A request timeout presents us with at least 3 possible scenarios.
○ The request failed.
○ The request succeeded, but the reply failed.
○ The request is still queued and may succeed (or fail)
eventually.
● Because the request may have succeeded, we need to run the
compensating action.
● The request may still be queued, therefore the compensating
action may complete first..
● Compensating actions are different from rollbacks.
● Rollback:
○ Implies the transaction has not completed.
○ Removes evidence of the transaction.
● Compensation:
○ Applied on top of a previously completed action.
○ Evidence of the original action remains.
Compensating and Rollback are
different
Thank You!

More Related Content

Similar to Reactive - Is it really a Magic Pill?

Microservices - Please, don't
Microservices - Please, don'tMicroservices - Please, don't
Microservices - Please, don'tSean Kelly
 
Microservices and developer pattern saga
Microservices and developer pattern sagaMicroservices and developer pattern saga
Microservices and developer pattern sagaviktorklyuster
 
About microservices on cloud computing services
About microservices on cloud computing servicesAbout microservices on cloud computing services
About microservices on cloud computing servicesssuser53aac4
 
Ledingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in actionLedingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in actionMukesh Singh
 
Reactive programming: Brincando com eficiência, composição e assíncronia
Reactive programming: Brincando com eficiência, composição e assíncroniaReactive programming: Brincando com eficiência, composição e assíncronia
Reactive programming: Brincando com eficiência, composição e assíncroniaFelipe Mamud
 
Migrating from Java EE to cloud-native Reactive systems
Migrating from Java EE to cloud-native Reactive systemsMigrating from Java EE to cloud-native Reactive systems
Migrating from Java EE to cloud-native Reactive systemsMarkus Eisele
 
Migrating From Java EE To Cloud-Native Reactive Systems
Migrating From Java EE To Cloud-Native Reactive SystemsMigrating From Java EE To Cloud-Native Reactive Systems
Migrating From Java EE To Cloud-Native Reactive SystemsLightbend
 
AppDev with Microservices
AppDev with MicroservicesAppDev with Microservices
AppDev with MicroservicesRishabh Dugar
 
Microservices - when, why and how incontrodevops.it
Microservices  - when, why and how incontrodevops.itMicroservices  - when, why and how incontrodevops.it
Microservices - when, why and how incontrodevops.itGiuseppe Lavagetto
 
Reactive Architecture
Reactive ArchitectureReactive Architecture
Reactive ArchitectureKnoldus Inc.
 
Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6Tricode (part of Dept)
 
AWS Community Day: From Monolith to Microservices - What Could Go Wrong?
AWS Community Day: From Monolith to Microservices - What Could Go Wrong?AWS Community Day: From Monolith to Microservices - What Could Go Wrong?
AWS Community Day: From Monolith to Microservices - What Could Go Wrong?Phuong Mai Nguyen
 
CWIN17 Utrecht / cg u services - frank van der wal
CWIN17 Utrecht / cg u services - frank van der walCWIN17 Utrecht / cg u services - frank van der wal
CWIN17 Utrecht / cg u services - frank van der walCapgemini
 
An eventful tour from enterprise integration to serverless and functions
An eventful tour from enterprise integration to serverless and functionsAn eventful tour from enterprise integration to serverless and functions
An eventful tour from enterprise integration to serverless and functionsChristian Posta
 
Technology insights: Decision Science Platform
Technology insights: Decision Science PlatformTechnology insights: Decision Science Platform
Technology insights: Decision Science PlatformDecision Science Community
 
從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)
從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)
從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)William Yeh
 

Similar to Reactive - Is it really a Magic Pill? (20)

Microservices - Please, don't
Microservices - Please, don'tMicroservices - Please, don't
Microservices - Please, don't
 
ZhuSem.ppt
ZhuSem.pptZhuSem.ppt
ZhuSem.ppt
 
Microservices and developer pattern saga
Microservices and developer pattern sagaMicroservices and developer pattern saga
Microservices and developer pattern saga
 
About microservices on cloud computing services
About microservices on cloud computing servicesAbout microservices on cloud computing services
About microservices on cloud computing services
 
Ledingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in actionLedingkart Meetup #1: Monolithic to microservices in action
Ledingkart Meetup #1: Monolithic to microservices in action
 
Reactive programming: Brincando com eficiência, composição e assíncronia
Reactive programming: Brincando com eficiência, composição e assíncroniaReactive programming: Brincando com eficiência, composição e assíncronia
Reactive programming: Brincando com eficiência, composição e assíncronia
 
Surviving microservices
Surviving microservicesSurviving microservices
Surviving microservices
 
Migrating from Java EE to cloud-native Reactive systems
Migrating from Java EE to cloud-native Reactive systemsMigrating from Java EE to cloud-native Reactive systems
Migrating from Java EE to cloud-native Reactive systems
 
Migrating From Java EE To Cloud-Native Reactive Systems
Migrating From Java EE To Cloud-Native Reactive SystemsMigrating From Java EE To Cloud-Native Reactive Systems
Migrating From Java EE To Cloud-Native Reactive Systems
 
AppDev with Microservices
AppDev with MicroservicesAppDev with Microservices
AppDev with Microservices
 
Microservices - when, why and how incontrodevops.it
Microservices  - when, why and how incontrodevops.itMicroservices  - when, why and how incontrodevops.it
Microservices - when, why and how incontrodevops.it
 
Reactive Architecture
Reactive ArchitectureReactive Architecture
Reactive Architecture
 
Microservices: Detailed Guide
Microservices: Detailed GuideMicroservices: Detailed Guide
Microservices: Detailed Guide
 
Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6
 
AWS Community Day: From Monolith to Microservices - What Could Go Wrong?
AWS Community Day: From Monolith to Microservices - What Could Go Wrong?AWS Community Day: From Monolith to Microservices - What Could Go Wrong?
AWS Community Day: From Monolith to Microservices - What Could Go Wrong?
 
CWIN17 Utrecht / cg u services - frank van der wal
CWIN17 Utrecht / cg u services - frank van der walCWIN17 Utrecht / cg u services - frank van der wal
CWIN17 Utrecht / cg u services - frank van der wal
 
An eventful tour from enterprise integration to serverless and functions
An eventful tour from enterprise integration to serverless and functionsAn eventful tour from enterprise integration to serverless and functions
An eventful tour from enterprise integration to serverless and functions
 
Technology insights: Decision Science Platform
Technology insights: Decision Science PlatformTechnology insights: Decision Science Platform
Technology insights: Decision Science Platform
 
Microservices
MicroservicesMicroservices
Microservices
 
從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)
從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)
從系統思考看 DevOps:以 microservices 為例 (DevOps: a system dynamics perspective)
 

More from Tech Triveni

UI Dev in Big data world using open source
UI Dev in Big data world using open sourceUI Dev in Big data world using open source
UI Dev in Big data world using open sourceTech Triveni
 
Why should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming ParadigmWhy should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming ParadigmTech Triveni
 
Let’s go reactive with JAVA
Let’s go reactive with JAVALet’s go reactive with JAVA
Let’s go reactive with JAVATech Triveni
 
Tackling Asynchrony with Kotlin Coroutines
Tackling Asynchrony with Kotlin CoroutinesTackling Asynchrony with Kotlin Coroutines
Tackling Asynchrony with Kotlin CoroutinesTech Triveni
 
Programmatic Ad Tracking: Let the power of Reactive Microservices do talking
Programmatic Ad Tracking: Let the power of Reactive Microservices do talkingProgrammatic Ad Tracking: Let the power of Reactive Microservices do talking
Programmatic Ad Tracking: Let the power of Reactive Microservices do talkingTech Triveni
 
Let's refine your Scala Code
Let's refine your Scala CodeLet's refine your Scala Code
Let's refine your Scala CodeTech Triveni
 
Supercharged imperative programming with Haskell and Functional Programming
Supercharged imperative programming with Haskell and Functional ProgrammingSupercharged imperative programming with Haskell and Functional Programming
Supercharged imperative programming with Haskell and Functional ProgrammingTech Triveni
 
Observability at scale with Neural Networks: A more proactive approach
Observability at scale with Neural Networks: A more proactive approachObservability at scale with Neural Networks: A more proactive approach
Observability at scale with Neural Networks: A more proactive approachTech Triveni
 
Semi-Supervised Insight Generation from Petabyte Scale Text Data
Semi-Supervised Insight Generation from Petabyte Scale Text DataSemi-Supervised Insight Generation from Petabyte Scale Text Data
Semi-Supervised Insight Generation from Petabyte Scale Text DataTech Triveni
 
Finding the best solution for Image Processing
Finding the best solution for Image ProcessingFinding the best solution for Image Processing
Finding the best solution for Image ProcessingTech Triveni
 
Proximity Targeting at Scale using Big Data Platforms
Proximity Targeting at Scale using Big Data PlatformsProximity Targeting at Scale using Big Data Platforms
Proximity Targeting at Scale using Big Data PlatformsTech Triveni
 
Effecting Pure Change - How anything ever gets done in functional programming...
Effecting Pure Change - How anything ever gets done in functional programming...Effecting Pure Change - How anything ever gets done in functional programming...
Effecting Pure Change - How anything ever gets done in functional programming...Tech Triveni
 
Becoming a Functional Programmer - Harit Himanshu (Nomis Solutions)
Becoming a Functional Programmer - Harit Himanshu (Nomis Solutions)Becoming a Functional Programmer - Harit Himanshu (Nomis Solutions)
Becoming a Functional Programmer - Harit Himanshu (Nomis Solutions)Tech Triveni
 
Live coding session on AI / ML using Google Tensorflow (Python) - Tanmoy Deb ...
Live coding session on AI / ML using Google Tensorflow (Python) - Tanmoy Deb ...Live coding session on AI / ML using Google Tensorflow (Python) - Tanmoy Deb ...
Live coding session on AI / ML using Google Tensorflow (Python) - Tanmoy Deb ...Tech Triveni
 
Distributing the SMACK stack - Kubernetes VS DCOS - Sahil Sawhney (Knoldus Inc.)
Distributing the SMACK stack - Kubernetes VS DCOS - Sahil Sawhney (Knoldus Inc.)Distributing the SMACK stack - Kubernetes VS DCOS - Sahil Sawhney (Knoldus Inc.)
Distributing the SMACK stack - Kubernetes VS DCOS - Sahil Sawhney (Knoldus Inc.)Tech Triveni
 
Blue Pill / Red Pill : The Matrix of thousands of data streams - Himanshu Gup...
Blue Pill / Red Pill : The Matrix of thousands of data streams - Himanshu Gup...Blue Pill / Red Pill : The Matrix of thousands of data streams - Himanshu Gup...
Blue Pill / Red Pill : The Matrix of thousands of data streams - Himanshu Gup...Tech Triveni
 
UX in Big Data Analytics - Paramjit Jolly (Guavus)
UX in Big Data Analytics - Paramjit Jolly (Guavus)UX in Big Data Analytics - Paramjit Jolly (Guavus)
UX in Big Data Analytics - Paramjit Jolly (Guavus)Tech Triveni
 
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)Tech Triveni
 
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Tech Triveni
 
Apache CarbonData+Spark to realize data convergence and Unified high performa...
Apache CarbonData+Spark to realize data convergence and Unified high performa...Apache CarbonData+Spark to realize data convergence and Unified high performa...
Apache CarbonData+Spark to realize data convergence and Unified high performa...Tech Triveni
 

More from Tech Triveni (20)

UI Dev in Big data world using open source
UI Dev in Big data world using open sourceUI Dev in Big data world using open source
UI Dev in Big data world using open source
 
Why should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming ParadigmWhy should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming Paradigm
 
Let’s go reactive with JAVA
Let’s go reactive with JAVALet’s go reactive with JAVA
Let’s go reactive with JAVA
 
Tackling Asynchrony with Kotlin Coroutines
Tackling Asynchrony with Kotlin CoroutinesTackling Asynchrony with Kotlin Coroutines
Tackling Asynchrony with Kotlin Coroutines
 
Programmatic Ad Tracking: Let the power of Reactive Microservices do talking
Programmatic Ad Tracking: Let the power of Reactive Microservices do talkingProgrammatic Ad Tracking: Let the power of Reactive Microservices do talking
Programmatic Ad Tracking: Let the power of Reactive Microservices do talking
 
Let's refine your Scala Code
Let's refine your Scala CodeLet's refine your Scala Code
Let's refine your Scala Code
 
Supercharged imperative programming with Haskell and Functional Programming
Supercharged imperative programming with Haskell and Functional ProgrammingSupercharged imperative programming with Haskell and Functional Programming
Supercharged imperative programming with Haskell and Functional Programming
 
Observability at scale with Neural Networks: A more proactive approach
Observability at scale with Neural Networks: A more proactive approachObservability at scale with Neural Networks: A more proactive approach
Observability at scale with Neural Networks: A more proactive approach
 
Semi-Supervised Insight Generation from Petabyte Scale Text Data
Semi-Supervised Insight Generation from Petabyte Scale Text DataSemi-Supervised Insight Generation from Petabyte Scale Text Data
Semi-Supervised Insight Generation from Petabyte Scale Text Data
 
Finding the best solution for Image Processing
Finding the best solution for Image ProcessingFinding the best solution for Image Processing
Finding the best solution for Image Processing
 
Proximity Targeting at Scale using Big Data Platforms
Proximity Targeting at Scale using Big Data PlatformsProximity Targeting at Scale using Big Data Platforms
Proximity Targeting at Scale using Big Data Platforms
 
Effecting Pure Change - How anything ever gets done in functional programming...
Effecting Pure Change - How anything ever gets done in functional programming...Effecting Pure Change - How anything ever gets done in functional programming...
Effecting Pure Change - How anything ever gets done in functional programming...
 
Becoming a Functional Programmer - Harit Himanshu (Nomis Solutions)
Becoming a Functional Programmer - Harit Himanshu (Nomis Solutions)Becoming a Functional Programmer - Harit Himanshu (Nomis Solutions)
Becoming a Functional Programmer - Harit Himanshu (Nomis Solutions)
 
Live coding session on AI / ML using Google Tensorflow (Python) - Tanmoy Deb ...
Live coding session on AI / ML using Google Tensorflow (Python) - Tanmoy Deb ...Live coding session on AI / ML using Google Tensorflow (Python) - Tanmoy Deb ...
Live coding session on AI / ML using Google Tensorflow (Python) - Tanmoy Deb ...
 
Distributing the SMACK stack - Kubernetes VS DCOS - Sahil Sawhney (Knoldus Inc.)
Distributing the SMACK stack - Kubernetes VS DCOS - Sahil Sawhney (Knoldus Inc.)Distributing the SMACK stack - Kubernetes VS DCOS - Sahil Sawhney (Knoldus Inc.)
Distributing the SMACK stack - Kubernetes VS DCOS - Sahil Sawhney (Knoldus Inc.)
 
Blue Pill / Red Pill : The Matrix of thousands of data streams - Himanshu Gup...
Blue Pill / Red Pill : The Matrix of thousands of data streams - Himanshu Gup...Blue Pill / Red Pill : The Matrix of thousands of data streams - Himanshu Gup...
Blue Pill / Red Pill : The Matrix of thousands of data streams - Himanshu Gup...
 
UX in Big Data Analytics - Paramjit Jolly (Guavus)
UX in Big Data Analytics - Paramjit Jolly (Guavus)UX in Big Data Analytics - Paramjit Jolly (Guavus)
UX in Big Data Analytics - Paramjit Jolly (Guavus)
 
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
 
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)
 
Apache CarbonData+Spark to realize data convergence and Unified high performa...
Apache CarbonData+Spark to realize data convergence and Unified high performa...Apache CarbonData+Spark to realize data convergence and Unified high performa...
Apache CarbonData+Spark to realize data convergence and Unified high performa...
 

Recently uploaded

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Recently uploaded (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Reactive - Is it really a Magic Pill?

  • 2. Agenda Reactive Architecture 03 04 05 01 Introduction to Reactive Systems 01 02 Reactive Principles ? 03 Reactive Microservices 04 CQRS and Event Sourcing 0405 Key Considerations
  • 3. Base Concept Reactive Architecture Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. If you cannot solve a problem without programming, you cannot solve a problem with programming. Victor Klang
  • 4. Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text.
  • 5. Overview Reactive Architecture Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. In this talk we will explore the domain of the Reactive Applications. ● Domain Driven Design (DDD) to model the domain. ● How our domain can be partitioned into Reactive Microservices. ● Discuss concerns around scalability, consistency, and availability ● Analyze different messaging patterns. ● Command Query Responsibility Segregation and how it can be combined with Event Sourcing.
  • 7. The problem Reactive Architecture Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. The software landscape has undergone remarkable change ● Earlier ○ Tens of nodes ○ GB’s of data (often at rest) ○ Long maintenance windows ● Now ○ Hundreds and thousands of nodes ○ PB’s of data (often streaming) ○ Almost 100% uptime
  • 8.
  • 9. User Expectations Reactive Architecture Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. User expectations are huge from software today ● Modern users rely on software to do critical jobs - cannot expect downtime. ● Software is expected to respond immediately ● Unresponsive software leads to dissatisfaction - users would find a better software
  • 10. Discussion Unresponsive Software Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. Have you encountered an unresponsive software? ● What was your reaction? ● Did you reconsider the use of software? ● Did it change your impression about the company that built it? ● What did you do to overcome the challenge?
  • 11. Goal of Reactive Architecture Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. To build software ● Which scales from 10 to 10M users ● Consumes resources relevant for the current load only ● Gracefully handles failures ● Can we easily distributed across nodes, geographies ● Can give consistent level of quality irrespective of the load and stress on the system
  • 14. Responsive Most Important Reactive Principle Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. A responsive system is quick to react to all users — under blue skies and grey skies — in order to ensure a consistently positive user experience.
  • 16. Resilience Reactive Principle Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. A resilient system applies proper design and architecture principles in order to ensure responsiveness under grey skies as well as blue.
  • 18. Elastic Reactive Principle Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. A scalable system is easily upgraded on demand in order to ensure responsiveness under various load conditions.
  • 20. Message Driven Reactive Principle Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. A message-driven architecture is the foundation of Reactive applications. A message-driven application may be event-driven, actor-based, or a combination of the two.
  • 22. Discussion Responsive Software Lorem Ipsum comes from section Contrary to popular belief, Lorem Ipsum is not simply random text. Have you encountered a Responsive software? ● What was your reaction and impression? ● Do you think it was using reactive principles? ● Did it change your impression about the company that built it? ● Have you built a reactive software? ○ What benefits did you achieve?
  • 23. Reactive Programming and Systems ● Reactive systems apply reactive principals to the architecture ● Reactive programming are languages which support building reactive systems like Futures, Promises, Async communication, streams etc
  • 24. Summary ● Responsive and Unresponsive software ● Reactive Manifesto and Principles ○ Responsive ○ Resilient ○ Elastic ○ Message Driven ● Reactive programming and systems
  • 26. Monoliths Reactive Architecture ● The ball of mud represents the worst case scenario for a Monolith. ● No clear isolation in the application. ● Complex dependencies. ● Hard to understand and harder to modify.
  • 27. ● Deployed as a single unit. ● Single shared database. ● Communicate with synchronous method calls. ● Deep coupling between libraries and components (often through the DB). ● "Big Bang" style releases. ● Long cycle times (weeks to months). ● Teams carefully synchronize features and releases. Characteristics of a monolith Reactive Architecture
  • 28. Scaling a Monolith Reactive Architecture ● Multiple copies of the monolith are deployed. ● Each copy is independent. They don't communicate with each other. ● The database provides consistency between deployed instances.
  • 29. ● Easy Cross Module Refactoring. ● Easier to maintain consistency. ● Single deployment process. ● Single thing to monitor. ● Simple scalability model. Advantages Reactive Architecture
  • 30. ● Limited by the maximum size of a single physical machine. ● Only scales as far as the database will allow. ● Components must be scaled as a group. ● Deep coupling leads to inflexibility. ● Development is typically slow (change is difficult, build times long). ● Serious failures in one component often bring down the whole ● monolith. ● Redistribution of load can cause cascading failures. Disadvantages Reactive Architecture
  • 31. Next step - SOA Reactive Architecture ● We can isolate our Monolith using Service Oriented Architecture. ● Services don't share a database. ● All access must go through the API exposed by the service. ● Services may live in the same process (monolith) or separate (microservices).
  • 32. Microservices Reactive Architecture ● Microservices are a subset of SOA. ● Logical components are separated into isolated microservices. ● Microservices can be physically separated and independently deployed. ● Each component/microservice has its own independent data store. ● Microservices are independent and self governing.
  • 34. Event Sourcing in Real Life How we used to do it
  • 35. Once Upon a Time How we used to do it
  • 36. Scaling Up.. How we used to do it
  • 37. Let's Improve - Go Asynchronous . How we used to do it
  • 38. Command Vs Event Command Results in an Event Results
  • 39. Command to Event Journey of Command to Event
  • 40. Event Sourcing Journey of Command to Event
  • 42. Old Wine in New Improved Bottle What About Reads
  • 43. ES and CQRS What About Reads
  • 46. A class should have only one reason to change. Robert C. Martin ● The Single Responsibility Principle applies to object oriented classes, but works for Microservices as well. ● A microservice should have a single responsibility (eg. managing accounts). ● A change to the internals of one microservice should not necessitate a change to another microservice. SRP Reactive Architecture
  • 47. ● Bounded Contexts are a good place to start building microservices. ● They define a context in which a specific model applies. ● Further subdivision of the Bounded Context is possible. Bounded Context Reactive Architecture
  • 48. ● Scalability: A system is scalable if it can meet increases in demand while remaining responsive. ● Consistency: A system is consistent if all members of a system have the same view or state. ● Availability: A system is available if it remains responsive despite failures. Definitions
  • 49. ● Isolation provides reduced coupling and increased scalability. ● Reactive Microservices are isolated in: ○ State ○ Space ○ Time ○ Failure Principles of Isolation Reactive Architecture
  • 50. Isolation of State Reactive Architecture ● All access to a Microservice state must go through its API. ● No backdoor access via the database. ● Allows the microservice to evolve internally without affecting the outside.
  • 51. Isolation of Space Reactive Architecture ● Microservices should not care where other microservices are deployed. ● It should be possible to move a microservice to another machine, possibly in a different data center without issue. ● Allows the microservice to be scaled up/down to meet demand.
  • 52. Isolation in Time Reactive Architecture ● Microservices should not wait for each other. Requests are asynchronous and non-blocking. ○ More efficient use of resources. Resources can be freed immediately, rather than waiting for a request to finish. ● Between microservices we expect eventual consistency. ○ Provides increased scalability. Total consistency requires central coordination which limits scalability (more on this later).
  • 53. Isolation of Failure Reactive Architecture ● Reactive Microservices also isolate failure. ● A failure in one Microservice should not cause another to fail. ● Allows the system to remain operational in spite of failure.
  • 54. Discussion General rules Two trees fall in the forest. Two people hear the sound. Both trees fall at the same time. Each person is closer to a different tree. Sound travels at 340 m/s. ● If we were to ask Martin and Grace what time each tree fell at, would they give us the same answer? ● If we were to ask Martin and Grace which tree fell first, would they give us the same answer?
  • 55. ● Distributed Systems are systems that are separated by space. ● Physics puts an upper limit on information speed (The Speed of Light) ● When two systems are separated by space, there is always time required to reach consensus. ● In the time it takes to transfer the information, the state of the original sender may have changed. Problem with distributed systems
  • 56. ● Because it takes time to transfer information, the information being received is always stale. ● This applies whether we are talking about Computer systems, people, or even just the physical world. ● Reality is therefore Eventually Consistent Reality is eventual
  • 57. Eventual Consistency Eventual consistency guarantees that, in the absence of new updates, all accesses to a specific piece of data will eventually return the most recent value.
  • 58. Strong Consistency An update to a piece of data needs agreement from all nodes before it becomes visible.
  • 59. Strong Consistency Reactive Architecture ● Traditional architectures were built for Strong Consistency. ● Physics prevents Strong Consistency, so instead we simulate it. ● Locks and Transactions allow us to simulate Strong Consistency. ● The distributed problem is isolated it to a non-distributed resource. ● These techniques introduce overhead in the form of contention.
  • 60. ● Any two things that contend for a single limited resource are in competition. ● This competition can only have one winner. ● Others are forced to wait for the winner to complete. ● As the number of things competing increases, the time to free up the ● resource increases. ● As load increases we will eventually exceed acceptable time limits. Contention
  • 61. Discussion General rules Two people are collaborating on code. Strong Consistency will require that Martin and Grace both have the exact same view of the code at all times. A model based on locks will require Martin to lock the code when he wants to edit it. ● How will the need for Strong Consistency affect Grace's workflow if she also wants to edit the code? ● How do source control tools actually achieve consistency?
  • 62. ● Reactive Systems put an emphasis on asynchronous, non-blocking messages. ● Messages are sent without waiting for a response. ● The sender may be interested in a response, but it comes asynchronously. ● Is there a place in a Reactive System for Synchronous Messaging? Messaging in Reactive Systems
  • 63. ● Async messages form the backbone of Reactive Systems, but sometimes synchronous make more sense. ● Synchronous requirements can often be relaxed. In most scenarios asynchronous messaging just works fine ● Can you acknowledge the receipt of a message synchronously, but process it asynchronously? Synchronous Messaging
  • 64. ● The need for synchronous messages should be driven by domain requirements rather than technical ones. ● Best Practice: Use asynchronous by default, fallback to synchronous only when forced. ● Understand the consequences of the choice. Synchronous Messaging
  • 65. ● In a monolithic architecture, coordination and consensus building is often done using transactions. ● Microservices, Distributed Systems, and Async Messages all make transactions more difficult. ● Holding transactions open for long periods results in slow, brittle systems. ● How can we manage long running transactions that span multiple microservices? Cost of Async Messaging
  • 66. Sagas Reactive Architecture ● The Saga Pattern is a way of representing a long running transaction. ● Multiple requests are managed by a Saga. ● Individual requests are run in sequence or in parallel. ● When all requests complete, the Saga is complete. ● What happens when a request fails?
  • 67. Failure In Sagas Reactive Architecture ● Each request is paired with a compensating action. ● If any request fails, compensating actions are executed for all completed steps. ● The Saga is then completed with a failure. ● If a compensating action fails, then it is retried. This requires idempotence.
  • 68. Timeout in Distributed System Reactive Architecture
  • 69. Timeout in Distributed System Reactive Architecture ● In a Distributed System, timeouts present a difficult problem. ● A request timeout presents us with at least 3 possible scenarios. ○ The request failed. ○ The request succeeded, but the reply failed. ○ The request is still queued and may succeed (or fail) eventually. ● Because the request may have succeeded, we need to run the compensating action. ● The request may still be queued, therefore the compensating action may complete first..
  • 70. ● Compensating actions are different from rollbacks. ● Rollback: ○ Implies the transaction has not completed. ○ Removes evidence of the transaction. ● Compensation: ○ Applied on top of a previously completed action. ○ Evidence of the original action remains. Compensating and Rollback are different