Submit Search
Upload
Reactive Streams in Practice
•
0 likes
•
202 views
J
Joost de Vries
Follow
My talk for the Reactive Streams Utrecht meetup 29-03-2017
Read less
Read more
Technology
Report
Share
Report
Share
1 of 42
Download now
Download to read offline
Recommended
TypeScript Presentation - Jason Haffey
TypeScript Presentation - Jason Haffey
Ralph Johnson
Demand Flow Technology workshop - Lean manufacturing
Demand Flow Technology workshop - Lean manufacturing
bisal6
Order pizza from Boxee
Order pizza from Boxee
Daniel Johnson
Project 5Programming and Algorithms IICSCI 211, Spring 2.docx
Project 5Programming and Algorithms IICSCI 211, Spring 2.docx
briancrawford30935
How to Meta-Sumo - Using Logs for Agile Monitoring of Production Services
How to Meta-Sumo - Using Logs for Agile Monitoring of Production Services
Christian Beedgen
GDGPH Hack Fair Presentation
GDGPH Hack Fair Presentation
Mithi Sevilla
Creating Continuously Up to Date Materialized Aggregates
Creating Continuously Up to Date Materialized Aggregates
EDB
Contiki Operating system tutorial
Contiki Operating system tutorial
Salah Amean
Recommended
TypeScript Presentation - Jason Haffey
TypeScript Presentation - Jason Haffey
Ralph Johnson
Demand Flow Technology workshop - Lean manufacturing
Demand Flow Technology workshop - Lean manufacturing
bisal6
Order pizza from Boxee
Order pizza from Boxee
Daniel Johnson
Project 5Programming and Algorithms IICSCI 211, Spring 2.docx
Project 5Programming and Algorithms IICSCI 211, Spring 2.docx
briancrawford30935
How to Meta-Sumo - Using Logs for Agile Monitoring of Production Services
How to Meta-Sumo - Using Logs for Agile Monitoring of Production Services
Christian Beedgen
GDGPH Hack Fair Presentation
GDGPH Hack Fair Presentation
Mithi Sevilla
Creating Continuously Up to Date Materialized Aggregates
Creating Continuously Up to Date Materialized Aggregates
EDB
Contiki Operating system tutorial
Contiki Operating system tutorial
Salah Amean
Let's talk ChatOps - Hubot with less CoffeeScript
Let's talk ChatOps - Hubot with less CoffeeScript
SarahKowalik
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
Patrick Allaert
Moving away from legacy code with BDD
Moving away from legacy code with BDD
Konstantin Kudryashov
Simulation and modeling lab mnit jaipur.pptx
Simulation and modeling lab mnit jaipur.pptx
pankajbarupal101
The Fine Art of Time Travelling - Implementing Event Sourcing - Andrea Saltar...
The Fine Art of Time Travelling - Implementing Event Sourcing - Andrea Saltar...
ITCamp
ql.io at NodePDX
ql.io at NodePDX
Subbu Allamaraju
Developing and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDW
Jonathan Katz
2019 Slides - Michelangelo Palette: A Feature Engineering Platform at Uber
2019 Slides - Michelangelo Palette: A Feature Engineering Platform at Uber
Karthik Murugesan
Tech Startup Day 2016- Customers Wanted- Ann Fournier Digipolis
Tech Startup Day 2016- Customers Wanted- Ann Fournier Digipolis
StartUps.be
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
NETFest
Hard learned SharePoint development tips
Hard learned SharePoint development tips
SPC Adriatics
TensorFlow Quantization Tour
TensorFlow Quantization Tour
KSuzukiii
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
ITCamp
20131028 BTUG.be - BizTalk Deployment
20131028 BTUG.be - BizTalk Deployment
BTUGbe
E.D.D.I - Open Source Chatbot Platform
E.D.D.I - Open Source Chatbot Platform
Gregor Jarisch
Microservices Chaos Testing at Jet
Microservices Chaos Testing at Jet
C4Media
Stress Testing at Twitter: a tale of New Year Eves
Stress Testing at Twitter: a tale of New Year Eves
Herval Freire
Code Contracts
Code Contracts
Alexei Skachykhin
Data streaming for connected devices with Azure Stream Analytics by Juan Manu...
Data streaming for connected devices with Azure Stream Analytics by Juan Manu...
J On The Beach
Deep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming Library
Jim McKeeth
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Gabriella Davis
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Martijn de Jong
More Related Content
Similar to Reactive Streams in Practice
Let's talk ChatOps - Hubot with less CoffeeScript
Let's talk ChatOps - Hubot with less CoffeeScript
SarahKowalik
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
Patrick Allaert
Moving away from legacy code with BDD
Moving away from legacy code with BDD
Konstantin Kudryashov
Simulation and modeling lab mnit jaipur.pptx
Simulation and modeling lab mnit jaipur.pptx
pankajbarupal101
The Fine Art of Time Travelling - Implementing Event Sourcing - Andrea Saltar...
The Fine Art of Time Travelling - Implementing Event Sourcing - Andrea Saltar...
ITCamp
ql.io at NodePDX
ql.io at NodePDX
Subbu Allamaraju
Developing and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDW
Jonathan Katz
2019 Slides - Michelangelo Palette: A Feature Engineering Platform at Uber
2019 Slides - Michelangelo Palette: A Feature Engineering Platform at Uber
Karthik Murugesan
Tech Startup Day 2016- Customers Wanted- Ann Fournier Digipolis
Tech Startup Day 2016- Customers Wanted- Ann Fournier Digipolis
StartUps.be
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
NETFest
Hard learned SharePoint development tips
Hard learned SharePoint development tips
SPC Adriatics
TensorFlow Quantization Tour
TensorFlow Quantization Tour
KSuzukiii
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
ITCamp
20131028 BTUG.be - BizTalk Deployment
20131028 BTUG.be - BizTalk Deployment
BTUGbe
E.D.D.I - Open Source Chatbot Platform
E.D.D.I - Open Source Chatbot Platform
Gregor Jarisch
Microservices Chaos Testing at Jet
Microservices Chaos Testing at Jet
C4Media
Stress Testing at Twitter: a tale of New Year Eves
Stress Testing at Twitter: a tale of New Year Eves
Herval Freire
Code Contracts
Code Contracts
Alexei Skachykhin
Data streaming for connected devices with Azure Stream Analytics by Juan Manu...
Data streaming for connected devices with Azure Stream Analytics by Juan Manu...
J On The Beach
Deep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming Library
Jim McKeeth
Similar to Reactive Streams in Practice
(20)
Let's talk ChatOps - Hubot with less CoffeeScript
Let's talk ChatOps - Hubot with less CoffeeScript
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
Moving away from legacy code with BDD
Moving away from legacy code with BDD
Simulation and modeling lab mnit jaipur.pptx
Simulation and modeling lab mnit jaipur.pptx
The Fine Art of Time Travelling - Implementing Event Sourcing - Andrea Saltar...
The Fine Art of Time Travelling - Implementing Event Sourcing - Andrea Saltar...
ql.io at NodePDX
ql.io at NodePDX
Developing and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDW
2019 Slides - Michelangelo Palette: A Feature Engineering Platform at Uber
2019 Slides - Michelangelo Palette: A Feature Engineering Platform at Uber
Tech Startup Day 2016- Customers Wanted- Ann Fournier Digipolis
Tech Startup Day 2016- Customers Wanted- Ann Fournier Digipolis
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
Hard learned SharePoint development tips
Hard learned SharePoint development tips
TensorFlow Quantization Tour
TensorFlow Quantization Tour
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
20131028 BTUG.be - BizTalk Deployment
20131028 BTUG.be - BizTalk Deployment
E.D.D.I - Open Source Chatbot Platform
E.D.D.I - Open Source Chatbot Platform
Microservices Chaos Testing at Jet
Microservices Chaos Testing at Jet
Stress Testing at Twitter: a tale of New Year Eves
Stress Testing at Twitter: a tale of New Year Eves
Code Contracts
Code Contracts
Data streaming for connected devices with Azure Stream Analytics by Juan Manu...
Data streaming for connected devices with Azure Stream Analytics by Juan Manu...
Deep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming Library
Recently uploaded
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Gabriella Davis
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Martijn de Jong
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
jfdjdjcjdnsjd
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Neo4j
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Enterprise Knowledge
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
sudhanshuwaghmare1
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
Pixlogix Infotech
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Product Anonymous
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
hans926745
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
DianaGray10
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
hans926745
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
Recently uploaded
(20)
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Reactive Streams in Practice
1.
joost@de-vries․name joost-de-vries @jouke REACTIVE STREAMS IN PRACTICE Reactive Streams meetup Utrecht 29-03-2017
2.
THREE ACTS 1. A little taste: some practical code 2. what is stream processing and what can we do with it 3.
reactive streams Let's talk about our experiences with streams
3.
LET'S START WITH SOME CODE We want to poll some market place every 15 minutes for the prices of our products. And we don't want to be suspended, so we only do 4 requests at a time.'
4.
LET'S START WITH SOME CODE val jobParallellism: Int = 4 val tickStream = Spout.tick((), jobInterval) def getProductIds(): List[String] = ??? // get the current product ids def pollPrice(productId: String): Future[Long] = ??? // invoke the market place api val prices = tickStream // tick every 15 mins .flatMap(tick => getProductIds()) // product ids start streaming every 15 mins .mapAsync(jobParallellism)(productId => pollPrice(productId)) // poll max 4 product id .foreach(price => println(s"price is $price")) // print the prices as they come in This happens to be Scala
5.
② WHAT IS STREAM PROCESSING? And what can we do with it?
6.
LIKE A CROSS BETWEEN ITERATOR AND COMPLETABLEFUTURE synchronous asynchronous one A getA()
⇒ CompletableFuture[A] getA() many Iterator[A] ⇒ Observable[A] Using Java and RxJava
7.
LIKE A CROSS BETWEEN ITERATOR AND COMPLETABLEFUTURE synchronous asynchronous one A getA()
⇒ CompletableFuture[A] getA() many Iterator[A] ⇒ Observable[A] We call for data vs we get called with data pull vs push polling vs reactive
8.
So how is a stream different from a collection? HMM.. A stream is potentially infinite A stream is spread out in time instead of memory A stream can be non repeatable
9.
..also Spouts, Pipes, Drains Rx: Observable, Observer
10.
CREATE A STREAM const source = Rx.Observable.create((observer) => { observer.onNext(3) observer.onNext(2) observer.onNext(1) // 0 or more values observer.onCompleted() // potentially end or error }) 3, 2, 1 . (element)* (complete|error)
11.
A FAILING STREAM const source = Rx.Observable.create((observer) => { observer.onNext(3) observer.onNext(2) observer.onError(new Error("boom")) }) 3, 2, 1 x
12.
STREAMS IN DIAGRAMS Marble diagrams Streams are about time and change See reactivex.io
13.
③ WHAT CAN WE DO WITH STREAMS?
14.
WHAT CAN WE DO WITH STREAMS? IoT: dealing with sensor measurements System integration: pumping data between servers User interface code Server push (Near) real time Fast data Immediate results as the inputs are coming in
15.
DETERMINE HIGH WATER MARK FOR SENSOR MEASUREMENTS case class Measurement(rotorSpeed: Int, windSpeed: Int, timestamp: Instant) def measureTurbine(): Measurement = Measurement(rotorSpeed=Random.nextInt(), windSpeed = tickStream .map(tick => measureTurbine()) .scan(0) { case (currentMaxRotorspeed, measurement) => if (measurement.rotorSpeed > currentMaxRotorspeed) measurement.rotorSpeed else cur } .deduplicate // often called 'distinct' .onElement(max => println(s"max rotor speed is $max")) .drainToBlackHole()
16.
USER INTERFACE LOGIC: NETFLIX function play(movieId, cancelButton, callback) { var movieTicket, playError, tryFinish = () => { if (playError) { callback(null, playError); } else if (movieTicket && player.initialized) { callback(null, ticket); } }; cancelButton.addEventListener(“click”, () => { playError = “cancel”; }); if (!player.initialized) { player.init((error) => { playError = error; tryFinish(); } } authorizeMovie(movieId, (error, ticket) => { playError = error; movieTicket = ticket; tryFinish(); }); }); See Jafar Husains talk
17.
USER INTERFACE LOGIC: NETFLIX var authorizations = player .init() .map(() => playAttempts. map(movieId => player.authorize(movieId). catch(e => Observable.empty). takeUntil(cancels) ). concatAll()) ).concatAll(); authorizations.forEach( license => player.play(license), error => showDialog(“Sorry, can’t play right now.”) ); See Jafar Husains talk
18.
CLUSTERED STREAMS def rankLangsReduceByKey(langs: List[String], articles: DStream[WikipediaArticle]): List[(St articles .flatMap { art => langs.map { lang => if (art.text.split(" ").contains(lang)) (lang, 1) else (lang, 0) } } .reduceByKey { case (acc, i) => acc + i } .collect().toList .sortBy { case (lang, i) => i } .reverse }
19.
CLUSTERED STREAMS def rankLangsReduceByKey(langs: List[String], articles: DStream[WikipediaArticle]): List[(St articles .flatMap { art => langs.map { lang => if (art.text.split(" ").contains(lang)) (lang, 1) else (lang, 0) } } .reduceByKey { case (acc, i) => acc + i } .collect().toList // RDD code! collect isn't available on DStream .sortBy { case (lang, i) => i } .reverse }
20.
Types of stream processing Not only JVM: JS, .Net, Swift,..
21.
22.
23.
④ WHY STREAMS?
24.
START WORKING WHEN DATA AVAILABLE Push instead of pull Least latency Process stuff without loading it all in memory Reverse of query / polling
25.
NON BLOCKING BOUNDED USE OF RESOURCES limited threads bounded memory usage (see backpressure) important for microservices / IoT-mobile long running reqs
26.
27.
28.
29.
30.
31.
CLEAN PROGRAMMING MODEL Concurrency model (flat)map: collection, parallel collection, clustered collection, stream Functional programming
32.
Path of exploring streams Symptoms: side effects, assignments, subjects
33.
UI LOGIC IN TYPESCRIPT RXJS const incassos: Observable<Pagination<IncassoListResult>> = this.queryObservable .filter((incassoQuery) => { if (incassoQuery.search) return incassoQuery.search.length >= 3 else return true }) .switchMap((incassoQuery) => { return this.incassoService.getIncassos(incassoQuery, PaginationComponent.calculatePaginati }).share() Move assignments and subjects to the outside of your code Observable in, Observable out Use pure transformations
34.
⑤ REACTIVE STREAMS What makes them different?
35.
REACTIVE STREAMS Interoperability standard Oracle Lightbend Pivotal Netflix Redhat Supports backpressure
36.
STREAM ANYTHING Example from Akka Spring Cloud will support Reactor (?)
37.
RS INTERFACES IN JAVA 9
38.
BACKPRESSURE What if up stream is faster? Buffer Drop elements Slow down
39.
BACKPRESSURE Doesn't make sense for sensor data, mouse clicks, ... But if you can't lose events... Down stream communicates demand
40.
⑥ RESOURCES Async JavaScript at Netflix," Jafar Husain https://www.infoq.com/presentations/netflix-rx- extensions Erik Meijer on observables http://reactivex.io/ Talks by Stephane Maldini etc
41.
SOURCES Overview of types of streams: Mathias Doenitz talk on Swave Erik Meijer on observables -
42.
Fin
Download now