Microservice Integration and How to Avoid Them @berndruecker Bernd - - PowerPoint PPT Presentation

microservice integration and
SMART_READER_LITE
LIVE PREVIEW

Microservice Integration and How to Avoid Them @berndruecker Bernd - - PowerPoint PPT Presentation

3 Common Pitfalls in Microservice Integration and How to Avoid Them @berndruecker Bernd Ruecker Co-founder and Developer Advocate of Camunda Berlin, Germany bernd.ruecker@camunda.com @berndruecker REST, SOAP, Cloud, Saas, Microservices,


slide-1
SLIDE 1

3 Common Pitfalls in Microservice Integration and How to Avoid Them

@berndruecker

slide-2
SLIDE 2

Berlin, Germany

bernd.ruecker@camunda.com @berndruecker

Bernd Ruecker

Co-founder and Developer Advocate of Camunda

slide-3
SLIDE 3

REST, SOAP, Cloud, Saas, Microservices, SCS, FaaS, Serverless, …

slide-4
SLIDE 4

Distributed systems

slide-5
SLIDE 5

https://www.infoworld.com/article/3254777/application-development/ 3-common-pitfalls-of-microservices-integrationand-how-to-avoid-them.html

slide-6
SLIDE 6

Distributed systems

Challenges of asynchronicity Distributed T ransactions Communication is complex

slide-7
SLIDE 7

Some Service Some Service Some Service Some Service Some Service Some Service Some Service

Failure will happen. Accept it! But keep it local! Be resilient.

slide-8
SLIDE 8

Let‘s start with a simple example

Credit Card Payment

REST

slide-9
SLIDE 9

Live hacking

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

slide-10
SLIDE 10

Circuit Breaker

Photo by CITYEDV, available under Creative Commons CC0 1.0 license.

slide-11
SLIDE 11

Fai ail f l fast is important

slide-12
SLIDE 12

Fai ail f l fast is important but not enough!

slide-13
SLIDE 13

Photo by Tookapic, available under Creative Commons CC0 1.0 license.

slide-14
SLIDE 14

„There was an error while sending your boarding pass“

slide-15
SLIDE 15

Check-in Web-UI

Me

Current situation

slide-16
SLIDE 16

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Current situation

slide-17
SLIDE 17

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Current situation

slide-18
SLIDE 18

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Current situation

Circuit breaker

slide-19
SLIDE 19
slide-20
SLIDE 20

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Current situation – the bad part

slide-21
SLIDE 21

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Current situation – the bad part

slide-22
SLIDE 22

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Current situation – the bad part

Stateful Retry

slide-23
SLIDE 23
slide-24
SLIDE 24

We are having some technical difficulties and cannot present you your boarding pass right away. But we do actively retry ourselves, so lean back, relax and we will send it

  • n time.
slide-25
SLIDE 25

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Possible situation – much better!

slide-26
SLIDE 26

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Possible situation – much better!

Stateful Retry

slide-27
SLIDE 27

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Stateful Retry

Possible situation – much better!

The failure never leaves this scope!

slide-28
SLIDE 28

Persist thing (Entity, Document, Actor, …) State machine or workflow engine T ypical concerns DIY = effort, accidental complexity Complex, proprietary, heavyweight, slow, don‘t scale, developer adverse

Scheduling, Versioning,

  • perating, visibility,

scalability, …

Handling State

slide-29
SLIDE 29

Workflow engines, state machines

It is

relevant

in modern architectures

slide-30
SLIDE 30

CADENCE

Silicon valley has recognized

Workflow engines, state machines

slide-31
SLIDE 31

CADENCE

Workflow engines, state machines

slide-32
SLIDE 32

CADENCE

also at scale

Workflow engines, state machines

slide-33
SLIDE 33

CADENCE

for todays demo

Workflow engines, state machines

slide-34
SLIDE 34

Live hacking

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

slide-35
SLIDE 35

Payment

Now you have a state machine!

Credit Card

REST

slide-36
SLIDE 36

has to implement

Retry

has to implement

Idempotency

Client Service Provider

slide-37
SLIDE 37

We are processing your payment. Do not leave this page. And for god sake – do not reload!

It is a business problem anyway!

slide-38
SLIDE 38

We are processing your payment. Do not leave this page. And for god sake – do not reload!

It is a business problem anyway!

We are currently processing your request. Don‘t worry, it will happen safely – even if you loose connection. Feel free to reload this page any time!

slide-39
SLIDE 39

Requirement: Idempotency of services!

Photo by pixabay, available under Creative Commons CC0 1.0 license.

slide-40
SLIDE 40

Requirement: Idempotency of services!

Photo by Chr.Späth, available under Public Domain.

slide-41
SLIDE 41

Distributed systems introduce complexity you have to tackle!

Credit Card Payment

REST

slide-42
SLIDE 42

Distributed systems

slide-43
SLIDE 43

It is impossible to differentiate certain failure scenarios.

Independant of communication style!

