3 common pitfalls in microservice integration
play

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


  1. 3 Common Pitfalls in Microservice Integration (Bonus : And how to avoid them J ) credit to Bernd Ruecker Patricio Zambrano Technical Consultant, Camunda Inc.

  2. 2 Microservices Agenda Introduction • 3 Common Challenges and How to Avoid Them • Conclusion •

  3. Raise your hand • REST • Microservices • Java

  4. Distributed systems

  5. Distributed systems Communication Challenges of Distributed is complex asynchronicity Transactions

  6. 7 Some Microservices…. Some Service Some Some Service Service Some Service But keep it Some Service Failure will local! Be happen. resilient. Some Accept it! Some Service Service

  7. Let‘s start with a simple example Credit Payment Card REST What happens if the Credit Card Service is Super Slow? Payment Requestor Application

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

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

  10. Failing Fast is important…. ..but not enough

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

  12. Current situation Web-UI You Check-in

  13. Current situation Web-UI You Check-in Barcode Output Generator Mgmt

  14. Current situation Circuit breaker Web-UI You Check-in Barcode Output Generator Mgmt

  15. Another screenshot

  16. Current situation – the bad part Web-UI Me Check-in Barcode Output Generator Mgmt

  17. Current situation – the bad part Web-UI Me Check-in Barcode Output Generator Mgmt

  18. Current situation – the bad part Web-UI Me Check-in Barcode Output Generator Stateful Mgmt Retry

  19. Another Example Just made this up 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 on time.

  20. Possible Solution – Much better? The failure Web-UI never leaves Stateful this scope! Retry Me Check-in Barcode Output Generator Mgmt

  21. Handling State State Persist thing machine or (Entity, Document, workflow Actor, …) engine DIY = effort, Complex, Typical Typical accidental proprietary, concerns concerns complexity heavyweight, slow, don‘t scale, Scheduling, Versioning, developer adverse operating, visibility, scalability, …

  22. Current Players in the State Machine Market • AWS Step Function • UBER Cadence • Netflix Conductor • Camunda J • Zeebe J • jBPM • Activiti

  23. Performance: Zeebe vs. Kafka Apache Kafka Vs.

  24. Current Players in the State Machine Market • AWS Step Function • UBER Cadence • Netflix Conductor • Camunda J (Raise of hand?) • Zeebe J • jBPM • Activiti

  25. In the previous demo…. Credit Payment Card REST What if I want my Payment to be Asynchronous and Retry itself when my Credit Card Service Slow? Payment Requestor Application

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

  27. Demo Credit Payment Card REST What if I want a Synchronous response when everything is fast? Payment Requestor Application

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

  29. Now you have a state machine! Credit Payment Card REST

  30. Most important factors to consider in distributed systems (so far.. ) Client Service Provider has to implement has to implement Retry Idempotency

  31. Bad Example.. It is a business We are processing your payment. Do not leave this page. problem anyway! And for god sake – do not reload!

  32. Better … We are currently processing your request. Don‘t worry, it will It is a business We are processing your payment. happen safely – Do not leave this page. problem even if you loose connection. anyway! And for god sake – do not reload! Feel free to reload this page any time!

  33. It is impossible to differentiate certain failure Client Service Provider scenarios(and Code Exceptions). Independant of communication style!

  34. Distributed systems introduce complexity you have to tackle! Credit Payment Card REST

  35. Distributed systems introduce complexity you have to tackle! Credit Payment Card REST Do it reliably

  36. Workflows live within service boundaries Web-UI Me Check-in Barcode Output Generator Mgmt

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

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

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

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

  41. First Sync then Async Check-in generateBoardingPass HTTP 200 OK HTTP 202 ACCEPTED A synchronous response is possible in the happy case, otherwise it is switched to asynchronous processing.

  42. The customer wants a synchronous response… Web-UI Me Check-in !Eh – no! Barcode Output Generator Mgmt

  43. 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

  44. Challenges of asynchronicity

  45. Asynchronous communication You need to Web-UI monitor timeouts Me Check-in Barcode Output Generator Mgmt

  46. Remember… Web-UI The Me failure Check-in never leaves this Barcode Output scope! Generator Mgmt

  47. Workflow… Easy to handle time

  48. Workflow…

  49. Client Service Provider has to implement has to implement Timeout, Retry Idempotency

  50. Who uses a message bus?

  51. Who has no problems operating a message bus? Dead messages | No context | Inaccesible payload | Hard to redeliver | Home-grown message hospitals | …

  52. 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

  53. Other Architecture options A parte de imagem com identificação de relação rId4 não foi encontrada no arquivo. https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

  54. Other Architecture Options A parte de imagem com identificação de relação rId4 não foi encontrada no arquivo. https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

  55. Distributed Distributed Transactions Transactions

  56. ACID Transactions • Scalability • Distributed Troubleshooting TM • Still Required!! • systems 2007

  57. Distributed transactions using compensation * *aka Saga pattern Compensation

  58. Eventual consistency Temporarily inconsistent state But only temporarily!

  59. Demo Time Node.js App Payment Requestor Application

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

  61. Client Service Provider has to implement has to offer Timeout, Retry, Compensation Compensation has to implement Idempotency

  62. Client Service Don‘t Provider forget about has to implement has to offer state Timeout, Retry, Compensation Compensation has to implement Idempotency

  63. 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

  64. https://github.com/flowing/flowing- retail/tree/master/zeebe Event-driven example also available Payment Checkout Order Inventory Shipping Monitor Human Tasks H2 H2 Kafka https://github.com/flowing/flowing-retail/

  65. Workflows live inside service boundaries Kafka or Zeebe

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

  67. 72 Some of the Workflow Engine Use Cases and… what we talked about Camunda Value Technical Use Cases Business Process Examples Improving Straight-Through E-Commerce: Order development, Processing Execution operations and visibility Microservice Finance: Stock Trading of automated Orchestration Insurance: Claim workflows and Human Workflow Settlement decisions. Management Telco: OSS/BSS Business Rule Automation ……..

  68. # 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)

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

  70. Where to learn more #6

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend