SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
Reactive Systems
Naresh Chintalcheru
Agenda
Part - 1
● Intro to Reactive Systems
● Reactive Programming Vs Reactive Systems
● Why Reactive Systems
● Side-effects
● Reactive Data Access
Part - 2
● Workshop
Programming puzzle
Programming puzzle
a = 1;
b = a + 1;
a = 2;
print a; ---> 2
print b; ---> ?
Programming puzzle
a = 1;
b = a + 1;
a = 2;
print a; ---> 2
print b; ---> ?
2 or 3
Programming puzzle
a = 1;
b = a + 1;
a = 2;
print a; ---> 2
print b; ---> ?
2 3
Programming puzzle
a = 1;
b = a + 1;
a = 2;
print a; ---> 2
print b; ---> ?
2 3
Imperative Reactive
Reactive Programming Interface
Reactive Programming
Programming paradigm oriented around data flows and propagation of change
-Wiki
Functional programming with asynchronous data streams
Functional Reactive Programming
● Reactive programming is based on the functional constructs
● Functional programming principles are essential in understanding RP
● Functional programming provides Declarative, Composable and Concurrent
code
● Learn to replace loops with recursion, traverse data structures without iterators,
do input/output using monads, and dealing with Immutable data sources.
● Exceptions are side-effects that undermine type system and functional purity
Functional Programming
● Pure Functions, Higher-Order Functions, Monads, Currying and Immutable data
● Pure functions does not have side-effects, for a given inputs it always have same
output, e.g., mathematical functions
● Higher-Order Functions, functions which takes at least one more functions as
parameters and return a function (e.g., Lambds’s)
● Monads wraps data value and provide series of computational operators (e.g.,
Streams/Optional)
● Currying is technique of translating the evaluation of a function that takes
multiple arguments into evaluating a sequence of functions, each with a single
argument
Reactive Programming
Rx = Observable + Observer + Scheduler
Observable
Observable is the combination of GOF's Observer and Iterable pattern
● The ability of consumer to push elements to consumer
● The ability for the producer to signal to the consumer that there is no more data
available.
● The ability for the producer to signal to the consumer that an error has
occurred.
Reactive Programming
● Reactive applications use observable models, event
streams and stateful clients.
● Observable models enable other systems to receive events
when state changes.
Polyglot Reactive Libraries
Rx.Net, RxJava, RxJS, RxScala, RxSwift, RxRuby, RxPHP
Reactive Programming
● Imperative programming is a Pull model (hasNext, Next)
● Reactive programming is Push model, the elements will be pushed down the
stream as soon as they are available
● Difference is the direction of the data flow
Pull model & Thread Block
Consumer pulls values from the producer and the thread is blocked in the pull model
until the elements arrive.
Reactive streams
● Mouse and Keyboard interaction
● Stock Prices
● System Events
Reactive Programming vs Reactive Systems
Reactive Manifesto 2.0
Reactive Programming vs Reactive Systems
Reactive programming is about Data Flows and Change propagation
Reactive System is about Message-driven based Control Flows and System
responsiveness even under load (Scalability) or partial failure (Resilient)
Why Reactive Systems ?
Why Reactive
● The driver for Reactive is the efficient resource utilization, or in other words,
spending less money on servers and data centres
● The promise of Reactive is that you can do more with less, specifically you can
process higher loads with fewer threads
● Stagnation in CPU Clock Speed 4GHz
● Highest clock speeds requiring cooling through liquid nitrogen are stuck
between 8.5 and 9 GHz
Why Reactive
● Increased investments in parallelism for both - hardware and software
● Parallelism in hardware with Multicore processors
● Software OS support for Non-Blocking I/O
○ Linux Kernel 2.6 release in 2006, Support Asynchronous I/O, POSIX AIO API
● Rise of functional programming and Concurrency
● Cloud computing costs, microservices latency makes Reactive programming a
good choice
Benefits Reactive Streams
- Efficient in handling of system resources using
asynchronous Non-Blocking I/O
- Cost effective in Cloud
- Reactive streams are designed to solve the central issue
with asynchronous programming Backpressure
- Individual Stream items can be on specialized hardware
(GPU, APU, RDMA)
Remote Direct Memory Access (RDMA) is a technology that allows computers in a network to exchange data in main memory without
involving the CPU
Backpressure
What is Backpressure ?
What is Backpressure
Observable is emitting items more rapidly than an operator or
observer can consume.
Backpressure Overflow Strategy
FluxSink.OverflowStrategy.BUFFER
Buffer all signals if the downstream can't keep up
FluxSink.OverflowStrategy.DROP
Drop the incoming signal if the downstream is not ready to receive it
FluxSink.OverflowStrategy.ERROR
Signal an IllegalStateException when the downstream can't keep up
FluxSink.OverflowStrategy.IGNORE
Completely ignore downstream backpressure requests
FluxSink.OverflowStrategy.LATEST
Downstream will get only the latest signals from upstream
Node.js & Reactive Programming
● Node runs on single thread and excellent choice for I/O based processing
● Node supports Streams similar to Java but imperative streams. The data flows
and change propagation are missing
● Libraries just RxJS, bacon.js add reactive abstraction over Node.js
Reactive Libraries on JVM
● RxJava
● Spring Reactor
● Vert.x
● Java v9 Flow APIs
How Reactive Libraries Work
● Graph Processing algorithm that captures the
dependencies among the reactive values and the language
runtime uses the graph to keep track of which
computations must be executed again when one of the
inputs changes
● Change propagation techniques Pull, Push or Hybrid
Reactive Stream Specification (RS)
Reactive Streams standard for Asynchronous Stream processing with Non-blocking
Back Pressure
Runtime environments (JVM and JavaScript) as well as network protocols
www.reactive-streams.org
Spring Reactor
Spring Reactor Architecture
Reactor Types
Reactor supports two types
● Flux<T>
● Mono<T>
Flux (Publisher/Observable)
Flux is a Reactive Streams Publisher with rx operators that emits 0 to N elements,
and then completes (successfully or with an error).
Observer subscribes to an Observable, Observer reacts/operates to item or
sequence of items the Observable emits
Mono (Publisher/Observable)
Mono is a Reactive Streams Publisher with rx operators that emits 0 to 1 elements,
and then completes (successfully or with an error)
Reactor code
Reactor code
Reactor code
Reactor code
Reactor code
Non-Blocking
ParallelFlux<T> parallel()
Prepare to consume this Flux on number of 'rails' matching number of CPU Cores
in round-robin fashion.
ParallelFlux<T> parallel(int parallelism)
Prepare to consume this Flux on parallelism number of 'rails' in round-robin fashion.
ParallelFlux<T> parallel(int parallelism, int prefetch)
Prepare to consume this Flux on parallelism number of 'rails' in round-robin fashion
and use custom prefetch amount and queue for dealing with the source Flux's
values.
Operators
Operators operate on Observables
Operators By Category
● Creating Observables
● Transforming Observables
● Filtering Observables
● Combining Observables
● Backpressure Observables
Stateful/Stateless Operators
● Stateless Operators - filter, flatMap
● Stateful Operators - Sort, Distinct
Streaming Database Access
Reactive Data Access
● Couchbase Reactive Streams Java SDK Driver, providing asynchronous
stream processing with non-blocking backpressure.
● Fully implements the Reactive Streams API for providing interop with other
reactive streams within the JVM ecosystem.
Reactive Data Access
List<JsonDocument> comments =
bucket
.async()
.get("post::1")
.flatMap(post -> Observable.from(post.content().getArray("comments").toList()))
.flatMap(commentId -> bucket.async().get((String) commentId))
.filter(comment -> comment.content().getBoolean("published"))
.take(2)
Workshop
Ref
https://www.ibm.com/developerworks/library/l-async/
https://projectreactor.io/docs/core/release/api/
http://reactivex.io/documentation/operators/backpressure.html
https://en.wikipedia.org/wiki/Reactive_programming

