The Saga Pattern in Microservices (EDA - part 2)

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 96

  • @ADevStory
    @ADevStory  5 หลายเดือนก่อน +21

    Hey folks!👋 Want to have hands-on practice on these concepts? 🤓
    Try out CodeCrafters.io we have partnered and you can get 40% off 💸with this link: app.codecrafters.io/join?via=DevStory
    They have great hands-on tutorials and easy to get up to speed with complex systems. Check them out!

    • @ammadkhan2352
      @ammadkhan2352 หลายเดือนก่อน +1

      in saga pattern is it possible to have optimistic or pascimistic locking while having different databases?

    • @ADevStory
      @ADevStory  หลายเดือนก่อน +1

      @@ammadkhan2352 you can, but it's harder. Typically instead of locking Saga Pattern (and Event Driven Architecture) looks more towards doing compensating actions in case of problems instead of locking before hand. So if you follow the Orchestrator pattern, the transaction isn't "commited" until all the services the orchestrator calls have confirmed it. In the Choreography pattern there's less control, so if you are more concerned into strong consistency it might be harder to achieve.
      I recently created a video on Leader Election, it shows how transactions work in a similar way to the Orchestrator Pattern: th-cam.com/video/7qRVMKXo4M4/w-d-xo.htmlsi=HdCwPNYeEKkcaMUl
      Hope it's helpful, let me know if you still have doubts.

  • @gabrieldalbo5378
    @gabrieldalbo5378 3 ปีที่แล้ว +29

    You know, I’m a Brazilian interpreter, and I work translating software developers’ meetings.
    Your videos are helping me understand the architecture concepts better and a little bit more on how developers’ minds work.
    Thank you!

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว +2

      That's awesome ! Glad I could help!By any chance are you interested in contributing the Brazilian translation of some videos?

    • @gabrieldalbo5378
      @gabrieldalbo5378 3 ปีที่แล้ว +1

      @@ADevStory Hey, yes.
      Is there any kind of DM here where I can send contact info?

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว

      Sure. You can DM me in Twitter: @cv13lm4

  • @shrikanthk5445
    @shrikanthk5445 3 ปีที่แล้ว +13

    Such a simple and straightforward explanation. Clear picture of Saga pattern. THANKS a LOT ...

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว +1

      Glad you found it useful! 😁

  • @heenachhabra2977
    @heenachhabra2977 ปีที่แล้ว +8

    I was looking for how to transition from a developer to an architect mindset when I stumbled upon your video series. The series is really useful for me to understand how to think like an architect. It is the simplicity and conciseness of your videos that really make them stand out. Thank you for making such great videos

    • @ADevStory
      @ADevStory  ปีที่แล้ว +1

      Oh thanks for the kind words. Glad you found it useful!

    • @tasneemwahdan3618
      @tasneemwahdan3618 10 หลายเดือนก่อน

      I am a developer and so interested in architecture and system design. Can you provide more resources to learn and apply these skills?

  • @mostinho7
    @mostinho7 10 หลายเดือนก่อน +10

    5:45 orchestration vs coreography. In orchestration, there is a central orchestrator that calls the other services, but in choreography the services listen and react to events

  • @1986chandru
    @1986chandru 3 ปีที่แล้ว +7

    Excellent series on the EDA. Thanks a lot for these videos. Wonderful explanations.

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว +1

      Awesome! Wait for the third one in the series. There has been delays but should be out this week or next :)

  • @allenprinceton5125
    @allenprinceton5125 ปีที่แล้ว +1

    little fan from Taiwan, thanks for the excellent tutorial

    • @ADevStory
      @ADevStory  ปีที่แล้ว

      Thank you for your words! Feel free to let me know any content you'd like to see.

    • @anindyapaul9735
      @anindyapaul9735 12 วันที่ผ่านมา

      Hi open to collaborate for project??

  • @ToeShimmel
    @ToeShimmel ปีที่แล้ว +1

    This deserves more views. Your video's are fantastic!

    • @ADevStory
      @ADevStory  ปีที่แล้ว +1

      Thank you! Glad you enjoyed it! Feel free to share it everywhere so more people watch it! 😜

  • @reallylordofnothing
    @reallylordofnothing 7 หลายเดือนก่อน +1

    cant believe you helped me revise this in 2 mins. thanks

    • @ADevStory
      @ADevStory  7 หลายเดือนก่อน

      Glad I could help!

  • @hecksonchamutanga1990
    @hecksonchamutanga1990 3 หลายเดือนก่อน

    Your tutorials are simple to understand as a software developer

    • @ADevStory
      @ADevStory  3 หลายเดือนก่อน

      Thank you very much! Glad you enjoyed them!

  • @flavienrobert2516
    @flavienrobert2516 ปีที่แล้ว +1

    Cristal clear :) Thank you so much, you are a great teacher.

    • @ADevStory
      @ADevStory  ปีที่แล้ว

      Thank you! Glad you liked it!

  • @ricardo.93
    @ricardo.93 3 ปีที่แล้ว +5

    Great explanation my friend 👌, I have a better understanding of the SAGA pattern
    Greetings from Guatemala

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว +1

      Awesome! Glad it helped! :)

  • @shubhamjoshi4803
    @shubhamjoshi4803 6 หลายเดือนก่อน +4

    Is this Steve Jobs teaching Event Driven Architecture? Was very smooth and convincing 😄.

    • @ADevStory
      @ADevStory  6 หลายเดือนก่อน

      Hahaha thanks. A few _billions_ less rich 😜

  • @NomeshDeSilva
    @NomeshDeSilva 3 ปีที่แล้ว +3

    Your way of explanation is awsome . Really helpful 👌🙏

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว

      Thanks! 😁

  • @nooni8624
    @nooni8624 ปีที่แล้ว +1

    Great video! Helped me understand this much better

    • @ADevStory
      @ADevStory  ปีที่แล้ว

      Glad it helped!

  • @sadeghrahmani2339
    @sadeghrahmani2339 2 ปีที่แล้ว +1

    Simple, to the point, and perfect!

  • @anvvsharma873
    @anvvsharma873 3 ปีที่แล้ว +6

    great video, good one. all your videos are short, crisp, to-the-point + explaining everything with drawings based on a scenarios

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว

      Glad You liked them! Cheers 😁

  • @amazingartsongs5298
    @amazingartsongs5298 2 ปีที่แล้ว +2

    Thank you mate for this great explanation

    • @ADevStory
      @ADevStory  2 ปีที่แล้ว

      Glad it was useful!

  • @soufianer3562
    @soufianer3562 2 ปีที่แล้ว +1

    Simple and straightforward . thx!

  • @oscarjoselopezdiaz89
    @oscarjoselopezdiaz89 3 หลายเดือนก่อน +2

    Thanks you very much!

    • @ADevStory
      @ADevStory  2 หลายเดือนก่อน +1

      Thank you! Glad it was useful!

  • @ralfrolfen5504
    @ralfrolfen5504 10 หลายเดือนก่อน +1

    Very well explained saga pattern! Thank you! #Thankyou

    • @ADevStory
      @ADevStory  10 หลายเดือนก่อน

      Glad you liked it!

  • @vb9950
    @vb9950 2 ปีที่แล้ว +1

    This is more for Software, and even in Embedded systems EDA (publish-subscribe) model is used. microservices may be more related to software applications but I got some idea on how to work with it.

    • @ADevStory
      @ADevStory  2 ปีที่แล้ว

      Yeah event driven architecture also applies to non-distributed systems. Some patterns like the saga one can be simplified though if is not a distributed system

  • @danielbracamontes1811
    @danielbracamontes1811 ปีที่แล้ว +1

    I liked the video. Just got subscribed to your channel!!

    • @ADevStory
      @ADevStory  ปีที่แล้ว

      Thank you! Glad you liked it!

  • @liamgryphon7942
    @liamgryphon7942 3 ปีที่แล้ว +4

    Hey mate, just wanted to say you're awesome! I really love this explaination of EDA. However, have to say the choreography pattern seems so fragile 😱, oh geez. I don't want to ever encounter it.

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว

      Hey thanks! Choreography can be useful if there isn't tight coupling between the services, but for transactions, all but the simplest cases are useful to tackle with it. So basically, keep following your intuition 😉

    • @gdlmss
      @gdlmss 2 ปีที่แล้ว

      Choreography reminds me a bit how Redux + some middleware like Saga works. Sending actions and hoping some side effect or reducers will listen to it.

  • @alexandrutoma9187
    @alexandrutoma9187 3 ปีที่แล้ว +2

    Awesome videos, great content!

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว

      Thank you! If you haven't feel free to subscribe. Soon I'll be releasing the last video on this series

  • @rajatthakur9055
    @rajatthakur9055 2 ปีที่แล้ว +1

    Just so I am not confused, these SAGA pattern are almost similar to Mediator and Broker Topology in Event Driven Architecture. Or is there a difference? I am confused because here we are taking it up with microservices example.

    • @ADevStory
      @ADevStory  2 ปีที่แล้ว +3

      Really good question! You made me actually investigate a bit since I also got confused.
      I got torn too here. Best reference I've found is Mark Richards & Neal Ford's Fundamentals of Software Architecture: And Engineering Approach where the authors say that it's basically the same:
      "Choreography utilizes the same communication style as a broker event-driven archi‐
      tecture. In other words, no central coordinator exists in this architecture, respecting
      the bounded context philosophy. Thus, architects find it natural to implement decou‐
      pled events between services."
      And then for Orchestration explains:
      "Because microservices architectures don’t include a global mediator like other
      service-oriented architectures, if an architect needs to coordinate across several serv‐
      ices, they can create their own localized mediator[...]"
      What I gather from the book is that it either is the same pattern in two different architectural styles (EDA and Microservices), which would be cumbersome, or the one I think makes the most sense: Saga pattern can be implemented using EDA's Mediator/Broker topologies, but also can be implemented differently (Orchestration, for example can implement the Saga pattern without using Mediator topology or EDA at all)
      Hope is clearer, and I'm open for a debate :)

    • @rajatthakur9055
      @rajatthakur9055 2 ปีที่แล้ว +1

      @@ADevStory Thank you for your reply. This makes more sense. Actually, I was reading the book suggested by you - Software Architecture Patterns. After completing the chapter on that I moved to this video of yours on EDA to understand more examples :-). Right now there are no more questions, and I'll continue with reading. But if I have any more will definitely reach out to you.
      The content you post is really great. Keep creating!! :-)

    • @ADevStory
      @ADevStory  2 ปีที่แล้ว +1

      Glad it helped and that you are enjoying the content! Will try to publish more soon! And feel free to keep shooting questions!

  • @Kingkiyan24
    @Kingkiyan24 3 ปีที่แล้ว +2

    Awesome content.. great knowledge share

  • @NomeshDeSilva
    @NomeshDeSilva 3 ปีที่แล้ว +7

    Please do a video about software desiging concepts from basics to advance architecture. Thanks alot ❤️

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว +2

      Sure I can try. What are you looking for? So far I have some about design patterns, OO, and introduction to software architecture. What are you looking for?

    • @NomeshDeSilva
      @NomeshDeSilva 3 ปีที่แล้ว

      @@ADevStory I would like to learn how to design scalable, performance optimized, low latency systems. from Basic to complex systems by adding advanced concepts would be much appreciated.ex: fault tolerant, resilient, sharding, etc

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว

      Have you checked my software architecture introduction series? I cover those topics there albeit very quick and superficial

  • @juhairahamed5342
    @juhairahamed5342 2 ปีที่แล้ว +1

    Good explanation

    • @ADevStory
      @ADevStory  2 ปีที่แล้ว

      Thanks! Glad you found it useful!

  • @chitranshtarsoliya7378
    @chitranshtarsoliya7378 ปีที่แล้ว +1

    Hey buddy can you make a video about failure
    If an event is generated and the services that are listening to that event are crashed
    The potential reason can be:
    - A wrong event or missing data in event
    - service is using other application like (api, db, or 3rd party application) and that application is down temporarily
    - new version of that service is not Competable
    The handling can be
    - reach out to other service to fix that
    - retry
    - retry with delays
    - wait till someone start process manually
    - rollback build
    - ignore that request and process other

    • @chitranshtarsoliya7378
      @chitranshtarsoliya7378 ปีที่แล้ว

      I wanna know if there is any pattern for handling these kina situations or how on which metrics we should put conditions to take any actions

    • @ADevStory
      @ADevStory  ปีที่แล้ว +1

      Great suggestion! I'm thinking on s new series on of videos on distributed systems and can talk about failure handling.

  • @bradydyson65
    @bradydyson65 2 ปีที่แล้ว

    I loved the diagramming; that was very helpful for differentiating coreography and orchestration. However, I still don't know how this relates to sagas. Where were the sagas in the diagrams? How many sagas were there? I still don't know what a saga is and I'm trying to figure that out.
    I think I understand what the "saga pattern" is, but I have no idea what a "saga" is.

    • @ADevStory
      @ADevStory  2 ปีที่แล้ว

      I think Saga is also a confusing name but I didn't invent the pattern :P So basically you can translate: Saga = a distributed transaction between microservices. So here's an overview diagram in minute 2:32 (th-cam.com/video/C0rGwyJkDTU/w-d-xo.html). The Choreography or Orchestration are just ways to implement these transactions.
      Hope it's clearer!

  • @TheSemenFarada
    @TheSemenFarada 5 หลายเดือนก่อน

    Why the Order service does not need to know about the "Order Purchased" event from the payment service? How then the order service will know that order is sucessfull?

    • @ADevStory
      @ADevStory  5 หลายเดือนก่อน

      It depends on the modeling but the message in the video is that unless you need to rollback some information, you can assume it went ok and the event propagation will take care of it.

  • @abhilashpatel6852
    @abhilashpatel6852 ปีที่แล้ว

    So, with event driven architecture, in async communication can we use orchestration or not? or it is only for synchronous communication?

    • @ADevStory
      @ADevStory  ปีที่แล้ว

      It would be better with orchestration to use synchronous communication. But async can also be used. Keep in mind that if async you still need to have some type of request-reply mechanism in this case.

  • @sayitlikeitis1202
    @sayitlikeitis1202 ปีที่แล้ว +1

    You should be publishing more videos. The way you articulate things is simple and yet Brilliant ! I need to thank you for turning difficult concepts into easy ones to understand and learn

    • @ADevStory
      @ADevStory  ปีที่แล้ว

      Thank you very much! I will publish some soon! Feel free to suggest any topic :)

  • @goodwish1543
    @goodwish1543 3 ปีที่แล้ว +1

    Thanks for sharing. What is Saga stands for ?

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว +1

      Anytime. Well saga is the name of the pattern, is not an acronym. Here's a full response to that: stackoverflow.com/a/63319683/1238957

  • @minhluanvu7918
    @minhluanvu7918 ปีที่แล้ว +1

    Thank you !

    • @ADevStory
      @ADevStory  ปีที่แล้ว

      You're welcome!

  • @ingenieriamiguens2568
    @ingenieriamiguens2568 3 ปีที่แล้ว +1

    Thanks a lot. I'm pretty sure that you understand Spanish or maybe Italian hahahaha maybe something In your accent told me that, I'm right?. Anyway, sos un genio!

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว +1

      Jajaja tengo que mejorar el acento 😂 ¡Gracias!

    • @ingenieriamiguens2568
      @ingenieriamiguens2568 3 ปีที่แล้ว

      @@ADevStory lo importante es la pronunciación y está perfecta!
      Question: did you use the AWS solutions to implement this pattern? (Event bridge + step functions)
      Do you recommend some open source solutions?

    • @ADevStory
      @ADevStory  3 ปีที่แล้ว

      I try not to focus on specific implementations, as understanding the pattern gives me more insights into different tech. Having said that, ine specific piece of tech I've analyzed (but haven't used) regarding microservices orchestration is Netflix Conductor (netflix.github.io/conductor/) . It's also fun to see they (rightfully) picked orchestration over choreography because of the shortcomings of choreography.

  • @matswessling6600
    @matswessling6600 5 หลายเดือนก่อน

    move to a room with lesser echo...

    • @ADevStory
      @ADevStory  5 หลายเดือนก่อน

      Yeah. Technically is reverb (I've been learning since this video 😅) hope you still were able to enjoy the content. The newer videos have better sound

    • @matswessling6600
      @matswessling6600 5 หลายเดือนก่อน

      @@ADevStory reverb is just a lot of echoes... but that is great news.

  • @mysocial
    @mysocial 2 ปีที่แล้ว

    Great stuff but the accent caused replay :D

    • @ADevStory
      @ADevStory  2 ปีที่แล้ว

      Thanks! Trying to improve. There's also a curated CC to help with that

  • @maninblack6
    @maninblack6 2 ปีที่แล้ว

    microservices - most stupid thing I ever heard

  • @bastooopanooo2311
    @bastooopanooo2311 ปีที่แล้ว +7

    That's why I hate microservices.

    • @syd4747
      @syd4747 7 หลายเดือนก่อน +1

      nah its the best thing

  • @UditKumar-d3s
    @UditKumar-d3s 29 วันที่ผ่านมา

    @uditkumar-3ds