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 ) credit to Bernd Ruecker Patricio Zambrano Technical Consultant, Camunda Inc. 2 Microservices Agenda Introduction 3 Common Challenges and How to Avoid


  1. 3 Common Pitfalls in Microservice Integration (Bonus : And how to avoid them  ) 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 is Challenges of Distributed complex asynchronicity Transactions

  6. 7 Some Microservices…. Some Service Some Some Service Service Some Service But keep it local! Some Service Failure will Be resilient. happen. 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 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 this scope! Stateful Me Retry Check-in Barcode Output Generator Mgmt

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

  22. Current Players in the State Machine Market • AWS Step Function • UBER Cadence • Netflix Conductor • Camunda  • Zeebe  • 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  (Raise of hand?) • Zeebe  • 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. problem anyway! Do not leave this page. And for god sake – do not reload!

  32. Better … We are currently processing your request. Don‘t worry, it will happen We are processing your payment. safely – It is a business Do not leave this page. even if you loose connection. problem 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 Web-UI You need to monitor timeouts Me Check-in Barcode Output Generator Mgmt

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

  47. Workflow…

  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 https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91

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

  54. Other Architecture Options 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

  57. Distributed transactions using compensation * 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 has to implement Compensation Idempotency

  62. Client Service Don‘t forget Provider about state has to implement has to offer Timeout, Retry, Compensation has to implement Compensation 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. 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 development, Straight-Through E-Commerce: Order operations and visibility Processing Execution of automated workflows Microservice Orchestration Finance: Stock Trading and decisions. Human Workflow Insurance: Claim Management Settlement Business Rule Automation Telco: OSS/BSS ……..

  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

  71. Contact Us • Andreas Stange | International Sales • +49-172-862-2730 | Berlin • Mauricio Bitencourt | Customer Delivery & Success • +55 51 984.087.798 | Sao Paulo

  72. ? Q&A

  73. Camunda Ecosystem Model > Execute > Improve

Recommend


More recommend