Weitere ähnliche Inhalte

Was ist angesagt?

IEC 61131-3 PLC Programming Languages: Beyond Ladder Logic
IEC 61131-3 PLC Programming Languages:  Beyond Ladder LogicIEC 61131-3 PLC Programming Languages:  Beyond Ladder Logic
IEC 61131-3 PLC Programming Languages: Beyond Ladder LogicDrives & Systems
 
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...Flink Forward
 
Real Time Application Interface for Linux
Real Time Application Interface for LinuxReal Time Application Interface for Linux
Real Time Application Interface for LinuxSarah Hussein
 
automation part 1
automation part 1automation part 1
automation part 1ainteoh
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE
 
Adam_Mcconnell_SPR11_v3
Adam_Mcconnell_SPR11_v3Adam_Mcconnell_SPR11_v3
Adam_Mcconnell_SPR11_v3Adam McConnell
 
ProFAX - Implementation (Short version)
ProFAX - Implementation (Short version)ProFAX - Implementation (Short version)
ProFAX - Implementation (Short version)ProFAX
 
Adaptive indexing throttling
Adaptive indexing throttling Adaptive indexing throttling
Adaptive indexing throttling Arpit Jain
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes dilip kumar
 
Processors in a nutshell
Processors in a nutshellProcessors in a nutshell
Processors in a nutshellIkuru Kanuma
 
