SlideShare uma empresa Scribd logo
1 de 85
THIRDCHANNEL @svpember
Reactive Options for Groovy
Steve Pember
CTO, ThirdChannel
@svpember
What is ‘Reactive’?
THIRDCHANNEL @svpember
Possible Reactive Definitions
• Reactive Programming
Imperative: A = B+C at that moment in time
Reactive: A = B+C whenever B or C change
values
THIRDCHANNEL @svpember
Possible Reactive Definitions
• Reactive Programming
• Reactive Systems
THIRDCHANNEL @svpember
Possible Reactive Definitions
• Reactive Programming
• Reactive Systems
• Reactive Streams / Reactive Extensions (Rx)
THIRDCHANNEL @svpember
Possible Reactive Definitions
• Reactive Programming
• Reactive Systems
• Reactive Streams / Reactive Extensions (Rx)
THIRDCHANNEL @svpember
Agenda
• Reactive Systems
• Reactive Streams / Reactive Extensions
• Reactive Groovy
The Need For Reactive
(The Reactive Manifesto)
–Johnny Appleseed
“Type a quote here.”
–Johnny Appleseed
“Type a quote here.”
http://www.internetlivestats.com/internet-users/
THIRDCHANNEL @svpember
–Johnny Appleseed
“Type a quote here.”
–Johnny Appleseed
“Type a quote here.”
https://medium.com/reactive-programming/what-is-reactive-programming-bc9fa7f4a7fc
Need to Handle As Many Users As
Possible
THIRDCHANNEL @svpember
Reactive Systems
• The Need for Reactive
• 4 Reactive Principles
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Reactive Systems
• The Need for Reactive
• 4 Reactive Principles
• Responsive
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Reactive Systems
• The Need for Reactive
• 4 Reactive Principles
• Responsive
• Resilient
–Johnny Appleseed
“Type a quote here.”
Embrace Failure
Independent Things Fail
Independently
THIRDCHANNEL @svpember
Reactive Systems
• The Need for Reactive
• 4 Reactive Principles
• Responsive
• Resilient
• Elastic (Scalable)
THIRDCHANNEL @svpember
Reactive Systems
• The Need for Reactive
• 4 Reactive Principles
• Responsive
• Resilient
• Elastic (Scalable)
• Asynchronous / Message-Driven
Humans Are Terrible At Concurrency
Recommended: Actors
THIRDCHANNEL @svpember
Akka
–Johnny Appleseed
“Type a quote here.”
–Johnny Appleseed
“Type a quote here.”
Never Block Your Resources
THIRDCHANNEL @svpember
Agenda
• Reactive Systems
• Reactive Streams / Reactive Extensions
“A standard for asynchronous
stream processing of potentially
infinite data, across boundaries, with
non-blocking backpressure”
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Story Time
THIRDCHANNEL @svpember
Story Time
THIRDCHANNEL @svpember
Story Time
THIRDCHANNEL @svpember
Story Time
2012 - MS Open Source’s RX! (wut?)
THIRDCHANNEL @svpember
Story Time
2012 - MS Open Source’s RX! (wut?)
–Johnny Appleseed
“Type a quote here.”
THIRDCHANNEL @svpember
Rx: More Than a Stream
• Pull vs Push
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Rx: More Than a Stream
• Pull vs Push
• Observable / Subscriber
An Observable is a push-based collection
THIRDCHANNEL @svpember
Rx: More Than a Stream
• Pull vs Push
• Observable / Subscriber
• Hot / Cold
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Rx: More Than a Stream
• Pull vs Push
• Observable / Subscriber
• Hot / Cold
• Composable
THIRDCHANNEL @svpember
Rx: More Than a Stream
• Pull vs Push
• Observable / Subscriber
• Hot / Cold
• Composable
• Async is Easy!
The Subscriber & Observable can
be independently Async
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Rx: More Than a Stream
• Pull vs Push
• Observable / Subscriber
• Hot / Cold
• Composable
• Async is Easy!
• Backpressure
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Rx: More Than a Stream
• Pull vs Push
• Observable / Subscriber
• Hot / Cold
• Composable
• Async is Easy!
• Backpressure
• Observable Interaction
THIRDCHANNEL @svpember
Rx: More Than a Stream
• Pull vs Push
• Observable / Subscriber
• Hot / Cold
• Composable
• Async is Easy!
• Backpressure
• Observable Interaction
• You really only need 4 functions
THIRDCHANNEL @svpember
4 functions!
• filter
• map / flatMap
• groupBy
• reduce
THIRDCHANNEL @svpember
Agenda
• Reactive Systems
• Reactive Streams / Reactive Extensions
• Groovy Options
THIRDCHANNEL @svpember
A Few Groovy Options…
• Akka
THIRDCHANNEL @svpember
A Few Groovy Options…
• Akka
• Akka Streams
THIRDCHANNEL @svpember
Akka & Akka Streams
• Library
• Definition of Reactive System
• Typesafe
• Actor-Based Concurrency
• Implemented Streams on Top of Actor Model
THIRDCHANNEL @svpember
A Few Groovy Options…
• Akka
• Akka Streams
• RxJava / RxGroovy
THIRDCHANNEL @svpember
RxJava
• Library
• Comes out of Netflix
• Part of reactivex.io
• Reactive Streams on the JVM
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
A Few Groovy Options…
• Akka
• Akka Streams
• RxJava / RxGroovy
• Ratpack
THIRDCHANNEL @svpember
• HTTP application server
• Non-opinionated
• Built on Reactive Streams, Netty, Java 8, Guava
• Fully embodies reactive
THIRDCHANNEL @svpember
A Few Groovy Options…
• Akka
• Akka Streams
• RxJava / RxGroovy
• Ratpack
• Reactor
THIRDCHANNEL @svpember
• Library
• Reactive Streams
• Reactor Pattern
• Built on LMAX Ring Buffer / Disrupter
THIRDCHANNEL @svpember
VS
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
• Groovy Parallelism and Concurrency
• Built into the language!
• Actors
• DataFlow
• Async Closures
Do I Have Time for a Demo?
Final Thought: What About Java 8
Streams?
THIRDCHANNEL @svpember
Java 8 Streams
• Built into the language
• Meant for ‘pull’ on finite Iterables
• Parallelization has rather severe problems (e.g. https://dzone.com/articles/think-
twice-using-java-8)
• No Async
• vs Observables -> potentially infinite items, async, with back pressure
Thank You!
Questions?
@svpember
Image Credits
• 1000ms Time To glass:
https://docs.google.com/presentation/d/1IRHyU7_crIiCjl0Gvue0WY3eY_eYvFQvSfwQouW9368/present?slide=id.g1e697bbb_0_7
• internet users in the world: http://www.internetlivestats.com/internet-users/
• internet users vs Facebook: https://medium.com/reactive-programming/what-is-reactive-programming-bc9fa7f4a7fc
• reactivex logo: https://www.stickermule.com/marketplace/2223-rx-reactive-extensions-logo-4
• cheetah: www.livescience.com/21944-usain-bolt-vs-cheetah-animal-olympics.html
• dominoes: https://www.flickr.com/photos/louish/5611657857/sizes/l/in/photostream/
• 300 / Spartans: http://www.300themovie.com/
• latop punch: http://walls4joy.com/wallpaper/730566-angry-laptops-punch
• mailman: http://thebrandtstandard.com/2013/02/09/u-s-post-office-to-end-saturday-letter-delivery-this-summer/
• actor system: http://letitcrash.com/post/30585282971/discovering-message-flows-in-actor-systems-with
• slow down: http://forthefamily.org/reminder-slow/
• Buffalo: http://news.sd.gov/newsitem.aspx?id=15164
• Midvale School for the Gifted: http://www.2ndfirstlook.com/2012/09/gary-larson.html

