SOA on Steroids

42
2015/09/17 SOA on Steroids David Bolene in collaboration with

Transcript of SOA on Steroids

Page 1: SOA on Steroids

2015/09/17

SOA on Steroids

David Bolenein

collaborationwith

Page 2: SOA on Steroids

2015 - David Bolene

TOC

Architecture for Cloud Services

SOA on Akka

2

4

24

Demo 35

What is (was) SOA? 20

Why Akka? 7

Page 3: SOA on Steroids

2015 - David Bolene

TOC

Architecture for Cloud Services

SOA on Akka

3

4

24

Demo 35

What is (was) SOA? 20

Why Akka? 7

Page 4: SOA on Steroids

2015 - David Bolene

Architecture Motivators for Cloud Services

- Elastic / Scalable

- Modular

- Simple

- Low Latency

- Service Integratable

- Resilient

- High Throughput

4

Page 5: SOA on Steroids

2015 - David Bolene

Architecture Anti-Patterns for Cloud Services

- Transaction Locking in the Database

- Locked/Synchronized Mutable Objects

- Database Joins

- Thread Blocking Method Calls

- Thread Blocking Service Calls

5

Page 6: SOA on Steroids

2015 - David Bolene

TOC

Architecture for Cloud Services

SOA on Akka

6

4

24

Demo 35

What is (was) SOA? 20

Why Akka? 7

Page 7: SOA on Steroids

2015 - David Bolene

Akka Actors

InboxMessageActor orFuture

AsyncSend

Enqueue

Actor

“one at a time”Dispatcher

Threads

Cores

7

How They Work

Page 8: SOA on Steroids

2015 - David Bolene

Akka

Actor

Actor

Actor

Supervises

Actor

Actor

Actor

Exception

Actor

Actor

Actor

re-start

Self Healing

8

Page 9: SOA on Steroids

2015 - David Bolene

Akka Akka Persistence

Actor

JournalStore

(e.g. Cassandra)

SnapshotStore

(e.g. Cassandra)

Event

Event

Event

snapshotIncremental Periodicasyncwrites

Message

Actor Durability - An Event Sourced Approach

9

Page 10: SOA on Steroids

2015 - David Bolene

Akka Akka Persistence

Actor

Event

Event

Eventsnapshot

Actor State Recovery

latest replay1 2

JournalStore(e.g.

Cassandra)

SnapshotStore(e.g.

Cassandra)

10

then

DiskSequential

Scans

Message

Page 11: SOA on Steroids

2015 - David Bolene

RESTbased on Akka

SocketHandler

ActorTCPPackets

sock

et RESTRoute

Handler

ActorHTTP

Requests

11

Spray / Akka HTTP

Page 12: SOA on Steroids

2015 - David Bolene

Spray / Akka HTTP RESTbased on Akka

SocketHandler

ActorTCPPackets

sock

et RESTRoute

Handler

ActorHTTP

Requests

BusinessDomain

ActorMessage

Context

Continuation

12

Page 13: SOA on Steroids

2015 - David Bolene

Spray / Akka HTTP RESTbased on Akka

SocketHandler

ActorTCPPackets

sock

et RESTRoute

Handler

ActorHTTP

Requests

BusinessDomain

ActorMessage

Context

Continuation

SocketHandler

ActorTCPPackets

sock

et

HTTPResponse

Context BusinessDomain

ActorMessage

time

13

Page 14: SOA on Steroids

2015 - David Bolene

Async from Top to Bottom

DomainActors

Cassandra

Akka.IOHTTP Toolkit

Socket

Packets

Spray REST Toolkit

HTTP

Commands /Events

Turtles All the Way Down

Async Writes

14

Page 15: SOA on Steroids

2015 - David Bolene 15

Async from Front to Back

DomainActors

Akka.IOHTTP Toolkit

Socket

Spray REST Toolkit

Turtles All the Way Through

Socket

Spray Client

Akka.IOHTTP Toolkit

Frontend (REST Client Calls)

Backend (External Service Calls)

Page 16: SOA on Steroids

2015 - David Bolene

Akka Clustering

ActorHostingClusterNode

ActorHostingClusterNode

ActorHostingClusterNode

ActorHostingClusterNode

ActorHostingClusterNode

ActorHostingClusterNode

Scaling Actors…

Message

Akka

16

Akka Protocol

Page 17: SOA on Steroids

2015 - David Bolene