The Legion Programming Model for HPC
The Legion Programming Model for HPCThe Legion Programming Model for HPC
The Legion Programming Model for HPCinside-BigData.com
 
ITFT_Semaphores and bounded buffer
ITFT_Semaphores and bounded bufferITFT_Semaphores and bounded buffer
ITFT_Semaphores and bounded bufferSneh Prabha
 

Was ist angesagt? (20)

IEC 61131-3 PLC Programming Languages: Beyond Ladder Logic
IEC 61131-3 PLC Programming Languages:  Beyond Ladder LogicIEC 61131-3 PLC Programming Languages:  Beyond Ladder Logic
IEC 61131-3 PLC Programming Languages: Beyond Ladder Logic
 
PLC Basics
PLC BasicsPLC Basics
PLC Basics
 
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
 
Router3
Router3Router3
Router3
 
Real Time Application Interface for Linux
Real Time Application Interface for LinuxReal Time Application Interface for Linux
Real Time Application Interface for Linux
 
automation part 1
automation part 1automation part 1
automation part 1
 
Tools and Methods for Continuously Expanding Software Applications
Tools and Methods for Continuously Expanding Software ApplicationsTools and Methods for Continuously Expanding Software Applications
Tools and Methods for Continuously Expanding Software Applications
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
 
Adam_Mcconnell_SPR11_v3
Adam_Mcconnell_SPR11_v3Adam_Mcconnell_SPR11_v3
Adam_Mcconnell_SPR11_v3
 
ProFAX - Implementation (Short version)
ProFAX - Implementation (Short version)ProFAX - Implementation (Short version)
ProFAX - Implementation (Short version)
 
Unit - 5 Pipelining.pptx
Unit - 5 Pipelining.pptxUnit - 5 Pipelining.pptx
Unit - 5 Pipelining.pptx
 
Adaptive indexing throttling
Adaptive indexing throttling Adaptive indexing throttling
Adaptive indexing throttling
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes
 
Værktøjer udviklet på AAU til analyse af SCJ programmer
Værktøjer udviklet på AAU til analyse af SCJ programmerVærktøjer udviklet på AAU til analyse af SCJ programmer
Værktøjer udviklet på AAU til analyse af SCJ programmer
 
Rtai
RtaiRtai
Rtai
 
Processors in a nutshell
Processors in a nutshellProcessors in a nutshell
Processors in a nutshell
 
The Legion Programming Model for HPC
The Legion Programming Model for HPCThe Legion Programming Model for HPC
The Legion Programming Model for HPC
 
Project ppt
Project pptProject ppt
Project ppt
 
Parallel concepts1
Parallel concepts1Parallel concepts1
Parallel concepts1
 
ITFT_Semaphores and bounded buffer
ITFT_Semaphores and bounded bufferITFT_Semaphores and bounded buffer
ITFT_Semaphores and bounded buffer
 

Ähnlich wie Reactive systems

Solve it Differently with Reactive Programming
Solve it Differently with Reactive ProgrammingSolve it Differently with Reactive Programming
Solve it Differently with Reactive ProgrammingSupun Dissanayake
 
Springone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorSpringone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorStéphane Maldini
 
Architectual Comparison of Apache Apex and Spark Streaming
Architectual Comparison of Apache Apex and Spark StreamingArchitectual Comparison of Apache Apex and Spark Streaming
Architectual Comparison of Apache Apex and Spark StreamingApache Apex
 
Introduction to Akka Streams
Introduction to Akka StreamsIntroduction to Akka Streams
Introduction to Akka StreamsKnoldus Inc.
 
Reactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project ReactorReactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project ReactorKnoldus Inc.
 