Mais conteúdo relacionado

Semelhante a Gr8conf US 2015: Reactive Options for Groovy

An Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVMAn Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVMSteve Pember
 
How Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM EcosystemHow Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM EcosystemKonrad Malawski
 
Akka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming WorldAkka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming WorldKonrad Malawski
 
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, EuropePatterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, EuropeFlip Kromer
 
Build a Startup with Clojure(Script)
Build a Startup with Clojure(Script)Build a Startup with Clojure(Script)
Build a Startup with Clojure(Script)Théophile Villard
 
A year with event sourcing and CQRS
A year with event sourcing and CQRSA year with event sourcing and CQRS
A year with event sourcing and CQRSSteve Pember
 
What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...
What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...
What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...Lucas Jellema
 
RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015Ben Lesh
 
Functional Web Apps with WebMachine Framework - Mikhail Bortnyk
Functional Web Apps with WebMachine Framework - Mikhail BortnykFunctional Web Apps with WebMachine Framework - Mikhail Bortnyk
Functional Web Apps with WebMachine Framework - Mikhail BortnykRuby Meditation
 
Functional Web Apps with WebMachine Framework
Functional Web Apps with WebMachine FrameworkFunctional Web Apps with WebMachine Framework
Functional Web Apps with WebMachine FrameworkAmoniac OÜ
 