Service Provider Client

slide-44
SLIDE 44

Distributed systems introduce complexity you have to tackle!

Credit Card Payment

REST

slide-45
SLIDE 45

Distributed systems introduce complexity you have to tackle!

Credit Card Payment

REST

slide-46
SLIDE 46

BPMN

Business Process Model and Notation ISO Standard

slide-47
SLIDE 47

BPMN

Executable and mature Easy to understand* Widespread

*(for Biz, Dev, and Ops)

slide-48
SLIDE 48

Proper Operations

Visibility + Context

slide-49
SLIDE 49

Compare to e.g. Step Functions

slide-50
SLIDE 50

Workflows live within service boundaries

Credit Card Payment

REST

slide-51
SLIDE 51

Check-in Barcode Generato r Web-UI

Me

Output Mgmt

Workflows live within service boundaries

slide-52
SLIDE 52

Check-in Barcode Generato r Web-UI

Me

Output Mgmt

Workflows live within service boundaries

slide-53
SLIDE 53

Manigfold architecture options

https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

slide-54
SLIDE 54

Manigfold architecture options

https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

slide-55
SLIDE 55

Manigfold architecture options

https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

slide-56
SLIDE 56

Manigfold architecture options

https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

slide-57
SLIDE 57

generateBoardingPass HTTP 200 OK HTTP 202 ACCEPTED

Check-in

Happy case: Synchronous response Otherwise: asynchronous

slide-58
SLIDE 58

„The customer wants a synchronous response“

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

„Eh – no!“

slide-59
SLIDE 59

Synchronous communication is the crystal meth of distributed programming

T

  • dd Montgomery and Martin Thompson

in “How did we end up here” at GOT

O Chicago 2015

slide-60
SLIDE 60

Challenges of asynchronicity

slide-61
SLIDE 61

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Asynchronous communication

You need to monitor timeouts

slide-62
SLIDE 62

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Remember…

The failure never leaves this scope!

slide-63
SLIDE 63

Workflow…

slide-64
SLIDE 64

Workflow…

slide-65
SLIDE 65

has to implement

Timeout, Retry

has to implement

Idempotency

Client Service Provider

slide-66
SLIDE 66

Who uses a message bus?

slide-67
SLIDE 67

Who has no problems

  • perating a message bus?

Dead messages | No context | Inaccesible payload | Hard to redeliver | Home-grown message hospitals | …

slide-68
SLIDE 68

Manigfold architecture options

https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

slide-69
SLIDE 69

Manigfold architecture options

https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

slide-70
SLIDE 70

Manigfold architecture options

https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

slide-71
SLIDE 71

Avoids th thundering ering her erds

Photo by Gopal Vijayaraghavan, available under Creative Commons BY 2.0 license.

slide-72
SLIDE 72

Photo by Gopal Vijayaraghavan, available under Creative Commons BY 2.0 license. https://aws.amazon.com/de/message/5467D2/

slide-73
SLIDE 73

Distributed T ransactions Distributed T ransactions

slide-74
SLIDE 74

Distributed systems

slide-75
SLIDE 75

Pat Helland

Grown-Ups Don’t Use Distributed T ransactions

Distributed Systems Guru Worked at Amazon, Microsoft & Salesforce

slide-76
SLIDE 76

Distributed transactions using compensation *

Compensation

slide-77
SLIDE 77

Eventual consistency

T emporarily inconsistent state But only temporarily!

slide-78
SLIDE 78

Live hacking

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

slide-79
SLIDE 79

has to implement

Timeout, Retry, Compensation

has to offer

Compensation

has to implement

Idempotency

Client Service Provider

slide-80
SLIDE 80

has to implement

Timeout, Retry, Compensation

has to offer

Compensation

has to implement

Idempotency

Client Service Provider

Don‘t forget about state

slide-81
SLIDE 81

Event-driven example also available

Inventory Payment Order Shipping Checkout Monitor

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

Human T asks

H2 H2

slide-82
SLIDE 82

Workflows live inside service boundaries

slide-83
SLIDE 83
slide-84
SLIDE 84

Sales-Order & Order-Fulfillment via Camunda for every order worldwide (Q2 2017: 22,2 Mio)

slide-85
SLIDE 85

# Be aware of complexity of distributed systems # Know strategies and tools to handle it

e.g. Circuit breaker (Hystrix) Workflow engine for stateful retry, waiting, timeout and compensation (Camunda)

slide-86
SLIDE 86

Thank you!

slide-87
SLIDE 87

mail@berndruecker.io @berndruecker https://berndruecker.io https://medium.com/berndruecker https://github.com/berndruecker

https://www.infoq.com/articles/events- workflow-automation

Contact: Slides: Blog: Code:

https://www.infoworld.com/article/3254777/ application-development/ 3-common-pitfalls-of-microservices- integrationand-how-to-avoid-them.html https://thenewstack.io/5-workflow-automation- use-cases-you-might-not-have-considered/