SlideShare a Scribd company logo
RX JAVA
MATEUSZ BUKOWICZ
REACTIVEX
REACTIVE SUPPORT IN DIFFERENT LANGUAGES
REACTIVE EXTENSIONS
▸ Rx.Net
▸ RxJava
▸ RxJS
▸ RxScala
▸ RxClojure
▸ RxCpp
▸ Rx.rb
▸ RxPY
▸ RxGroovy
▸ RxJRuby
▸ RxKotlin
▸ RxSwift
HOW IT BEGAN
RX.NET
▸ Rx.NET released in 2009
▸ Shipped with .NET 4.0 (2010)
AN API FOR ASYNCHRONOUS
PROGRAMMING WITH
OBSERVABLE STREAMS.
reactivex.io
DEFINITION
OBSERVER AGAIN
OBSERVER PATTERN
https://en.wikipedia.org/wiki/Observer_pattern
Observable
WHAT IS REACTIVE?
REACTIVE MANIFESTO
▸ responsive
▸ resilient
▸ elastic
▸ message-driven
REACTIVE CAN BE REPULSIVE
REACTIVE MANIFESTO CONTROVERSY
REACTIVE AS A LIFESTYLE
REACTIVE PROGRAMMING
OLD WAY OF DOING THINGS
PROCEDURAL WAY
FROM PROCEDURAL TO FUNCTIONAL
FUNCTIONAL WAY
FROM FUNCTIONAL TO REACTIVE
REACTIVE WAY
HOW TO OBSERVE?
ITERABLE VS OBSERVABLE
http://reactivex.io/intro.html
OBSERVER OBSERVES
OBSERVER USAGE
OPERATORS - FILTER
FILTER
http://rxmarbles.com/#filter
OPERATORS - TAKE
TAKE
http://rxmarbles.com/#take
OPERATORS - ZIP
ZIP
http://rxmarbles.com/#zip
WHICH OPERATORS SHOULD I USE?
OPERATORS DECISION TREE
http://reactivex.io/documentation/operators.html#tree
NETFLIX OLD WAY - PROBLEM
http://techblog.netflix.com/2012/07/embracing-differences-inside-netflix.html
NETFLIX OLD WAY - PROBLEM
http://techblog.netflix.com/2012/07/embracing-differences-inside-netflix.html
NETFLIX OLD WAY - PROBLEM
http://techblog.netflix.com/2013/01/optimizing-netflix-api.html
NETFLIX NEW WAY - SOLUTION
http://techblog.netflix.com/2013/01/optimizing-netflix-api.html
THINK ABOUT THE FUTURE
single item multiple items
sync T getData() Iterable<T> getData()
async Future<T> getData() ?
List<Future<T>> getData()
A NEW GUY COMES IN
RX.NET IS SO COOL
OBSERVABLE TO THE RESCUE
single item multiple items
sync T getData() Iterable<T> getData()
async Future<T> getData()
Observable<T>
getData()
NETFLIX NEW WAY - SOLUTION
http://techblog.netflix.com/2012/07/embracing-differences-inside-netflix.html
NETFLIX NEW WAY - SOLUTION
http://techblog.netflix.com/2012/07/embracing-differences-inside-netflix.html
http://techblog.netflix.com/2013/02/rxjava-netflix-api.html
PARALLEL WORK
CONCURRENCY
▸ most operators - synchronous by default
▸ some operators - implicit concurrency
▸ programmatic concurrency: observeOn/subscribeOn
http://reactivex.io/documentation/scheduler.html
can be anywhere
RX.JAVA SCHEDULERS
SCHEDULERS
http://reactivex.io/documentation/scheduler.html
SCHEDULERS IN ACTION
REACTIVE ANDROID
RX ANDROID
ERROR HANDLING
ON ERROR RESUME NEXT
http://reactivex.io/documentation/operators/catch.html
OH, MY BACK!
BACK PRESSURE
BACKPRESSURE-RELATED OPERATORS
BUFFER OPERATOR
https://github.com/ReactiveX/RxJava/wiki/Backpressure
BACK PRESSURE
ON BACKPRESSURE BUFFER
https://github.com/ReactiveX/RxJava/wiki/Backpressure
MORE RESILIENT RX.JAVA
HYSTRIX + RX.JAVA
https://github.com/Netflix/Hystrix/wiki/How-To-Use#Reactive-Execution
CIRCUIT BREAKER
CLOSED
OPENHALF-OPEN
failure threshold
reached
timeout timer
expired
operation failed
success count
threshold reached
always
return
failure
increment failure
counter on failure
increment
success
counter on
success
start
REACTIVE NETTY
RX NETTY
https://github.com/Netflix-Skunkworks/WSPerfLab/blob/master/test-results/RxNetty_vs_Tomcat_April2015.pdf
CPU saturated
clients
req/s avg lat [ms]
RX NETTY VS TOMCAT
WHY RX NETTY IS BETTER?
▸ lower CPU consumption
▸ lower object allocation rate/less GC
▸ event loop architecture vs thread pool architecture
▸ no thread pool locks
▸ less thread migrations
▸ more CPU Instructions Per Cycle (IPC)
https://github.com/Netflix-Skunkworks/WSPerfLab/blob/master/test-results/RxNetty_vs_Tomcat_April2015.pdf
REACTIVE STREAMS - INITIATIVE
http://www.reactive-streams.org
REACTIVE STREAMS - SCOPE
http://www.reactive-streams.org
FUTURE IS REACTIVE
JAVA 9 FLOW API
▸ JDK 9.0
▸ RxJava 2.x -> Reactive Streams implementation
▸ JPA -> Hibernate
▸ Reactive Streams -> RxJava 2.x
THE END