Reactive Programming
Reactive ProgrammingReactive Programming
Reactive ProgrammingKnoldus Inc.
 
Intro to Apache Apex (next gen Hadoop) & comparison to Spark Streaming
Intro to Apache Apex (next gen Hadoop) & comparison to Spark StreamingIntro to Apache Apex (next gen Hadoop) & comparison to Spark Streaming
Intro to Apache Apex (next gen Hadoop) & comparison to Spark StreamingApache Apex
 
Apache Apex: Stream Processing Architecture and Applications
Apache Apex: Stream Processing Architecture and ApplicationsApache Apex: Stream Processing Architecture and Applications
Apache Apex: Stream Processing Architecture and ApplicationsThomas Weise
 
Apache Apex: Stream Processing Architecture and Applications
Apache Apex: Stream Processing Architecture and Applications Apache Apex: Stream Processing Architecture and Applications
Apache Apex: Stream Processing Architecture and Applications Comsysto Reply GmbH
 
Reactive Streams, Linking Reactive Application To Spark Streaming
Reactive Streams, Linking Reactive Application To Spark StreamingReactive Streams, Linking Reactive Application To Spark Streaming
Reactive Streams, Linking Reactive Application To Spark StreamingSpark Summit
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingAraf Karsh Hamid
 
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and TransformIntro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and TransformApache Apex
 
Reactive in Android and Beyond Rx
Reactive in Android and Beyond RxReactive in Android and Beyond Rx
Reactive in Android and Beyond RxFabio Tiriticco
 
IPT Reactive Java IoT Demo - BGOUG 2018
IPT Reactive Java IoT Demo - BGOUG 2018IPT Reactive Java IoT Demo - BGOUG 2018
IPT Reactive Java IoT Demo - BGOUG 2018Trayan Iliev
 
Intro to Apache Apex @ Women in Big Data
Intro to Apache Apex @ Women in Big DataIntro to Apache Apex @ Women in Big Data
Intro to Apache Apex @ Women in Big DataApache Apex
 
IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016Trayan Iliev
 
Real-time Stream Processing using Apache Apex
Real-time Stream Processing using Apache ApexReal-time Stream Processing using Apache Apex
Real-time Stream Processing using Apache ApexApache Apex
 

Ähnlich wie Reactive systems (20)

Solve it Differently with Reactive Programming
Solve it Differently with Reactive ProgrammingSolve it Differently with Reactive Programming
Solve it Differently with Reactive Programming
 
Springone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorSpringone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and Reactor
 
c-quilibrium R forecasting integration
c-quilibrium R forecasting integrationc-quilibrium R forecasting integration
c-quilibrium R forecasting integration
 
Architectual Comparison of Apache Apex and Spark Streaming
Architectual Comparison of Apache Apex and Spark StreamingArchitectual Comparison of Apache Apex and Spark Streaming
Architectual Comparison of Apache Apex and Spark Streaming
 
Introduction to Akka Streams
Introduction to Akka StreamsIntroduction to Akka Streams
Introduction to Akka Streams
 
Reactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project ReactorReactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project Reactor
 
Reactive Programming
Reactive ProgrammingReactive Programming
Reactive Programming
 
Intro to Apache Apex (next gen Hadoop) & comparison to Spark Streaming
Intro to Apache Apex (next gen Hadoop) & comparison to Spark StreamingIntro to Apache Apex (next gen Hadoop) & comparison to Spark Streaming
Intro to Apache Apex (next gen Hadoop) & comparison to Spark Streaming
 
Apache Apex: Stream Processing Architecture and Applications
Apache Apex: Stream Processing Architecture and ApplicationsApache Apex: Stream Processing Architecture and Applications
Apache Apex: Stream Processing Architecture and Applications
 
Apache Apex: Stream Processing Architecture and Applications
Apache Apex: Stream Processing Architecture and Applications Apache Apex: Stream Processing Architecture and Applications
Apache Apex: Stream Processing Architecture and Applications
 
Reactive Streams, Linking Reactive Application To Spark Streaming
Reactive Streams, Linking Reactive Application To Spark StreamingReactive Streams, Linking Reactive Application To Spark Streaming
Reactive Streams, Linking Reactive Application To Spark Streaming
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive Programming
 
RxSwift
RxSwiftRxSwift
RxSwift
 
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and TransformIntro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
 
