3 Common Pitfalls in Microservice Integration (Bonus : And how to - - PowerPoint PPT Presentation

3 common pitfalls in microservice integration
SMART_READER_LITE
LIVE PREVIEW

3 Common Pitfalls in Microservice Integration (Bonus : And how to - - PowerPoint PPT Presentation

3 Common Pitfalls in Microservice Integration (Bonus : And how to avoid them J ) credit to Bernd Ruecker Patricio Zambrano Technical Consultant, Camunda Inc. 2 Microservices Agenda Introduction 3 Common Challenges and How to Avoid Them


slide-1
SLIDE 1

3 Common Pitfalls in Microservice Integration (Bonus : And how to avoid them J) credit to Bernd Ruecker

Patricio Zambrano Technical Consultant, Camunda Inc.

slide-2
SLIDE 2

2

Microservices Agenda

  • Introduction
  • 3 Common Challenges and How to Avoid Them
  • Conclusion
slide-3
SLIDE 3

Raise your hand

  • REST
  • Microservices
  • Java
slide-4
SLIDE 4

Distributed systems

slide-5
SLIDE 5

Distributed systems

Challenges of asynchronicity Distributed Transactions Communication is complex

slide-6
SLIDE 6

7

Some Microservices….

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-7
SLIDE 7

Let‘s start with a simple example

Credit Card Payment

REST Payment Requestor Application What happens if the Credit Card Service is Super Slow?

slide-8
SLIDE 8

Live hacking

https://github.com/flowing/flowing-retail/blob/master/payment- rest/src/main/java/io/flowing/retail/payment/port/resthacks/PaymentRestHacksControllerV2.java

slide-9
SLIDE 9

Circuit Breaker

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

slide-10
SLIDE 10

Failing Fast is important….

..but not enough

slide-11
SLIDE 11

Photo by https://www.archdaily.com/560641/liverpool-insurgentes-department-store-rojkind-arquitectos

slide-12
SLIDE 12
slide-13
SLIDE 13

Check-in Web-UI

You

Current situation

slide-14
SLIDE 14

Check-in

Barcode Generator

Web-UI

You

Output Mgmt

Current situation

slide-15
SLIDE 15

Current situation

Check-in

Barcode Generator

Web-UI

You

Output Mgmt

Circuit breaker

slide-16
SLIDE 16

Another screenshot

slide-17
SLIDE 17

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Current situation – the bad part

slide-18
SLIDE 18

Current situation – the bad part

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

slide-19
SLIDE 19

Current situation – the bad part

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Stateful Retry

slide-20
SLIDE 20

Another Example

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.

Just made this up

slide-21
SLIDE 21

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Possible Solution – Much better?

Stateful Retry

The failure never leaves this scope!

slide-22
SLIDE 22

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

Scheduling, Versioning,

  • perating, visibility,

scalability, …

Handling State Typical concerns

slide-23
SLIDE 23

Current Players in the State Machine Market

  • AWS Step Function
  • UBER Cadence
  • Netflix Conductor
  • Camunda J
  • Zeebe J
  • jBPM
  • Activiti
slide-24
SLIDE 24

Performance: Zeebe vs. Kafka

Vs.

Apache Kafka

slide-25
SLIDE 25

Current Players in the State Machine Market

  • AWS Step Function
  • UBER Cadence
  • Netflix Conductor
  • Camunda J (Raise of hand?)
  • Zeebe J
  • jBPM
  • Activiti
slide-26
SLIDE 26

In the previous demo….

Credit Card Payment

REST Payment Requestor Application What if I want my Payment to be Asynchronous and

Retry itself when my Credit Card Service Slow?

slide-27
SLIDE 27

Live hacking

https://github.com/flowing/flowing-retail/blob/master/payment- rest/src/main/java/io/flowing/retail/payment/port/resthacks/PaymentRestHacksControllerV3.java

slide-28
SLIDE 28

Demo

Credit Card Payment

REST Payment Requestor Application What if I want a Synchronous response when everything is fast?

slide-29
SLIDE 29

Live hacking

https://github.com/flowing/flowing-retail/blob/master/payment- rest/src/main/java/io/flowing/retail/payment/port/resthacks/PaymentRestHacksControllerV3.java

slide-30
SLIDE 30

Payment

Now you have a state machine!

Credit Card

REST

slide-31
SLIDE 31

has to implement

Retry

has to implement

Idempotency

Client Service Provider

Most important factors to consider in distributed systems (so far.. )

slide-32
SLIDE 32

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

It is a business problem anyway! Bad Example..

slide-33
SLIDE 33

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!

Better…

slide-34
SLIDE 34

It is impossible to differentiate certain failure scenarios(and Code Exceptions).

Independant of communication style!

Service Provider Client

slide-35
SLIDE 35

Distributed systems introduce complexity you have to tackle!

Credit Card Payment

REST

slide-36
SLIDE 36

Distributed systems introduce complexity you have to tackle!

Credit Card Payment

REST

Do it reliably

slide-37
SLIDE 37

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Workflows live within service boundaries

slide-38
SLIDE 38

Different Architecture Options

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

slide-39
SLIDE 39

Different architecture options

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

slide-40
SLIDE 40

Different architecture options

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

slide-41
SLIDE 41

Different architecture options

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

slide-42
SLIDE 42

generateBoardingPass HTTP 200 OK HTTP 202 ACCEPTED

Check-in

A synchronous response is possible in the happy case, otherwise it is switched to asynchronous processing. First Sync then Async

slide-43
SLIDE 43

The customer wants a synchronous response…

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

!Eh – no!

slide-44
SLIDE 44

Synchronous communication is the crystal meth of distributed programming

Todd Montgomery and Martin Thompson in “How did we end up here” at GOTO Chicago 2015

slide-45
SLIDE 45

Challenges of asynchronicity

slide-46
SLIDE 46

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Asynchronous communication

You need to monitor timeouts

slide-47
SLIDE 47

Check-in

Barcode Generator

Web-UI

Me

Output Mgmt

Remember… The failure never leaves this scope!

slide-48
SLIDE 48

Workflow…

Easy to handle time

slide-49
SLIDE 49

Workflow…

slide-50
SLIDE 50

has to implement

Timeout, Retry

has to implement

Idempotency

Client Service Provider

slide-51
SLIDE 51

Who uses a message bus?

slide-52
SLIDE 52

Who has no problems

  • perating a message bus?

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

slide-53
SLIDE 53

Other Architecture options

A parte de imagem com identificação de relação rId5 não foi encontrada no arquivo.

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

slide-54
SLIDE 54

Other Architecture options

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

A parte de imagem com identificação de relação rId4 não foi encontrada no arquivo.
slide-55
SLIDE 55

Other Architecture Options

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

A parte de imagem com identificação de relação rId4 não foi encontrada no arquivo.
slide-56
SLIDE 56

Distributed Transactions Distributed Transactions

slide-57
SLIDE 57

Distributed systems

2007

  • ACID Transactions
  • Scalability
  • Troubleshooting TM
  • Still Required!!
slide-58
SLIDE 58

Distributed transactions using compensation *

Compensation

*aka Saga pattern

slide-59
SLIDE 59

Eventual consistency

Temporarily inconsistent state But only temporarily!

slide-60
SLIDE 60

Demo Time

Payment Requestor Application Node.js App

slide-61
SLIDE 61

Live hacking

https://github.com/flowing/flowing-retail/blob/master/payment- rest/src/main/java/io/flowing/retail/payment/port/resthacks/PaymentRestHacksControllerV6.java

slide-62
SLIDE 62

has to implement

Timeout, Retry, Compensation

has to offer

Compensation

has to implement

Idempotency

Client Service Provider

slide-63
SLIDE 63

has to implement

Timeout, Retry, Compensation

has to offer

Compensation

has to implement

Idempotency

Client Service Provider

Don‘t forget about state

slide-64
SLIDE 64

Before mapping processes explicitly with BPMN and DMN, the truth was buried in the code and nobody knew what was going on.

Jimmy Floyd, 24 Hour Fitnesse

slide-65
SLIDE 65

Event-driven example also available Inventory Payment Order Shipping Checkout Monitor

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

Kafka Human Tasks

H2 H2

https://github.com/flowing/flowing- retail/tree/master/zeebe

slide-66
SLIDE 66

Workflows live inside service boundaries

Kafka or Zeebe

slide-67
SLIDE 67

Reality check

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

slide-68
SLIDE 68

Camunda Value Technical Use Cases Business Process Examples Improving development,

  • perations and visibility
  • f automated

workflows and decisions. Straight-Through Processing Microservice Orchestration Human Workflow Management Business Rule Automation E-Commerce: Order Execution Finance: Stock Trading Insurance: Claim Settlement Telco: OSS/BSS ……..

Some of the Workflow Engine Use Cases and… what we talked about

72

slide-69
SLIDE 69

# 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-70
SLIDE 70

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

slide-71
SLIDE 71

Where to learn more

#6

slide-72
SLIDE 72

Contact Us

  • Andreas Stange | International Sales
  • +49-172-862-2730 | Berlin
  • Mauricio Bitencourt | Customer Delivery & Success
  • +55 51 984.087.798 | São Paulo
slide-73
SLIDE 73

Q&A

?

slide-74
SLIDE 74

Camunda Ecosystem

Model > Execute > Improve

slide-75
SLIDE 75

What is ZEEBE?

  • Zeebe scales orchestration of workers and microservices using visual workflows. Zeebe is

horizontally scalable and fault tolerant so that you can reliably process all your transactions as they happen.