More Related Content

What's hot

Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use casesFabio Biondi
 
Java 8, Streams & Collectors, patterns, performances and parallelization
Java 8, Streams & Collectors, patterns, performances and parallelizationJava 8, Streams & Collectors, patterns, performances and parallelization
Java 8, Streams & Collectors, patterns, performances and parallelizationJosé Paumard
 
Intro to react native
Intro to react nativeIntro to react native
Intro to react nativeModusJesus
 
Whitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applicationsWhitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applicationsYura Nosenko
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJSBrainhub
 
Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular Jalpesh Vadgama
 
java 8 new features
java 8 new features java 8 new features
java 8 new features Rohit Verma
 
Intro To React Native
Intro To React NativeIntro To React Native
Intro To React NativeFITC
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux IntroductionNikolaus Graf
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentationThanh Tuong
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJSHoang Long
 
Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Toshiaki Maki
 
Top 50 Node.js Interview Questions and Answers | Edureka
Top 50 Node.js Interview Questions and Answers | EdurekaTop 50 Node.js Interview Questions and Answers | Edureka
Top 50 Node.js Interview Questions and Answers | EdurekaEdureka!
 
Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8AppDynamics
 
React Context API
React Context APIReact Context API
React Context APINodeXperts
 
Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5Richard Langlois P. Eng.
 

What's hot (20)

Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use cases
 
Java 8, Streams & Collectors, patterns, performances and parallelization
Java 8, Streams & Collectors, patterns, performances and parallelizationJava 8, Streams & Collectors, patterns, performances and parallelization
Java 8, Streams & Collectors, patterns, performances and parallelization
 
Intro to react native
Intro to react nativeIntro to react native
Intro to react native
 
Whitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applicationsWhitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applications
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJS
 
Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
 
java 8 new features
java 8 new features java 8 new features
java 8 new features
 
Intro To React Native
Intro To React NativeIntro To React Native
Intro To React Native
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1
 
