Upload
david-bolene
View
1.123
Download
0
Embed Size (px)
Citation preview
2015/09/17
SOA on Steroids
David Bolenein
collaborationwith
2015 - David Bolene
TOC
Architecture for Cloud Services
SOA on Akka
2
4
24
Demo 35
What is (was) SOA? 20
Why Akka? 7
2015 - David Bolene
TOC
Architecture for Cloud Services
SOA on Akka
3
4
24
Demo 35
What is (was) SOA? 20
Why Akka? 7
2015 - David Bolene
Architecture Motivators for Cloud Services
- Elastic / Scalable
- Modular
- Simple
- Low Latency
- Service Integratable
- Resilient
- High Throughput
4
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
2015 - David Bolene
TOC
Architecture for Cloud Services
SOA on Akka
6
4
24
Demo 35
What is (was) SOA? 20
Why Akka? 7
2015 - David Bolene
Akka Actors
InboxMessageActor orFuture
AsyncSend
Enqueue
Actor
“one at a time”Dispatcher
Threads
Cores
7
How They Work
2015 - David Bolene
Akka
Actor
Actor
Actor
Supervises
Actor
Actor
Actor
Exception
Actor
Actor
Actor
re-start
Self Healing
8
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
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
2015 - David Bolene
RESTbased on Akka
SocketHandler
ActorTCPPackets
sock
et RESTRoute
Handler
ActorHTTP
Requests
11
Spray / Akka HTTP
2015 - David Bolene
Spray / Akka HTTP RESTbased on Akka
SocketHandler
ActorTCPPackets
sock
et RESTRoute
Handler
ActorHTTP
Requests
BusinessDomain
ActorMessage
Context
Continuation
12
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
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
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)
2015 - David Bolene
Akka Clustering
ActorHostingClusterNode
ActorHostingClusterNode
ActorHostingClusterNode
ActorHostingClusterNode
ActorHostingClusterNode
ActorHostingClusterNode
Scaling Actors…
Message
Akka
16
Akka Protocol
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
2015 - David Bolene
Akka Look Ma! No Transactions
ShoppingCart
Actor
Cassandra
18
Live state is here
NOT here
2015 - David Bolene
TOC
Architecture for Cloud Services
SOA on Akka
19
4
24
Demo 35
What is (was) SOA? 20
Why Akka? 7
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
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
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
2015 - David Bolene
TOC
Architecture for Cloud Services
SOA on Akka
23
4
24
Demo 35
What is (was) SOA? 20
Why Akka? 7
2015 - David Bolene
Akka What is a Service in Akka?
24
WebService
XML / JSON
Microservice
Actor
JSON
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
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
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
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
2015 - David Bolene
Akka Microservice Actors
FSM Circuit Breaker
29
B
Offline Online
B [available]
B [unavailable]
A
dependson
Overseer
supervises
2015 - David Bolene
Akka Akka Clustering
DockerContainer
DockerContainer
Perfect with Docker
RUN java -jar FrontEnd.jar 2551
RUN java -jar BackEnd.jar 2552
30
2015 - David Bolene
AkkaDocker Runtime Provides Cluster Node Resiliency
DockerContainer
DockerContainer
DockerContainer
DockerContainer
DockerContainer
DockerContainer
Container Restart Policy: always or on-failure
Recovery
31
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
2015 - David Bolene
Akka
Actor
Actor
Actor
Supervises
Actor
Actor
Actor
Exception
Actor
Actor
Actor
re-start
Akka systemsare
fault-tolerant(self-healing)
33
2015 - David Bolene
TOC
Architecture for Cloud Services
SOA on Akka
34
4
24
Demo 35
What is (was) SOA? 20
Why Akka? 7
2015 - David Bolene 35
Bob Wilson’s Garage
We repair your car(if our staff showed up today)
andwe detail it for free!
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
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
2015/09/17
twitter: dbolene
https://github.com/dbolene/BobWilsonsGarage
SOA on Steroids
David Bolenein
collaborationwith
https://github.com/Comcast/ActorServiceRegistry
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).
2015 - David Bolene
CassandraWhy Cassandra
CassandraNode
CassandraNode
CassandraNode
CassandraNode
CassandraNode
40
Client
WriteConsistency
Tunable
ReadConsistency
Tunable
2015 - David Bolene
Why Cassandra
CassandraNode
CassandraNode
CassandraNode
CassandraNode
CassandraNode
CassandraNode
CassandraNode
CassandraNode
CassandraNode
CassandraNode
Data CenterReplication
41
Reporting & Analytics
OnlineCluster
ReportingCluster
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)