Building APIs with Kotlin and Spark
Building APIs with Kotlin and SparkBuilding APIs with Kotlin and Spark
Building APIs with Kotlin and SparkNordic APIs
 
Reactive Stream Processing with Akka Streams
Reactive Stream Processing with Akka StreamsReactive Stream Processing with Akka Streams
Reactive Stream Processing with Akka StreamsKonrad Malawski
 
Scala Data Pipelines @ Spotify
Scala Data Pipelines @ SpotifyScala Data Pipelines @ Spotify
Scala Data Pipelines @ SpotifyNeville Li
 
How to build a TraP: An image-plane transient-discovery tool
How to build a TraP: An image-plane transient-discovery toolHow to build a TraP: An image-plane transient-discovery tool
How to build a TraP: An image-plane transient-discovery toolTim Staley
 
Querying data on the Web – client or server?
Querying data on the Web – client or server?Querying data on the Web – client or server?
Querying data on the Web – client or server?Ruben Verborgh
 
Spacebrew: The Overview
Spacebrew: The OverviewSpacebrew: The Overview
Spacebrew: The OverviewBrett Renfer
 
Message:Passing - lpw 2012
Message:Passing - lpw 2012Message:Passing - lpw 2012
Message:Passing - lpw 2012Tomas Doran
 
Wait! What’s going on inside my database? (PASS 2023 Update)
Wait! What’s going on inside my database? (PASS 2023 Update)Wait! What’s going on inside my database? (PASS 2023 Update)
Wait! What’s going on inside my database? (PASS 2023 Update)Jeremy Schneider
 
Generating Sequences with Deep LSTMs & RNNS in julia
Generating Sequences with Deep LSTMs & RNNS in juliaGenerating Sequences with Deep LSTMs & RNNS in julia
Generating Sequences with Deep LSTMs & RNNS in juliaAndre Pemmelaar
 

Semelhante a Gr8conf US 2015: Reactive Options for Groovy (20)

An Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVMAn Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVM
 
How Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM EcosystemHow Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM Ecosystem
 
Akka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming WorldAkka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming World
 
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, EuropePatterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe
 
Build a Startup with Clojure(Script)
Build a Startup with Clojure(Script)Build a Startup with Clojure(Script)
Build a Startup with Clojure(Script)
 
A year with event sourcing and CQRS
A year with event sourcing and CQRSA year with event sourcing and CQRS
A year with event sourcing and CQRS
 
What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...
What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...
What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...
 
RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015
 
Functional Web Apps with WebMachine Framework - Mikhail Bortnyk
Functional Web Apps with WebMachine Framework - Mikhail BortnykFunctional Web Apps with WebMachine Framework - Mikhail Bortnyk
Functional Web Apps with WebMachine Framework - Mikhail Bortnyk
 
Functional Web Apps with WebMachine Framework
Functional Web Apps with WebMachine FrameworkFunctional Web Apps with WebMachine Framework
Functional Web Apps with WebMachine Framework
 