Top 50 Node.js Interview Questions and Answers | Edureka
Top 50 Node.js Interview Questions and Answers | EdurekaTop 50 Node.js Interview Questions and Answers | Edureka
Top 50 Node.js Interview Questions and Answers | Edureka
 
Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8
 
React Context API
React Context APIReact Context API
React Context API
 
Reactive programming intro
Reactive programming introReactive programming intro
Reactive programming intro
 
Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5
 

Viewers also liked

Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaAli Muzaffar
 
Reactive in Android and Beyond Rx
Reactive in Android and Beyond RxReactive in Android and Beyond Rx
Reactive in Android and Beyond RxFabio Tiriticco
 
Sword fighting with Dagger GDG-NYC Jan 2016
 Sword fighting with Dagger GDG-NYC Jan 2016 Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016Mike Nakhimovich
 
Intro to Functional Programming with RxJava
Intro to Functional Programming with RxJavaIntro to Functional Programming with RxJava
Intro to Functional Programming with RxJavaMike Nakhimovich
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for AndroidTomáš Kypta
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaRick Warren
 
Supercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactSupercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactJohn McClean
 
Rx Presentation for Adults
Rx Presentation for AdultsRx Presentation for Adults
Rx Presentation for AdultsTaosAlive
 
Exception log practical_coding_guide, 예외와 로그 코딩 실용 가이드
Exception log practical_coding_guide, 예외와 로그 코딩 실용 가이드Exception log practical_coding_guide, 예외와 로그 코딩 실용 가이드
Exception log practical_coding_guide, 예외와 로그 코딩 실용 가이드도형 임
 
Java 8 Stream API and RxJava Comparison
Java 8 Stream API and RxJava ComparisonJava 8 Stream API and RxJava Comparison
Java 8 Stream API and RxJava ComparisonJosé Paumard
 
코딩소림사 Rx java
코딩소림사 Rx java코딩소림사 Rx java
코딩소림사 Rx javaByeongsu Kang
 

Viewers also liked (12)

Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJava
 
Introduction to Reactive Java
Introduction to Reactive JavaIntroduction to Reactive Java
Introduction to Reactive Java
 
Reactive in Android and Beyond Rx
Reactive in Android and Beyond RxReactive in Android and Beyond Rx
Reactive in Android and Beyond Rx
 
Sword fighting with Dagger GDG-NYC Jan 2016
 Sword fighting with Dagger GDG-NYC Jan 2016 Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016
 
Intro to Functional Programming with RxJava
Intro to Functional Programming with RxJavaIntro to Functional Programming with RxJava
Intro to Functional Programming with RxJava
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
 
Supercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-reactSupercharged java 8 : with cyclops-react
Supercharged java 8 : with cyclops-react
 
Rx Presentation for Adults
Rx Presentation for AdultsRx Presentation for Adults
Rx Presentation for Adults
 
Exception log practical_coding_guide, 예외와 로그 코딩 실용 가이드
Exception log practical_coding_guide, 예외와 로그 코딩 실용 가이드Exception log practical_coding_guide, 예외와 로그 코딩 실용 가이드
Exception log practical_coding_guide, 예외와 로그 코딩 실용 가이드
 
Java 8 Stream API and RxJava Comparison
Java 8 Stream API and RxJava ComparisonJava 8 Stream API and RxJava Comparison
Java 8 Stream API and RxJava Comparison
 
코딩소림사 Rx java
코딩소림사 Rx java코딩소림사 Rx java
코딩소림사 Rx java
 

Similar to rx-java-presentation

Cycle.js a reactive framework
Cycle.js  a reactive frameworkCycle.js  a reactive framework
Cycle.js a reactive frameworkluca mezzalira
 
Reactive microservices with eclipse vert.x
Reactive microservices with eclipse vert.xReactive microservices with eclipse vert.x
Reactive microservices with eclipse vert.xRam Maddali
 
Serverless forwardjs
Serverless forwardjsServerless forwardjs
Serverless forwardjsUpkar Lidder
 
