Master the flow of microservices - because your business is more complex than ...

72
@berndruecker #VoxxedVienna Because your business is more complex than * * Some big video streaming company [email protected] With thoughts from http:// flowing.io @berndruecker | @martinschimak

Transcript of Master the flow of microservices - because your business is more complex than ...

Page 1: Master the flow of microservices - because your business is more complex than ...

@berndruecker#VoxxedVienna

Because your business ismore complex than *

* Some big video streaming company

[email protected]

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

Page 2: Master the flow of microservices - because your business is more complex than ...

FAMGA

Page 3: Master the flow of microservices - because your business is more complex than ...

FANG

Page 4: Master the flow of microservices - because your business is more complex than ...

Tech stack

https://www.slideshare.net/RaminForood/platform-data-technologies-at-netflix

Noorchestration.

Page 5: Master the flow of microservices - because your business is more complex than ...

Orchestration

Page 6: Master the flow of microservices - because your business is more complex than ...
Page 7: Master the flow of microservices - because your business is more complex than ...

Netflix recognized challenges in orchestration

Page 8: Master the flow of microservices - because your business is more complex than ...

Let‘s do some groundwork before wedive into orchestration…

Page 9: Master the flow of microservices - because your business is more complex than ...

System complexity increases dramatically

Warehouse System

LogisticsPlatform

TaxiSystem

TravelPlatform

Insurance System

Insurance Platform

Heating with temperature

sensor

Smart Heating(Cloud

controlled)

Page 10: Master the flow of microservices - because your business is more complex than ...

Helpful paradigms

Microservices Event Driven & Reactive Domain Driven Design

Page 11: Master the flow of microservices - because your business is more complex than ...

Microservices

• Independent components

• Independent deployments

• Decoupling between components

• Dedicated teams to fight conways law

• Autonomy of technology decisions

• Avoid horizontal team boundaries

• New DevOps paradigms

Microservice

Microservice

Microservice

Monolith

A

B

C

A

B

C

Page 12: Master the flow of microservices - because your business is more complex than ...

Event driven microservices

Microservice Microservice Microservice

A B C

Eventbus

Page 13: Master the flow of microservices - because your business is more complex than ...

Communication via events

Microservice Microservice

A C

Eventbus

Event

event namepayload

no receipient

Page 14: Master the flow of microservices - because your business is more complex than ...

Communication via Events

Microservice Microservice

A C

Eventbus

Event

Does not know

about C

Does not know

about A

Page 15: Master the flow of microservices - because your business is more complex than ...

Compare to SOA

Service Service

A C

ESB

„smart endpoints and dumb pipes”

Page 16: Master the flow of microservices - because your business is more complex than ...

Value proposition: fight conway, keep agility and ease changes

Microservice Microservice

A C

Eventbus

Page 17: Master the flow of microservices - because your business is more complex than ...

Yeah.

Page 18: Master the flow of microservices - because your business is more complex than ...

Example: Simple order handling

Page 19: Master the flow of microservices - because your business is more complex than ...

pay receive

shipment

place

order

I want to buy this!

I am happy!

Page 20: Master the flow of microservices - because your business is more complex than ...

Sample Microservices

Inventory Service

Handles Stock, Reserviations andphysical handlingof goods

Payment Service Handles Payment

Shipping Service

Manage shipments & labels for logisticproviders

Page 21: Master the flow of microservices - because your business is more complex than ...

Eventflow

Order Placed

Payment Received

GoodsPicked

GoodsShipped

InventoryPayment ShippingShop

Page 22: Master the flow of microservices - because your business is more complex than ...

Implementation

Page 23: Master the flow of microservices - because your business is more complex than ...

Let‘s zoom in the payment service

Payment Serviceorderplaced

paymentreceived

Page 24: Master the flow of microservices - because your business is more complex than ...

Let‘s zoom in the payment service

Payment Serviceorderplaced

paymentreceived

The payment servicehas to listen to

„order placed“ event