Building APIs with Kotlin and Spark
Building APIs with Kotlin and SparkBuilding APIs with Kotlin and Spark
Building APIs with Kotlin and Spark
 
Reactive Stream Processing with Akka Streams
Reactive Stream Processing with Akka StreamsReactive Stream Processing with Akka Streams
Reactive Stream Processing with Akka Streams
 
Scala Data Pipelines @ Spotify
Scala Data Pipelines @ SpotifyScala Data Pipelines @ Spotify
Scala Data Pipelines @ Spotify
 
How to build a TraP: An image-plane transient-discovery tool
How to build a TraP: An image-plane transient-discovery toolHow to build a TraP: An image-plane transient-discovery tool
How to build a TraP: An image-plane transient-discovery tool
 
Querying data on the Web – client or server?
Querying data on the Web – client or server?Querying data on the Web – client or server?
Querying data on the Web – client or server?
 
Spacebrew: The Overview
Spacebrew: The OverviewSpacebrew: The Overview
Spacebrew: The Overview
 
Message:Passing - lpw 2012
Message:Passing - lpw 2012Message:Passing - lpw 2012
Message:Passing - lpw 2012
 
Wait! What’s going on inside my database? (PASS 2023 Update)
Wait! What’s going on inside my database? (PASS 2023 Update)Wait! What’s going on inside my database? (PASS 2023 Update)
Wait! What’s going on inside my database? (PASS 2023 Update)
 
Generating Sequences with Deep LSTMs & RNNS in julia
Generating Sequences with Deep LSTMs & RNNS in juliaGenerating Sequences with Deep LSTMs & RNNS in julia
Generating Sequences with Deep LSTMs & RNNS in julia
 
AFD5 Pumps
AFD5 PumpsAFD5 Pumps
AFD5 Pumps
 

Mais de Steve Pember

Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Steve Pember
 
SACon 2019 - Surviving in a Microservices Environment
SACon 2019 - Surviving in a Microservices EnvironmentSACon 2019 - Surviving in a Microservices Environment
SACon 2019 - Surviving in a Microservices EnvironmentSteve Pember
 
Surviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridgedSurviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridgedSteve Pember
 
Gradle Show and Tell
Gradle Show and TellGradle Show and Tell
Gradle Show and TellSteve Pember
 
Greach 2018: Surviving Microservices
Greach 2018: Surviving MicroservicesGreach 2018: Surviving Microservices
Greach 2018: Surviving MicroservicesSteve Pember
 
Event storage in a distributed system
Event storage in a distributed systemEvent storage in a distributed system
Event storage in a distributed systemSteve Pember
 
Harnessing Spark and Cassandra with Groovy
Harnessing Spark and Cassandra with GroovyHarnessing Spark and Cassandra with Groovy
Harnessing Spark and Cassandra with GroovySteve Pember
 
Surviving in a microservices environment
Surviving in a microservices environmentSurviving in a microservices environment
Surviving in a microservices environmentSteve Pember
 
Surviving in a Microservices Environment
Surviving in a Microservices EnvironmentSurviving in a Microservices Environment
Surviving in a Microservices EnvironmentSteve Pember
 
