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

JUG Frankfurt - Orchestration of microservices

Jan 21, 2018

Download

Technology

Bernd Rücker
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: JUG Frankfurt - Orchestration of microservices

Orchestration of microservices

[email protected]

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

Page 2: JUG Frankfurt - Orchestration of microservices

Software is eating the world.

Marc Andreessen, Entrepreneur & Investor

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

Page 3: JUG Frankfurt - Orchestration of microservices

to pivot | pivoted, pivoted | [Tech]

Page 4: JUG Frankfurt - Orchestration of microservices

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

Page 5: JUG Frankfurt - Orchestration of microservices

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

Page 6: JUG Frankfurt - Orchestration of microservices

Example

Checkout Payment Inventory Shipping

Page 7: JUG Frankfurt - Orchestration of microservices

Distributed systems

Page 8: JUG Frankfurt - Orchestration of microservices

Service A

Challenge: Synchronous collaboration

Call service B

Service B

The network is unreliable

Circuit breaker & fail fast

Retry capability & asyncbehavior

Page 9: JUG Frankfurt - Orchestration of microservices

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

Page 10: JUG Frankfurt - Orchestration of microservices

Example

* Modeled in BPMN ISO Standard for modeling and execution

Page 11: JUG Frankfurt - Orchestration of microservices

Example

Page 12: JUG Frankfurt - Orchestration of microservices

Routing slip

Persistent thing(Entity, Actor, …)

State machineHow to

implement?

Page 13: JUG Frankfurt - Orchestration of microservices

Implement yourself? ** How hard can it be?

Page 14: JUG Frankfurt - Orchestration of microservices

Routing slip

Persistent thing(Entity, Actor, …)

State machine

Page 15: JUG Frankfurt - Orchestration of microservices

BPM done right

Developer friendly Composable BizDevOps

Death byproperties panel

Page 16: JUG Frankfurt - Orchestration of microservices

Live hacking

Page 17: JUG Frankfurt - Orchestration of microservices

Waiting requires state

Page 18: JUG Frankfurt - Orchestration of microservices

More long running requirements possible

Page 19: JUG Frankfurt - Orchestration of microservices

Synchronous communication?

Page 20: JUG Frankfurt - Orchestration of microservices

Asynchronous & reactive

Checkout Payment Inventory Shipping

Bus

Page 21: JUG Frankfurt - Orchestration of microservices

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

Page 22: JUG Frankfurt - Orchestration of microservices

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…

Page 23: JUG Frankfurt - Orchestration of microservices

End-to-end capabilities using event flows?

InventoryPayment ShippingCheckout

Order placed

Payment received

Goodsfetched

Goodsshipped

Page 24: JUG Frankfurt - Orchestration of microservices

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

Page 25: JUG Frankfurt - Orchestration of microservices

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

Page 26: JUG Frankfurt - Orchestration of microservices

Event Command transformation

InventoryPayment ShippingCheckout

Bus

Order

OrderPlaced

RetrievePayment

Page 27: JUG Frankfurt - Orchestration of microservices

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

Page 28: JUG Frankfurt - Orchestration of microservices

Service A

Challenge: Asynchronous collaboration

Send message

to B

Service B

Wait forresponse

Timeout handling

Message correlation & deduplication

State handling

Parallelism & merging

Page 29: JUG Frankfurt - Orchestration of microservices

Example

Page 30: JUG Frankfurt - Orchestration of microservices

End-to-end processes cross microservice boundaries

Order

InventoryPayment

Page 31: JUG Frankfurt - Orchestration of microservices

Pa

ym

en

t

Distributed flows are owned by microservicesO

rde

r

Distributed orchestration

Page 32: JUG Frankfurt - Orchestration of microservices

End-to-end process view

Page 33: JUG Frankfurt - Orchestration of microservices

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

Page 34: JUG Frankfurt - Orchestration of microservices

Live hacking example

InventoryPaymentOrder ShippingCheckout Monitor

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

Page 35: JUG Frankfurt - Orchestration of microservices

Live hacking

Page 36: JUG Frankfurt - Orchestration of microservices

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, …

Page 37: JUG Frankfurt - Orchestration of microservices

New kid on the block

https://zeebe.io/

ZeebeBroker

Yourapplication

Binary (MsgPack) Support streaming & batching

Client

Horiziontallyscalable

Append only log / event sourcing

Page 38: JUG Frankfurt - Orchestration of microservices

State machines solve some hard developer problems

Monitoring & Operations

Handling of time & timeouts

Retry

Visibility &Reporting

Versioning

Compensation

Message correlation & deduplication

Performance & scalability

Page 39: JUG Frankfurt - Orchestration of microservices

Thank you!

Page 40: JUG Frankfurt - Orchestration of microservices

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

Page 41: JUG Frankfurt - Orchestration of microservices

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