Akka

FrontEnd(Spray)

Virtualizing Actor Placement

BackendNode

BackendNode

BackendNode

Cluster Sharding

Akka Cluster Sharding

Message

Shard Proxy

(e.g.)Cassandra

Re-hydrateon Demand

Passivateon Inactivity

Message

17

Page 18: SOA on Steroids

2015 - David Bolene

Akka Look Ma! No Transactions

ShoppingCart

Actor

Cassandra

18

Live state is here

NOT here

Page 19: SOA on Steroids

2015 - David Bolene

TOC

Architecture for Cloud Services

SOA on Akka

19

4

24

Demo 35

What is (was) SOA? 20

Why Akka? 7

Page 20: SOA on Steroids

2015 - David Bolene

Akka What is (was) SOA

20

(fat)Web

Services

WebService

WebService

WebService

WebService

WebService

XML / JSON XML / JSON XML / JSON XML / JSON XML / JSON

Page 21: SOA on Steroids

2015 - David Bolene

Akka What is (was) SOA

21

ProcessOrchestration

(e.g. BPEL)

ReceiveOrder

RequestCreditScore

ReceiveCreditScore

SendOrderStatus

Credit Service

Customer Order Placement Process

Seller Order Capture Process

CustomerOrder

OrderStatus

CreditRequest

CreditResponse

Page 22: SOA on Steroids

2015 - David Bolene

Akka What is (was) SOA

22

Choreography

Choreography Contract

Buyer Seller

RFQ

RFI

Clarification

Decline

Quote

P.O.

DecisionStatusRequest

DecisionStatus

NegotiationC

hannelPost N

egotiationC

hannelvalid-until-dateTimeexpired

AcceptanceC

hannel

LossNotification

Page 23: SOA on Steroids

2015 - David Bolene

TOC

Architecture for Cloud Services

SOA on Akka

23

4

24

Demo 35

What is (was) SOA? 20

Why Akka? 7

Page 24: SOA on Steroids

2015 - David Bolene

Akka What is a Service in Akka?

24

WebService

XML / JSON

Microservice

Actor

JSON

Page 25: SOA on Steroids

2015 - David Bolene

Akka Akka Cluster Service Architecture

FrontEnd(Spray)

BackendOrchestration

Actors

FrontEnd(Spray)

BackendOrchestration

Actors

FrontEnd(Spray)

BackendOrchestration

Actors

LoadBalancer

MicroserviceActors

1,2

MicroserviceActors3,4,5…

Cluster Sharding(e.g. Fulfillment Process)

ExternalWeb Services

Spray Client

State State

3

Message

CassandraCassandra

Cassandra

25

Page 26: SOA on Steroids

2015 - David Bolene

Akka Akka Cluster Service Architecture

FrontEnd(Spray)

BackendOrchestration

Actors

FrontEnd(Spray)

BackendOrchestration

Actors

FrontEnd(Spray)

BackendOrchestration

Actors

LoadBalancer

MicroserviceActors

1,2

MicroserviceActors3,4,5…

Cluster Sharding(e.g. Fulfillment Process)

Can be dynamically added/removedfor scale

Can be scaled horizontallywith Akka Actor Routers

1

26

Page 27: SOA on Steroids

2015 - David Bolene and Comcast

Akka Service Registry for Akka

Discovery and Dependency Resolution of Service Actors…

A

B

C

D

E

ServiceRegistry

forAkka

MicroserviceActors

1

2

3

Subscribeto E Publish

EDeliver

E

MicroserviceActors

MicroserviceActors

4Publish

A

27

Actor Service Registry for Akkais a Comcast artifact

soon to be open sourced

Page 28: SOA on Steroids

2015 - David Bolene and Comcast

Akka Service Registry for Akka

Cluster-Wide Circuit Breaker Coordinator for Service Actors…

A

B

C

ServiceRegistry

forAkka

MicroserviceActors

3

1

2

UnPublishA Death

WatchE

EUnavailable

MicroserviceActors

MicroserviceActors

E

D

28

Actor Service Registry for Akkais a Comcast artifact

soon to be open sourced

Page 29: SOA on Steroids

2015 - David Bolene

Akka Microservice Actors

FSM Circuit Breaker

29

B

Offline Online

B [available]

B [unavailable]

A

dependson

Overseer

supervises

Page 30: SOA on Steroids

2015 - David Bolene

Akka Akka Clustering

