Top Banner
THE RESILIENT ENTERPRISE Master class one
54
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: RxJava for Resilient Enterprise

THE RESILIENT ENTERPRISEMaster class one

Page 2: RxJava for Resilient Enterprise

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

Page 3: RxJava for Resilient Enterprise

https://twitter.com/rajaramc/status/517457240853577729

Page 4: RxJava for Resilient Enterprise
Page 5: RxJava for Resilient Enterprise

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

Page 6: RxJava for Resilient Enterprise

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

Page 7: RxJava for Resilient Enterprise

WHAT WILL YOU BET ON for a Resilient Enterprise EcosystemNEW TOOLS ARE ON THE HORIZON

Microservices

http://wallpapertvs.com/violet-sky/

Page 8: RxJava for Resilient Enterprise

What Are Microservices

http://martinfowler.com/articles/microservices.html

• Well defined scope• Small enough• Self contained• Independently

developed, deployed

Page 9: RxJava for Resilient Enterprise

Why Microservices• Speed to market• Maintainable• Suited for 2-5 year

rewrite cycle• Multiple teams• TRULY POLYGLOT

(teams * tech stack)

Page 10: RxJava for Resilient Enterprise

Today’s Use case

Page 11: RxJava for Resilient Enterprise

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

Page 12: RxJava for Resilient Enterprise

#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

Page 13: RxJava for Resilient Enterprise

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.

Page 14: RxJava for Resilient Enterprise

Micro-services

Data Serialization

AsyncCall

Composition

ResiliencyDeclarative

CallComposition

Page 15: RxJava for Resilient Enterprise

System.out.println(“Hello W

Page 16: RxJava for Resilient Enterprise

Workspace TourReviewed

Image Service

Started Embedded Containers

Captured Call Timeline

Imperative Composition

Recap

Page 17: RxJava for Resilient Enterprise

TimeLine

Initial Search Call

1

2

3

n

Classic waterfallSearch call is followed by

“pairs” of “synchronous” review and image calls

Page 18: RxJava for Resilient Enterprise

Micro-services

Data Serialization

AsyncCall

Composition

ResiliencyDeclarative

CallComposition

Page 19: RxJava for Resilient Enterprise

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 …

Page 20: RxJava for Resilient Enterprise

System.out.println(“Hello W

Page 21: RxJava for Resilient Enterprise

RecapUpdated

Proto Definition

Tested

Restarted Container

Enhanced Search Service

Page 22: RxJava for Resilient Enterprise

+ Interoperability+ Size & Performance+ Backward compatibility+ Well documented+ Model schemas efficiently+ Extensibility & Validations

WHY CHOOSE DATA SERIALIZATION

Page 23: RxJava for Resilient Enterprise

Micro-services

Data Serialization

AsyncCall

Composition

ResiliencyDeclarative

CallComposition

Page 24: RxJava for Resilient Enterprise

http://upload.wikimedia.org/wikipedia/commons/e/e7/CNW_yard,_Chicago.jpg

Page 25: RxJava for Resilient Enterprise

ReactiveX

+ Composing, Transforming+ Error Handling+ Concurrency

Functional Constructs for Composing Data Streams

Page 26: RxJava for Resilient Enterprise

Rx-Programming

Composes asynchronous and event-based data flows using observable sequences

Observable f1Observer, Subscriber

f2 f3

map merge

Page 27: RxJava for Resilient Enterprise

Another Example

Page 28: RxJava for Resilient Enterprise

Why RxJava• Well Documented• Polyglot Implementation• Composable • Declarative ( fluent )• Everything is an Observable• Future, Promise are hard

Page 29: RxJava for Resilient Enterprise

Imperative (pull) vs. Reactive (push)

Mediator Service Stub Service

Impe

rativ

e

Mediator

Observable Stub Service

Reac

tive

Service Stub

Page 30: RxJava for Resilient Enterprise

1

2

Code

Ob. StubMed. Service

Page 31: RxJava for Resilient Enterprise

Ob. StubMed. Service

Page 32: RxJava for Resilient Enterprise

Ob. StubMed. Service

Page 33: RxJava for Resilient Enterprise

System.out.println(“Hello W

Page 34: RxJava for Resilient Enterprise

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

Page 35: RxJava for Resilient Enterprise

We Have an Effective Composition

Page 36: RxJava for Resilient Enterprise

All You May Ever Need

Async

Conditional

Parallel Processing

Rx

Combining

Error Handling

Filtering Transform …….

Page 37: RxJava for Resilient Enterprise
Page 38: RxJava for Resilient Enterprise

Micro-services

Data Serialization

AsyncCall

Composition

ResiliencyDeclarative

CallComposition

Page 39: RxJava for Resilient Enterprise
Page 40: RxJava for Resilient Enterprise

System.out.println(“Hello W

Page 41: RxJava for Resilient Enterprise

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

Page 42: RxJava for Resilient Enterprise

Micro-services

Data Serialization

AsyncCall

Composition

ResiliencyDeclarative

CallComposition

Page 43: RxJava for Resilient Enterprise

Chronology Of a Failure

https://github.com/Netflix/Hystrix/wiki

Page 44: RxJava for Resilient Enterprise
Page 45: RxJava for Resilient Enterprise

HystrixCommand

run

failover

constructorCommand Name

Command Properties

Page 46: RxJava for Resilient Enterprise
Page 47: RxJava for Resilient Enterprise
Page 48: RxJava for Resilient Enterprise
Page 49: RxJava for Resilient Enterprise

System.out.println(“Hello W

Page 50: RxJava for Resilient Enterprise

Recap

• CB protected the application• Prevented poorly performing calls from blocking main execution thread

• Essential at all layers; especially for external services

Page 51: RxJava for Resilient Enterprise

http://bit.ly/xi2014-reactive

Page 52: RxJava for Resilient Enterprise

Questions

Page 53: RxJava for Resilient Enterprise

Be social

Page 54: RxJava for Resilient Enterprise