Reactive Applications in Java
Reactive Applications in JavaReactive Applications in Java
Reactive Applications in Java
 
Reactive in Android and Beyond Rx
Reactive in Android and Beyond RxReactive in Android and Beyond Rx
Reactive in Android and Beyond Rx
 
IPT Reactive Java IoT Demo - BGOUG 2018
IPT Reactive Java IoT Demo - BGOUG 2018IPT Reactive Java IoT Demo - BGOUG 2018
IPT Reactive Java IoT Demo - BGOUG 2018
 
Intro to Apache Apex @ Women in Big Data
Intro to Apache Apex @ Women in Big DataIntro to Apache Apex @ Women in Big Data
Intro to Apache Apex @ Women in Big Data
 
IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016
 
Real-time Stream Processing using Apache Apex
Real-time Stream Processing using Apache ApexReal-time Stream Processing using Apache Apex
Real-time Stream Processing using Apache Apex
 

Mehr von Naresh Chintalcheru

Bimodal IT for Speed and Innovation
Bimodal IT for Speed and InnovationBimodal IT for Speed and Innovation
Bimodal IT for Speed and InnovationNaresh Chintalcheru
 
Introduction to Node.js Platform
Introduction to Node.js PlatformIntroduction to Node.js Platform
Introduction to Node.js PlatformNaresh Chintalcheru
 
3rd Generation Web Application Platforms
3rd Generation Web Application Platforms3rd Generation Web Application Platforms
3rd Generation Web Application PlatformsNaresh Chintalcheru
 
Asynchronous Processing in Java/JEE/Spring
Asynchronous Processing in Java/JEE/SpringAsynchronous Processing in Java/JEE/Spring
Asynchronous Processing in Java/JEE/SpringNaresh Chintalcheru
 
Problems opening SOA to the Online Web Applications
Problems opening SOA to the Online Web ApplicationsProblems opening SOA to the Online Web Applications
Problems opening SOA to the Online Web ApplicationsNaresh Chintalcheru
 
Lie Cheat & Steal to build Hyper-Fast Applications using Event-Driven Archite...
Lie Cheat & Steal to build Hyper-Fast Applications using Event-Driven Archite...Lie Cheat & Steal to build Hyper-Fast Applications using Event-Driven Archite...
Lie Cheat & Steal to build Hyper-Fast Applications using Event-Driven Archite...Naresh Chintalcheru
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code ExamplesNaresh Chintalcheru
 
Design & Develop Batch Applications in Java/JEE
Design & Develop Batch Applications in Java/JEEDesign & Develop Batch Applications in Java/JEE
Design & Develop Batch Applications in Java/JEENaresh Chintalcheru
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsNaresh Chintalcheru
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using SeleniumNaresh Chintalcheru
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Naresh Chintalcheru
 
Object-Oriented Polymorphism Unleashed
Object-Oriented Polymorphism UnleashedObject-Oriented Polymorphism Unleashed
Object-Oriented Polymorphism UnleashedNaresh Chintalcheru
 

Mehr von Naresh Chintalcheru (16)

Cars.com Journey to AWS Cloud
Cars.com Journey to AWS CloudCars.com Journey to AWS Cloud
Cars.com Journey to AWS Cloud
 
Bimodal IT for Speed and Innovation
Bimodal IT for Speed and InnovationBimodal IT for Speed and Innovation
Bimodal IT for Speed and Innovation
 
Introduction to Node.js Platform
Introduction to Node.js PlatformIntroduction to Node.js Platform
Introduction to Node.js Platform
 
3rd Generation Web Application Platforms
3rd Generation Web Application Platforms3rd Generation Web Application Platforms
3rd Generation Web Application Platforms
 
Asynchronous Processing in Java/JEE/Spring
Asynchronous Processing in Java/JEE/SpringAsynchronous Processing in Java/JEE/Spring
Asynchronous Processing in Java/JEE/Spring
 
Problems opening SOA to the Online Web Applications
Problems opening SOA to the Online Web ApplicationsProblems opening SOA to the Online Web Applications
Problems opening SOA to the Online Web Applications
 
Lie Cheat & Steal to build Hyper-Fast Applications using Event-Driven Archite...
Lie Cheat & Steal to build Hyper-Fast Applications using Event-Driven Archite...Lie Cheat & Steal to build Hyper-Fast Applications using Event-Driven Archite...
Lie Cheat & Steal to build Hyper-Fast Applications using Event-Driven Archite...
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code Examples
 
