rxjava for resilient enterprise
TRANSCRIPT
Anand is deeply rooted in technology. Over the past 15 years he has been involved in the realization of several Omni channel commerce implementations across travel, hospitality and the retail industries. He is amazed at the ‘’constant acceleration’’ of technology innovation and it’s impact on our daily responsibilities as technologists.
Anand RamanDirector, Technology
Sagar has helped our clients develop leading solutions in social, travel and eRetail space. Recently his team build a popular & engaging social shopping app for a large US retailer. Recently Sagar has been developing a POV bridging natural language processing & machine learning technology spaces.
Sagar PrasadArchitect – Social, Search & Recommendation System
Our World Is Changing on 3 DimensionsScale
Complexity
Experience
Capturing All Interactions Market place platforms Limited time offers
Omni channel (flexible fulfilment) Integrations Legacy systems Real time processing Analytics & Business Intelligence Products as platforms
Devices / Touch points Responsive / Rich / Interactive Low latency Personalized / Ever present
WHAT USED TO BE THIS IS NOW THIS
On-Premise Hosting
CloudAware
CentralizedRDBMS
DistributedNoSqls
MonolithicArch
Micro-Services
Buy Build
VendorPackages
OpenSource
Async Everywhere
Automate Everything
Devops
Polyglot Architectures
Partition Everything
WHAT WILL YOU BET ON for a Resilient Enterprise EcosystemNEW TOOLS ARE ON THE HORIZON
Microservices
http://wallpapertvs.com/violet-sky/
What Are Microservices
http://martinfowler.com/articles/microservices.html
• Well defined scope• Small enough• Self contained• Independently
developed, deployed
Why Microservices• Speed to market• Maintainable• Suited for 2-5 year
rewrite cycle• Multiple teams• TRULY POLYGLOT
(teams * tech stack)
Client LayerSearch Micro
Service
Listing Micro ServiceW
eb A
pplic
ation
Value Objects
Med
iato
r
Search ServiceStub
Review Service
Stub
Image Service Stub
Search Service
Review Service
Image Service
ETSY
JSO
N O
ver H
TTP
#1 : Chatty Clients
Initial Search Call
1
2
3
n
Classic waterfallSearch call is followed by
“pairs” of “synchronous” review and image calls
How to compose calls Effectively & Efficiently
Client LayerSearch Micro
Service
Listing Micro ServiceW
eb A
pplic
ation
Value Objects
Med
iato
r
Search ServiceStub
Review Service
Stub
Image Service Stub
Search Service
Review Service
Image Service
JSON Over HTTP
#2 : Data Serialization In Polyglot Env.
Workspace TourReviewed
Image Service
Started Embedded Containers
Captured Call Timeline
Imperative Composition
Recap
TimeLine
Initial Search Call
1
2
3
n
Classic waterfallSearch call is followed by
“pairs” of “synchronous” review and image calls
ProtoBuf
Define Message Structure
Code Generator
C++ Java Python…
Servers & Clients • Language & Platform neutral, flexible, efficient way to serialize structured data
• Binary format• Implemented in various
languages: Java, C++, Python , Go …
+ Interoperability+ Size & Performance+ Backward compatibility+ Well documented+ Model schemas efficiently+ Extensibility & Validations
WHY CHOOSE DATA SERIALIZATION
ReactiveX
+ Composing, Transforming+ Error Handling+ Concurrency
Functional Constructs for Composing Data Streams
Rx-Programming
Composes asynchronous and event-based data flows using observable sequences
Observable f1Observer, Subscriber
f2 f3
map merge
Why RxJava• Well Documented• Polyglot Implementation• Composable • Declarative ( fluent )• Everything is an Observable• Future, Promise are hard
Imperative (pull) vs. Reactive (push)
Mediator Service Stub Service
Impe
rativ
e
Mediator
Observable Stub Service
Reac
tive
Service Stub
While The Timeline Looks Familiar;
Initial Search Call
1
2
3
n
Indistinguishable from Imperative style
Search call is still followed by “pairs” of “synchronous” review and image calls
All You May Ever Need
Async
Conditional
Parallel Processing
Rx
Combining
Error Handling
Filtering Transform …….
Recap : TimeLine
Initial Search Call
Execution profile has changed completely
After the initial search call all calls to fetch images and reviews are Asynchronous
Power of A directive
Recap
• CB protected the application• Prevented poorly performing calls from blocking main execution thread
• Essential at all layers; especially for external services