Page 25: Master the flow of microservices - because your business is more complex than ...

De-coupling?

Payment Service

orderplaced

servicefullfilled

Whenever a new service requirespayment, the payment has to bechanged

Payment has to know all possibleevents that trigger a payment

subscriptionconfirmed

Page 26: Master the flow of microservices - because your business is more complex than ...

Martin Fowler also recognized

Event notification is nice because it implies a low level of coupling, and is pretty simple to set up. It can become problematic, however, if there really is a logical flow that runs over various event notifications. The problem is that it can be hard to see such a flow as it's not explicit in any program text. Often the only way to figure out this flow is from monitoring a live system. This can make it hard to debug and modify such a flow. The danger is that it's very easy to make nicely decoupled systems with event notification, without realizing that you're losing sight of that larger-scale flow, and thus set yourself up for trouble in future years

https://martinfowler.com/articles/201701-event-driven.html

Page 27: Master the flow of microservices - because your business is more complex than ...

Event Command Transformation

Payment Servicedo

paymentorderplaced Transformation

CommandSomething has to happenin the future1 recipient

EventSomething has happendin the past0..n recipients

Page 28: Master the flow of microservices - because your business is more complex than ...

This calls for an order service

Payment servicedo

paymentorderplaced Order service

Page 29: Master the flow of microservices - because your business is more complex than ...

Microservices

Inventory service

Payment service

Order service

Does eventcommandtransformationfor orders

Shipping service

Page 30: Master the flow of microservices - because your business is more complex than ...

Event Command Transformation

dopayment

orderplaced

OrderService

paymentreceived

pickgoods

goodspicked

shipgoods

goodsshipped

orderdelivered

OrderService

OrderService

OrderService

Page 31: Master the flow of microservices - because your business is more complex than ...

Smeels like a central ESB?

http://apsblog.burtongroup.com/2009/01/soa-is-dead-long-live-services.html

Page 32: Master the flow of microservices - because your business is more complex than ...

No! Far from it!

Inventory service

Payment service

Order serviceMight beimplemented in simple Java

Shipping service

Page 33: Master the flow of microservices - because your business is more complex than ...

Order service does the orchestration

Page 34: Master the flow of microservices - because your business is more complex than ...

Implementation (with event command transformation)

Page 35: Master the flow of microservices - because your business is more complex than ...

Some things in life are slow

dopayment

orderplaced

paymentreceived

pickgoods

goodspicked

shipgoods

goodsshipped

orderdelivered

OrderService

Long Running

Long Running

Long Running

Long Running

Page 36: Master the flow of microservices - because your business is more complex than ...

You also have to handle state.

Page 37: Master the flow of microservices - because your business is more complex than ...

Bernd Rücker

Co-founder Camunda> 10+ years workflow

http://bernd-ruecker.com/[email protected]

Camunda

Open source vendorBerlin + San Francisco

> 60 employeesNo venture capital

www.camunda.org

Page 38: Master the flow of microservices - because your business is more complex than ...

The 7 sins of workflow and Java

Homegrownengine

No engine Wrong engine

4

6

5

7

All sins: http://blog.bernd-ruecker.com/

Zero-code suites

Wrong usage

Page 39: Master the flow of microservices - because your business is more complex than ...

ToolsState Visibility

[ Orchestration | Workflow | BPM ] Engine

Page 40: Master the flow of microservices - because your business is more complex than ...

Order example in BPMN*

*BPMN = ISO standard for modeling and execution

in thiscontextmeans:

Page 41: Master the flow of microservices - because your business is more complex than ...

Payment example

Page 42: Master the flow of microservices - because your business is more complex than ...

Pa

ym

en

t se

rvic

e

Orchestration is part of the microservices!O

rde

r se

rvic

e

Eventbus

Page 43: Master the flow of microservices - because your business is more complex than ...

It does not have to be one monlithic process

Hint: This might work well if your company is structured tohave this one clear process owner for this process.

Page 44: Master the flow of microservices - because your business is more complex than ...