Richer Data History with Event Sourcing (SpringOne 2GX 2015
Richer Data History with Event Sourcing (SpringOne 2GX 2015Richer Data History with Event Sourcing (SpringOne 2GX 2015
Richer Data History with Event Sourcing (SpringOne 2GX 2015Steve Pember
 
Gr8conf US 2015 - Intro to Event Sourcing with Groovy
Gr8conf US 2015 - Intro to Event Sourcing with GroovyGr8conf US 2015 - Intro to Event Sourcing with Groovy
Gr8conf US 2015 - Intro to Event Sourcing with GroovySteve Pember
 
Advanced Microservices - Greach 2015
Advanced Microservices - Greach 2015Advanced Microservices - Greach 2015
Advanced Microservices - Greach 2015Steve Pember
 
Richer data-history-event-sourcing
Richer data-history-event-sourcingRicher data-history-event-sourcing
Richer data-history-event-sourcingSteve Pember
 
Managing a Microservices Development Team (And advanced Microservice concerns)
Managing a Microservices Development Team (And advanced Microservice concerns)Managing a Microservices Development Team (And advanced Microservice concerns)
Managing a Microservices Development Team (And advanced Microservice concerns)Steve Pember
 
Reactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and GrailsReactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and GrailsSteve Pember
 
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...Steve Pember
 
Richer Data History in Groovy with Event Sourcing
Richer Data History in Groovy with Event SourcingRicher Data History in Groovy with Event Sourcing
Richer Data History in Groovy with Event SourcingSteve Pember
 
Distributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with EventsDistributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with EventsSteve Pember
 
Message Oriented Architecture - Gr8conf US 2013
Message Oriented Architecture - Gr8conf US 2013Message Oriented Architecture - Gr8conf US 2013
Message Oriented Architecture - Gr8conf US 2013Steve Pember
 

Mais de Steve Pember (19)

Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
 
SACon 2019 - Surviving in a Microservices Environment
SACon 2019 - Surviving in a Microservices EnvironmentSACon 2019 - Surviving in a Microservices Environment
SACon 2019 - Surviving in a Microservices Environment
 
Surviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridgedSurviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridged
 
Gradle Show and Tell
Gradle Show and TellGradle Show and Tell
Gradle Show and Tell
 
Greach 2018: Surviving Microservices
Greach 2018: Surviving MicroservicesGreach 2018: Surviving Microservices
Greach 2018: Surviving Microservices
 
Event storage in a distributed system
Event storage in a distributed systemEvent storage in a distributed system
Event storage in a distributed system
 
Harnessing Spark and Cassandra with Groovy
Harnessing Spark and Cassandra with GroovyHarnessing Spark and Cassandra with Groovy
Harnessing Spark and Cassandra with Groovy
 
Surviving in a microservices environment
Surviving in a microservices environmentSurviving in a microservices environment
Surviving in a microservices environment
 
Surviving in a Microservices Environment
Surviving in a Microservices EnvironmentSurviving in a Microservices Environment
Surviving in a Microservices Environment
 
Richer Data History with Event Sourcing (SpringOne 2GX 2015
Richer Data History with Event Sourcing (SpringOne 2GX 2015Richer Data History with Event Sourcing (SpringOne 2GX 2015
Richer Data History with Event Sourcing (SpringOne 2GX 2015
 
Gr8conf US 2015 - Intro to Event Sourcing with Groovy
Gr8conf US 2015 - Intro to Event Sourcing with GroovyGr8conf US 2015 - Intro to Event Sourcing with Groovy
Gr8conf US 2015 - Intro to Event Sourcing with Groovy
 
Advanced Microservices - Greach 2015
Advanced Microservices - Greach 2015Advanced Microservices - Greach 2015
Advanced Microservices - Greach 2015
 
Richer data-history-event-sourcing
Richer data-history-event-sourcingRicher data-history-event-sourcing
Richer data-history-event-sourcing
 
Managing a Microservices Development Team (And advanced Microservice concerns)
Managing a Microservices Development Team (And advanced Microservice concerns)Managing a Microservices Development Team (And advanced Microservice concerns)
Managing a Microservices Development Team (And advanced Microservice concerns)
 
Reactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and GrailsReactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and Grails
 
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...
 
Richer Data History in Groovy with Event Sourcing
Richer Data History in Groovy with Event SourcingRicher Data History in Groovy with Event Sourcing
Richer Data History in Groovy with Event Sourcing
 
Distributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with EventsDistributed Reactive Architecture: Extending SOA with Events
Distributed Reactive Architecture: Extending SOA with Events
 
Message Oriented Architecture - Gr8conf US 2013
Message Oriented Architecture - Gr8conf US 2013Message Oriented Architecture - Gr8conf US 2013
Message Oriented Architecture - Gr8conf US 2013
 

Último

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 

Último (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 

Gr8conf US 2015: Reactive Options for Groovy

Notas do Editor

  1. My name is Steve, and I work for a startup in Boston, MA. Welcome to ‘Reactive Options for Groovy’ Let’s talk about asynchronous data. I should start out by saying that I’m by no means an expert here, but rather a big fan of Reactive
  2. So let’s begin. When we say ‘Reactive’, what exactly do we mean? There’s several definitions all with varying meanings. To me, when I hear the term ‘reactive’ I think of 3 possible definitions or interpretations:
  3. first, ‘reactive programming’
  4. Reactive Programming is different from Imperative programming. In Imperative… In reactive… We’ve been working with Reactive programming for years now, even if you don’t know it. especially if you work at all with User Interfaces (e.g. Javascript). UIs are all about reacting to user input.
  5. Moving on… Second definition: Reactive Systems.
  6. Third: Reactive Streams or Reactive Extensions
  7. today is about reactive systems and RX I think these concepts are the most exciting and they’re gathering quite a bit of traction
  8. agenda for today: talk about reactive systems and what makes a system ‘reactive’ Mostly, though, we’ll be talking about Reactive Streams or Reactive Extensions Will also cover a short list of options available to us in the Groovy ecosystem First up, Reactive Systems and why they’re important.
  9. * So first up, Reactive Systems. In this definition, Reactive is a pattern for building applications to handle modern demands, and was popularized by an online document called the ‘Reactive Manifesto’.
  10. The source of reactive systems can be traced to a document known as the reactive manifesto, which has gone through several revisions over the past few years… most recent edition is from this past september * The term was popularized, I believe, by a company currently known as TypeSafe. They maintain the Manifesto. * I think the best way to understand Reactive is to first talk about the problem it aims to solve
  11. <pause> The internet is growing. The number of users on the internet has estimated to grow from 750 million to nearly 3 billion in just 11 years,
  12. Even with this increased demand, users expect their browsing experiences to respond … immediately. And they get angry and impatient when sites are slow
  13. Borrowed this slide from ilya grigorik, who introduced (I think) the idea of the 1000ms time to glass challenge… which basically states that your site should render to the screen (or glass) within 1 second of a user interaction. The reason for this is that studies have been done that show that users’s focus and mental concentration goes away when waiting for more than 1 second. Several years ago, an engineer with Amazon named Greg Linden revealed that the company ran experiment where they intentionally slowed down site performance - 100ms delay resulted in 1 percent drop in sales.
  14. Furthermore, the Scale of the internet is growing tremendously The number of users in 2012 of just one site was equal to the entire internet user base just 6 years before that in 2006. The site is facebook, but still. Just shows you that web sites are facing increasing scaling problems
  15. Applications need to handle as many users as possible… as efficiently as possible to avoid the stampeding herd problem Many frameworks and server technologies still use technology and patterns since the beginning of web development. E.g. a thread based approach, where one request consumes one thread for the duration of the request. This is especially a problem in a distributed system environment, where that request may need to communicate with other systems.
  16. Reactive systems have 4 main principles that are meant to help guide a developer to meet modern system demands.
  17. In it, the Manifesto declares that there are 4 principles that any application must meet in order to fulfill customer demand. Note that being Reactive isn’t a library or a framework, rather it’s a set of design principles that your app should strive to meet.
  18. First: the application must be responsive
  19. This comes right off of a previous point about speed. Your application, in general, should respond to user interaction as quickly as possible. A more ‘responsive’ application is a pleasing experience to your end user. The faster your application responds to their input, the less time they sit staring at your app, and the happier they’ll be. Also, it’s just important to be fast. Several years ago, an engineer with Amazon named Greg Linden revealed that the company ran experiment where they intentionally slowed down site performance 100ms delay resulted in 1 percent drop in sales. In other words, slowing down their site by a tenth of a second resulted in a considerable loss in revenue. Which makes sense, right? The faster you can take customer’s orders, the more money you make
  20. Next up: your app must be resilient
  21. The resilient principle says that we, as software developers, should have the mindset that at any given moment, your code is going to break. Think to yourself: How coupled is my code? -How many of your systems are held together by quick hacks? (I know I’m guilty of this one) - How dependent on other services, domain objects, third party services, etc is my application? - What happens to my system if any one of those go down?
  22. The resilient principle says that we shouldn’t be scared of our application failing… instead we should *embrace* failure
  23. -A Reactive application is resilient to failure. If one component breaks down, the others should not falter. if a third party service is unavailable, your app should have some fallback behavior. -Your system should be able to suffer damage and still operate. -For example, imagine an ecommerce application. if the ability to place orders goes down.. while your team is scrambling to fix, the end user should still be able to browse the products and add items to the cart. -They should just see a message that says “Sorry, order placement will be right back”…
  24. Your resilient mantra should be “Independent things fail independently”
  25. third:
  26. Your application should stay responsive under load it should react to changes in workload by increasing or decreasing resources
  27. lastly, Reactive applications are message driven via asynchronously methods -Communication within the system should be done via done via asynchronous immutable events, rather than long procedural code.
  28. -This naturally promotes highly decoupled code. Sender and recipient can be constructed without having to know - or care - about implementation details of the others. I think this is a very important point… and is perhaps the most important facet of Reactive programming as the others may come naturally from adopting this single step By dealing with Message passing instead of direct function calls, this tends to result in building smaller, independent functions Fits nicely into a concurrent, asynchronous framework, whether it be an entire stack like Ratpack, a framework like Netty, or a library like GPars
  29. However, we humans are not good at Concurrency. Things like Thread safety are very hard. Thus, Reactive systems call for using techniques to abstract the concurrent procedures
  30. Because Concurrency is Hard, The Reactive Manifesto folks highly recommend the Actor pattern.
  31. very complicated Each actor is a small code block that knows to do a specific action actors == function ? actors are not accessed directly, instead actors exist within an ‘Actor System’. you interact with the system instead of the actors directly. The system abstracts the concurrency techniques Actor systems are very scalable. Can be distributed across threads or even additional systems
  32. With an Actor model you do not talk to the actors directly. Instead, you send messages into the system. Actors each have a ‘mailbox’, and know how to address messages to other actors or actor types. The actor system than delivers these messages asynchronously
  33. Key Take away: In a Reactive Application, you must NEVER BLOCK YOUR RESOURCES. Could spend an entire talk on why blocking is bad, and non blocking IO is amazing.
  34. pause next up is Reactive streams  or Reactive Extensions (also known as RX)  - Anyway, Rx is a powerful new programming pattern which has been gaining traction recently.
  35. If I were to try and describe Rx to you in one sentence, it would be… <read> Now, this may not be entirely correct, but it’s my observation after having worked with this technology for a while now. Fairly dramatic, eh? What does something as dramatic as that even look like in terms of code?
  36. at first glance, it might seem fairly close to stream or pipeline based programming. Like the Java 8 streams api, or if we decided to chain together some of the groovy closure functions like collect or find. Is everyone here familiar with Streams or pipelines? Not going to sell you. see Fowler. functional programming on data collections, rather than imperative statements in a loop - The reason why we call it Reactive extensions is that it adds functionality onto streams, “streams++” <Go Over example> However… Rx is vastly more complicated than that.
  37. But first, a story! Rx has a fairly interesting history The idea of reactive extensions came out of Microsoft’s “Cloud Programability team” sometime before 2008. It was designed as an interface for integrating multiple asynchronous data sources in the cloud. This became popular, and the library made it’s way into .NET
  38. Github used it for everything within their GH for Windows app
  39. And they loved it! So much so that in 2012 they decided to port the Rx technology to other languages and platforms, so that they could use it throughout the organization
  40. And in a highly coincidental move, MS decided at that same year to open source their Rx technology.
  41. And it’s amazing they did that. As a result, several heavy hitters in the JVM space decided to bring the tech to Java
  42. People from Netflix, Pivotal, Typesafe, Twitter, and many others came together. They made a spec, found at reactive-streams.org to flesh out further how Rx should work.
  43. As of a few days ago, we have several libraries which fully adhere to the spec.
  44. So anyway, what’s all the fuss? Rx is some extensions on the concept of stream programming.
  45. Typically when working with an array or an iterable, one loops over the collection, and then pulls out data. I f I were to ask for the data at position 1 in an array, that’s an example of pulling information from the array. It sits there passively until I ask for it. with Rx it’s a bit different, in that our streams are configured to have data ‘pushed’ at them, without asking for it directly.
  46. which brings us to the next topic. The key components in this pattern: the Observable and the Subscriber. Subscriber may also be called an Observer, and the Observable may sometimes be called a Stream
  47. <Read> When an observable has a new data item, it pushes out to its subscribers. The subscriber acts as a ‘sentinel’, waiting, potentially asynchronously, for the next data item The observable interface is fairly simplistic: it can do 3 things: send a piece of data, signal that an error occurred, or signal that the data is complete.
  48. Which leads nicely into this next section. When talking about Observables, it’s important to note whether the Observable is ‘Hot’ or ‘Cold’
  49. A ‘Cold’ Observable is the most accessible or direct kind. If you’re just starting out, you’re almost certainly going to entirely be using Cold Observables. This is an example of one… generating an observable from a finite list of data
  50. Hot is a bit different and more advanced slide of a created observable <explain> Two more points come out of this slide, the first being that…
  51. streams are composable.
  52. Here we have a stream of sales data being attached to a variable called ‘branch’. both of the subscribers listening on the ‘branch’ variable are receiving the same data that the stream emits
  53. Second is, async behavior is EASY
  54. I’m only going to mention this briefly, because I haven’t used this too often so I’m  not the most knowledgeable about this. It’s possible do some wild things with multiple observables. Can combine them certainly, but it’s also possible to have an observable refrain from emitting data until another observable does, or have an observable emit data until it receives data from another observable. Wild stuff
  55. But anyway, don’t worry about that yet. When you’re just starting out, there’s really only 4 functions that you find using all of the time.
  56. filter, map / flatMap, groupBy, and reduce
  57. akka and…
  58. Can be a bit intimidating at first
  59. Infamous for having colorful, but often confusing diagrams
  60. and the descriptions can be a little… obtuse, too.
  61. … So it’s a Reactive -Stream Based web server. I believe the entire dev team is at this con, which is pretty great
  62. lmax ring buffer: LMAX is a financial trading company that is trying to build the fastest trading platform in the world. They open sourced key piece of their technology, called the Disrupter which is based on a ring buffer pattern. Also, In addition to Rx, Reactor allows you to do efficient internal message passing and build Event Driven apps.
  63. Suppose we had an E-commerce app which included a service which created and processed orders. In this version, we use several additional service collaborators to do things like verifying that we have inventory, charge the user, and send emails if successful or not. Each of those service calls could take a while (checking inventory, sending email, money), which blocks the thread while we wait for each service call. This slows down the request not only for the end user but for any rampaging hordes trying to access our app
  64. Here’s that same method. Where did the rest of the code go? First, note the ‘notify’ with a String-based event
  65. On order:created, we execute the first services job Then we check the inventory for holding, and broadcast a new event based on those results
  66. The moneyService will bill the client if the inventory is good, While the email service will respond either way. -Now, some of might be saying, “But Steve, that code is spread across 3 different slides!”. While, true, which of these would you rather use? Which version do you think is more decoupled? Which would be easier to test? -(Imagine having to mock all these services as collaborators, versus simply creating events)
  67. GPARS!
  68. load demo app basic print group by user, filter by items greater than 5 or something separate stream for 0 only go back and group by user and then location
  69. All this talk about streams and java… you might be wondering “Why didn’t Steve talk about Java 8 Streams?”
  70. Java 8 Streams API      -at first seems great      - built into the language!      - streams api meant for finite iterable objects to pull from - parallelization support is weak. Uses a common resource pool for all parallel stream operations, across threads.      - observables deal with potentially infinite streams the subscribers receive and can offer backpressure