Big Trends in Big Data
Big Trends in Big DataBig Trends in Big Data
Big Trends in Big Data
 
Design & Develop Batch Applications in Java/JEE
Design & Develop Batch Applications in Java/JEEDesign & Develop Batch Applications in Java/JEE
Design & Develop Batch Applications in Java/JEE
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets
 
Mule ESB Fundamentals
Mule ESB FundamentalsMule ESB Fundamentals
Mule ESB Fundamentals
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC
 
Android Platform Architecture
Android Platform ArchitectureAndroid Platform Architecture
Android Platform Architecture
 
Object-Oriented Polymorphism Unleashed
Object-Oriented Polymorphism UnleashedObject-Oriented Polymorphism Unleashed
Object-Oriented Polymorphism Unleashed
 

Kürzlich hochgeladen

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
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
 
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
 
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
 
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
 
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
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
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
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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
 

Kürzlich hochgeladen (20)

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
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 ...
 
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
 
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
 
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
 
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
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
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
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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...
 
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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
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
 

Reactive systems

  • 2. Agenda Part - 1 ● Intro to Reactive Systems ● Reactive Programming Vs Reactive Systems ● Why Reactive Systems ● Side-effects ● Reactive Data Access Part - 2 ● Workshop
  • 4. Programming puzzle a = 1; b = a + 1; a = 2; print a; ---> 2 print b; ---> ?
  • 5.
  • 6. Programming puzzle a = 1; b = a + 1; a = 2; print a; ---> 2 print b; ---> ? 2 or 3
  • 7. Programming puzzle a = 1; b = a + 1; a = 2; print a; ---> 2 print b; ---> ? 2 3
  • 8. Programming puzzle a = 1; b = a + 1; a = 2; print a; ---> 2 print b; ---> ? 2 3 Imperative Reactive
  • 10. Reactive Programming Programming paradigm oriented around data flows and propagation of change -Wiki Functional programming with asynchronous data streams
  • 11. Functional Reactive Programming ● Reactive programming is based on the functional constructs ● Functional programming principles are essential in understanding RP ● Functional programming provides Declarative, Composable and Concurrent code ● Learn to replace loops with recursion, traverse data structures without iterators, do input/output using monads, and dealing with Immutable data sources. ● Exceptions are side-effects that undermine type system and functional purity
  • 12. Functional Programming ● Pure Functions, Higher-Order Functions, Monads, Currying and Immutable data ● Pure functions does not have side-effects, for a given inputs it always have same output, e.g., mathematical functions ● Higher-Order Functions, functions which takes at least one more functions as parameters and return a function (e.g., Lambds’s) ● Monads wraps data value and provide series of computational operators (e.g., Streams/Optional) ● Currying is technique of translating the evaluation of a function that takes multiple arguments into evaluating a sequence of functions, each with a single argument
  • 13. Reactive Programming Rx = Observable + Observer + Scheduler
  • 14. Observable Observable is the combination of GOF's Observer and Iterable pattern ● The ability of consumer to push elements to consumer ● The ability for the producer to signal to the consumer that there is no more data available. ● The ability for the producer to signal to the consumer that an error has occurred.
  • 15. Reactive Programming ● Reactive applications use observable models, event streams and stateful clients. ● Observable models enable other systems to receive events when state changes.
  • 16. Polyglot Reactive Libraries Rx.Net, RxJava, RxJS, RxScala, RxSwift, RxRuby, RxPHP
  • 17. Reactive Programming ● Imperative programming is a Pull model (hasNext, Next) ● Reactive programming is Push model, the elements will be pushed down the stream as soon as they are available ● Difference is the direction of the data flow
  • 18. Pull model & Thread Block Consumer pulls values from the producer and the thread is blocked in the pull model until the elements arrive.
  • 19. Reactive streams ● Mouse and Keyboard interaction ● Stock Prices ● System Events
  • 20. Reactive Programming vs Reactive Systems
  • 22. Reactive Programming vs Reactive Systems Reactive programming is about Data Flows and Change propagation Reactive System is about Message-driven based Control Flows and System responsiveness even under load (Scalability) or partial failure (Resilient)
  • 24. Why Reactive ● The driver for Reactive is the efficient resource utilization, or in other words, spending less money on servers and data centres ● The promise of Reactive is that you can do more with less, specifically you can process higher loads with fewer threads ● Stagnation in CPU Clock Speed 4GHz ● Highest clock speeds requiring cooling through liquid nitrogen are stuck between 8.5 and 9 GHz
  • 25. Why Reactive ● Increased investments in parallelism for both - hardware and software ● Parallelism in hardware with Multicore processors ● Software OS support for Non-Blocking I/O ○ Linux Kernel 2.6 release in 2006, Support Asynchronous I/O, POSIX AIO API ● Rise of functional programming and Concurrency ● Cloud computing costs, microservices latency makes Reactive programming a good choice
  • 26. Benefits Reactive Streams - Efficient in handling of system resources using asynchronous Non-Blocking I/O - Cost effective in Cloud - Reactive streams are designed to solve the central issue with asynchronous programming Backpressure - Individual Stream items can be on specialized hardware (GPU, APU, RDMA) Remote Direct Memory Access (RDMA) is a technology that allows computers in a network to exchange data in main memory without involving the CPU
  • 28. What is Backpressure Observable is emitting items more rapidly than an operator or observer can consume.
  • 29. Backpressure Overflow Strategy FluxSink.OverflowStrategy.BUFFER Buffer all signals if the downstream can't keep up FluxSink.OverflowStrategy.DROP Drop the incoming signal if the downstream is not ready to receive it FluxSink.OverflowStrategy.ERROR Signal an IllegalStateException when the downstream can't keep up FluxSink.OverflowStrategy.IGNORE Completely ignore downstream backpressure requests FluxSink.OverflowStrategy.LATEST Downstream will get only the latest signals from upstream
  • 30. Node.js & Reactive Programming ● Node runs on single thread and excellent choice for I/O based processing ● Node supports Streams similar to Java but imperative streams. The data flows and change propagation are missing ● Libraries just RxJS, bacon.js add reactive abstraction over Node.js
  • 31. Reactive Libraries on JVM ● RxJava ● Spring Reactor ● Vert.x ● Java v9 Flow APIs
  • 32. How Reactive Libraries Work ● Graph Processing algorithm that captures the dependencies among the reactive values and the language runtime uses the graph to keep track of which computations must be executed again when one of the inputs changes ● Change propagation techniques Pull, Push or Hybrid
  • 33. Reactive Stream Specification (RS) Reactive Streams standard for Asynchronous Stream processing with Non-blocking Back Pressure Runtime environments (JVM and JavaScript) as well as network protocols www.reactive-streams.org
  • 36. Reactor Types Reactor supports two types ● Flux<T> ● Mono<T>
  • 37. Flux (Publisher/Observable) Flux is a Reactive Streams Publisher with rx operators that emits 0 to N elements, and then completes (successfully or with an error). Observer subscribes to an Observable, Observer reacts/operates to item or sequence of items the Observable emits
  • 38. Mono (Publisher/Observable) Mono is a Reactive Streams Publisher with rx operators that emits 0 to 1 elements, and then completes (successfully or with an error)
  • 44. Non-Blocking ParallelFlux<T> parallel() Prepare to consume this Flux on number of 'rails' matching number of CPU Cores in round-robin fashion. ParallelFlux<T> parallel(int parallelism) Prepare to consume this Flux on parallelism number of 'rails' in round-robin fashion. ParallelFlux<T> parallel(int parallelism, int prefetch) Prepare to consume this Flux on parallelism number of 'rails' in round-robin fashion and use custom prefetch amount and queue for dealing with the source Flux's values.
  • 45. Operators Operators operate on Observables Operators By Category ● Creating Observables ● Transforming Observables ● Filtering Observables ● Combining Observables ● Backpressure Observables
  • 46. Stateful/Stateless Operators ● Stateless Operators - filter, flatMap ● Stateful Operators - Sort, Distinct
  • 48. Reactive Data Access ● Couchbase Reactive Streams Java SDK Driver, providing asynchronous stream processing with non-blocking backpressure. ● Fully implements the Reactive Streams API for providing interop with other reactive streams within the JVM ecosystem.
  • 49. Reactive Data Access List<JsonDocument> comments = bucket .async() .get("post::1") .flatMap(post -> Observable.from(post.content().getArray("comments").toList())) .flatMap(commentId -> bucket.async().get((String) commentId)) .filter(comment -> comment.content().getBoolean("published")) .take(2)