jug frankfurt - orchestration of microservices

41
Orchestration of microservices [email protected] With thoughts from http:// flowing.io @berndruecker | @martinschimak

Upload: bernd-ruecker

Post on 21-Jan-2018

335 views

Category:

Technology


4 download

TRANSCRIPT

Orchestration of microservices

[email protected]

With thoughts from http://flowing.io@berndruecker | @martinschimak

Software is eating the world.

Marc Andreessen, Entrepreneur & Investor

Photo by techcrunch, available under Creative Commons BY 2.0 license.

to pivot | pivoted, pivoted | [Tech]

If you are not embarrassed by the first version of your product, you’ve launched too late.

Reid Hoffman, Co-Founder LinkedIn (and others)

Photo by joi, available underCreative Commons BY 2.0 license

Microservices: It is about speed and agility at scale

• Small components withclear responsibilities

• Isolation

• Autonomy

• Replaceability

• Flexibility

• Experimentation

• Resilience

• Individual scalability

Photo by born1945, available under Creative Commons BY 2.0 license

Example

Checkout Payment Inventory Shipping

Distributed systems

Service A

Challenge: Synchronous collaboration

Call service B

Service B

The network is unreliable

Circuit breaker & fail fast

Retry capability & asyncbehavior

Challenge: Distributed transactions

1. bookhotel

2. bookcar

3. bookflight

6. cancelhotel

5. cancel

car

4. In case offailure triggercompensations

booktrip

Service A

Car Service Hotel Service Flight Service ACID-Transactions only local in theservice contexts

Distributed transaction via Saga pattern usingcompensatingactivities

Example

* Modeled in BPMN ISO Standard for modeling and execution

Example

Routing slip

Persistent thing(Entity, Actor, …)

State machineHow to

implement?

Implement yourself? ** How hard can it be?

Routing slip

Persistent thing(Entity, Actor, …)

State machine

BPM done right

Developer friendly Composable BizDevOps

Death byproperties panel

Live hacking

Waiting requires state

More long running requirements possible

Synchronous communication?

Asynchronous & reactive

Checkout Payment Inventory Shipping

Bus

Example

Checkout Payment Inventory Shipping

Bus

OrderPlaced

Does not know

recepient

Does not know

sender

Decentral datamanagement

Smart endpoints and dumb pipes

Event: Fact thathappened in the past,

Immutable fact, 0..n recepients

OrderPlaced

Customer statuschanged

Misconceptions in the microservice community

*Picture randomly taken from http://wareflo.com/2016/11/from-apis-to-microservices-workflow-orchestration-and-choreography-across-healthcare-organizations/. Not connected to statements on slide.

Orchestration…

…introduces single point offailure…

…leads to god services…

…leads to tight coupling…

End-to-end capabilities using event flows?

InventoryPayment ShippingCheckout

Order placed

Payment received

Goodsfetched

Goodsshipped

Shipping

Goodsshipped

End-to-end capabilities using event flows?

InventoryPaymentCheckout

Order placed

Payment received

Goodsfetched

Please fetchthe goods

while waitingfor payment

Somecustomers canpay via invoice

Commanding is equally important!

InventoryPayment ShippingCheckout

Bus

OrderPlaced

Event: Fact, happened in the past,

immutable, 0..n recepients

RetrievePayment

Command: Intend, 1 recipient.

FetchGoods

ShipGoods

Event Command transformation

InventoryPayment ShippingCheckout

Bus

Order

OrderPlaced

RetrievePayment

Event command transformation

PaymentRetrievePayment

OrderPlaced Order

CommandSomething has to happenin the future1 recipient

EventSomething hashappendin the past0..n recipients

Conciouslydecide where todo the coupling

Transformation

Customer Status Changed

Service A

Challenge: Asynchronous collaboration

Send message

to B

Service B

Wait forresponse

Timeout handling

Message correlation & deduplication

State handling

Parallelism & merging

Example

End-to-end processes cross microservice boundaries

Order

InventoryPayment

Pa

ym

en

t

Distributed flows are owned by microservicesO

rde

r

Distributed orchestration

End-to-end process view

OrderOrder

OrderOrder

Architecture

Order

Engine A

Payment

Engine B

MonitoringHuman Task Management

Coarse grained central

monitoring

Fine grained monitoring &

operations (per context)

DevOps

TecOps Biz

Ops

Central

Live hacking example

InventoryPaymentOrder ShippingCheckout Monitor

https://github.com/flowing/flowing-retail/

Live hacking

Container(e.g. Tomcat, WildFly, Websphere, …)

Architecture possibilities

Your application

Engine

DB

BPMN Java …

Your application

Engine

DB

BPMN Java …

Engine(Docker,

Tomcat, …)

Your application

DB

Embedded engine Container managed engine Remote engine

BPMNJava, C#, Go, JS, …

New kid on the block

https://zeebe.io/

ZeebeBroker

Yourapplication

Binary (MsgPack) Support streaming & batching

Client

Horiziontallyscalable

Append only log / event sourcing

State machines solve some hard developer problems

Monitoring & Operations

Handling of time & timeouts

Retry

Visibility &Reporting

Versioning

Compensation

Message correlation & deduplication

Performance & scalability

Thank you!

Code:https://github.com/berndruecker

Slides:https://bernd-ruecker.com

Blog:https://blog.bernd-ruecker.com

Feedback:https://bernd-ruecker.com/feedback

With thoughts from http://flowing.io@berndruecker | @martinschimak

Images licensed from iStockno attribution required

Images licensed under Creative Commons license

Photo by joi, available underCreative Commons BY 2.0 license.https://www.flickr.com/photos/joi/4029487352/

Photo by techcrunch, available underCreative Commons BY 2.0 license.https://www.flickr.com/photos/techcrunch/29035377473

Photo by born1945, available underCreative Commons BY 2.0 license.https://www.flickr.com/photos/12567713@N00/310639290

All icons licensed from Noun Projectno attribution required