DockerContainer

DockerContainer

Perfect with Docker

RUN java -jar FrontEnd.jar 2551

RUN java -jar BackEnd.jar 2552

30

Page 31: SOA on Steroids

2015 - David Bolene

AkkaDocker Runtime Provides Cluster Node Resiliency

DockerContainer

DockerContainer

DockerContainer

DockerContainer

DockerContainer

DockerContainer

Container Restart Policy: always or on-failure

Recovery

31

Page 32: SOA on Steroids

2015 - David Bolene and Comcast

Akka Service Registry for Akka

Provides Microservice Dependency Recovery/Resiliency

A

B

C

D

E

ServiceRegistry

forAkka

MicroserviceActors

1

2

3

Subscribeto E Publish

EDeliver

E

MicroserviceActors

MicroserviceActors

4Publish

A

32

Page 33: SOA on Steroids

2015 - David Bolene

Akka

Actor

Actor

Actor

Supervises

Actor

Actor

Actor

Exception

Actor

Actor

Actor

re-start

Akka systemsare

fault-tolerant(self-healing)

33

Page 34: SOA on Steroids

2015 - David Bolene

TOC

Architecture for Cloud Services

SOA on Akka

34

4

24

Demo 35

What is (was) SOA? 20

Why Akka? 7

Page 35: SOA on Steroids

2015 - David Bolene 35

Bob Wilson’s Garage

We repair your car(if our staff showed up today)

andwe detail it for free!

Page 36: SOA on Steroids

2015 - David Bolene 36

FrontEnd(Spray)

Client

BackendOrchestration

Actors

BackendOrchestration

ActorsStaffing

MicroserviceCar DetailingMicroservice

Sharded Order Fulfillment Processes

CassandraCassandra

Cassandra

Car RepairMicroservice

ServiceRegistryfor Akka

Bob Wilson’s GarageCluster

Depends On

Depends On

Page 37: SOA on Steroids

2015 - David Bolene 37

InitialState

CarRepairing

State

CarDetailing

State

Finished

ServiceUnavailable

BobWilsonsGarageServiceRequest

Car Repair Microservice Car Detailing Microservice

Staffing Microservice

BobWilsonsGarageServiceResponse

REST Client

CarServiceRequest

CarServiceResponse

StaffingRequest

StaffingRequest

StaffingResponse

StaffingResponse

CarDetailRequest

CarDetailResponse

Fulfillment Process

Bob Wilson’sGarage

inBPMN

[Car Repair & Car Detailing Offline]

[Car Detailing Offline]

POST GET

Page 38: SOA on Steroids

2015/09/17

[email protected]

twitter: dbolene

https://github.com/dbolene/BobWilsonsGarage

SOA on Steroids

David Bolenein

collaborationwith

https://github.com/Comcast/ActorServiceRegistry

Page 39: SOA on Steroids

2015 - David Bolene

CassandraWhy Cassandra

CassandraNode

CassandraNode

CassandraNode

CassandraNode

CassandraNode

eventuallyconsistent

replication

eventuallyconsistent

replication

Akka Actor-basedin-memory state approachallows for use of eventually

consistent NoSQLpersistence.

39

Cassandra is the best write-optimized

scalable andproduction maintainable

NoSQL systemon the market

(fits Akka perfectly).

Page 40: SOA on Steroids

2015 - David Bolene

CassandraWhy Cassandra

CassandraNode

CassandraNode

CassandraNode

CassandraNode

CassandraNode

40

Client

WriteConsistency

Tunable

ReadConsistency

Tunable

Page 41: SOA on Steroids

2015 - David Bolene

Why Cassandra

CassandraNode

CassandraNode

CassandraNode

CassandraNode

CassandraNode

CassandraNode

CassandraNode

CassandraNode

CassandraNode

CassandraNode

Data CenterReplication

41

Reporting & Analytics

OnlineCluster

ReportingCluster

Page 42: SOA on Steroids

2015 - David Bolene

Materialized Views

How to Use Cassandra

42

Actor

JournalStore

SnapshotStore

Event

Event

Event

snapshotFulfillment

(Actor)State Property 2

Mutate

Party(Actor)

Fulfillment(Actor)

Property 1

Property 2

Materialized View - Party Vs Fulfillment Materialized View - Party Vs FuflillmentState

Designedfor sequential scans

Designedfor sequential scans

Side-EffectSide-Effect

Party(Actor)