Functional Web Development
Functional Web DevelopmentFunctional Web Development
Functional Web DevelopmentFITC
 
[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1Rubens Dos Santos Filho
 
A React Journey
A React JourneyA React Journey
A React JourneyLinkMe Srl
 
BASICS OF VERT.X - A toolkit for building asynchronous and reactive app
BASICS OF VERT.X - A toolkit for building asynchronous and reactive appBASICS OF VERT.X - A toolkit for building asynchronous and reactive app
BASICS OF VERT.X - A toolkit for building asynchronous and reactive appHanaStevanovic
 
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
 
NGRX Apps in Depth
NGRX Apps in DepthNGRX Apps in Depth
NGRX Apps in DepthTrayan Iliev
 
How (not) to use reactive streams in java 9+
How (not) to use reactive streams in java 9+How (not) to use reactive streams in java 9+
How (not) to use reactive streams in java 9+J On The Beach
 
Reactive java programming for the impatient
Reactive java programming for the impatientReactive java programming for the impatient
Reactive java programming for the impatientGrant Steinfeld
 
Java Stammtisch Würzburg - CONAIR
Java Stammtisch Würzburg - CONAIRJava Stammtisch Würzburg - CONAIR
Java Stammtisch Würzburg - CONAIRMatthias Reining
 
Mvvm is like born fraction
Mvvm is like born fractionMvvm is like born fraction
Mvvm is like born fractionKen Haneda
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfRed Hat
 
Reactive Microservice And Spring5
Reactive Microservice And Spring5Reactive Microservice And Spring5
Reactive Microservice And Spring5Jay Lee
 

Similar to rx-java-presentation (20)

Reactive Spring Framework 5
Reactive Spring Framework 5Reactive Spring Framework 5
Reactive Spring Framework 5
 
Cycle.js a reactive framework
Cycle.js  a reactive frameworkCycle.js  a reactive framework
Cycle.js a reactive framework
 
Rx Swift
Rx SwiftRx Swift
Rx Swift
 
Reactive microservices with eclipse vert.x
Reactive microservices with eclipse vert.xReactive microservices with eclipse vert.x
Reactive microservices with eclipse vert.x
 
Serverless forwardjs
Serverless forwardjsServerless forwardjs
Serverless forwardjs
 
Functional Web Development
Functional Web DevelopmentFunctional Web Development
Functional Web Development
 
[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1
 
A React Journey
A React JourneyA React Journey
A React Journey
 
BASICS OF VERT.X - A toolkit for building asynchronous and reactive app
BASICS OF VERT.X - A toolkit for building asynchronous and reactive appBASICS OF VERT.X - A toolkit for building asynchronous and reactive app
BASICS OF VERT.X - A toolkit for building asynchronous and reactive app
 
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
 
Intro to RxJS
Intro to RxJSIntro to RxJS
Intro to RxJS
 
NGRX Apps in Depth
NGRX Apps in DepthNGRX Apps in Depth
NGRX Apps in Depth
 
How (not) to use reactive streams in java 9+
How (not) to use reactive streams in java 9+How (not) to use reactive streams in java 9+
How (not) to use reactive streams in java 9+
 
Reactive java programming for the impatient
Reactive java programming for the impatientReactive java programming for the impatient
Reactive java programming for the impatient
 
Java Stammtisch Würzburg - CONAIR
Java Stammtisch Würzburg - CONAIRJava Stammtisch Würzburg - CONAIR
Java Stammtisch Würzburg - CONAIR
 
Mvvm is like born fraction
Mvvm is like born fractionMvvm is like born fraction
Mvvm is like born fraction
 
React native.key
React native.keyReact native.key
React native.key
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdf
 
Reactive Microservice And Spring5
Reactive Microservice And Spring5Reactive Microservice And Spring5
Reactive Microservice And Spring5
 
R Apache
R ApacheR Apache
R Apache
 

rx-java-presentation