Microservice vs. BPM community

Page 45: Master the flow of microservices - because your business is more complex than ...

Requirement: lightweight and embeddable engine

Engine must be

• easy to use

• developer friendly

also in the scope of microservices

• technically

• license model

Payment service

Order service

engine

engine

engine

Page 46: Master the flow of microservices - because your business is more complex than ...

Yes – that‘s possible!

Page 47: Master the flow of microservices - because your business is more complex than ...

LiveDemo

Page 48: Master the flow of microservices - because your business is more complex than ...

Architecture

Inventoryservice

Payment service

Order service

Shippingservice

H2

Shop Monitor

Camunda Webapp

on Tomcat

for demo in single Java VM for simplicity

Page 49: Master the flow of microservices - because your business is more complex than ...

Screenshots

Page 50: Master the flow of microservices - because your business is more complex than ...

Screenshots

Page 51: Master the flow of microservices - because your business is more complex than ...

And synchronous communication?

Page 52: Master the flow of microservices - because your business is more complex than ...

Communication between Microservices

Microservice Microservice

Microservice

A B

C

e.g. REST

You need to handle outtages (wait, retry, …)

Page 53: Master the flow of microservices - because your business is more complex than ...

Change scenarios

Page 54: Master the flow of microservices - because your business is more complex than ...

We want to reservegoods even before wereceived the payment.

Page 55: Master the flow of microservices - because your business is more complex than ...

Changes

Inventory service

Payment service

Order service

Shipping service

must providereservation

servicereserve goods at right moment

Page 56: Master the flow of microservices - because your business is more complex than ...

BPMN

Page 57: Master the flow of microservices - because your business is more complex than ...

Changes

Inventory service

Payment service

Order service

Shipping service

must providereservation

servicereserve goods at right moment

Listen to goodsreserved insteadof order created.

Listen to ordercreated.

With event commandtransformation

Without

Page 58: Master the flow of microservices - because your business is more complex than ...

VIP customers can order with invoice (and pay later)

Page 59: Master the flow of microservices - because your business is more complex than ...

Required changes

Inventory service

Payment service

Order service

Shipping service

Invoice service

skip payment, but add open invoice

Page 60: Master the flow of microservices - because your business is more complex than ...

Responsibility of order service

Page 61: Master the flow of microservices - because your business is more complex than ...

Required changes

Inventory service

Payment service

Order service

Shipping service

Invoice service

skip payment, but add open invoice

Listen to ordercreated VIP or

payment received(non VIP).

Listen to ordercreated (VIP).

Page 62: Master the flow of microservices - because your business is more complex than ...

We need more cool stuff – can BPMN do this?

Page 63: Master the flow of microservices - because your business is more complex than ...

Compensation

…in case of errors in error handling pay the

money back to thecustomer

Page 64: Master the flow of microservices - because your business is more complex than ...

Timeouts…after two weeks

pricing is not bindingany more

Page 65: Master the flow of microservices - because your business is more complex than ...

When a customer cancels, we want to win him back!

Page 66: Master the flow of microservices - because your business is more complex than ...

Required changes

Inventory service

Payment service

Order service

Shipping service

Listen toappropriate

events, no changeanywhere else

Winback service

BPM monolith

Page 67: Master the flow of microservices - because your business is more complex than ...

Summary

• Microservices and event driven architecture go well together

• You need an event command transformation

• If the translation is stateful, consider using an appropriate engine

• Modern lightweight engines foster and not hinder these architectures

Page 68: Master the flow of microservices - because your business is more complex than ...

Is it for me?Isn‘t all of that just for FANG?

Page 69: Master the flow of microservices - because your business is more complex than ...

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

Page 70: Master the flow of microservices - because your business is more complex than ...

https://github.com/flowing

Page 71: Master the flow of microservices - because your business is more complex than ...

Slides online at http://bernd-ruecker.com

Page 72: Master the flow of microservices - because your business is more complex than ...

Thank you! Any questions?