How to do Distributed Transactions the RIGHT way? Microservices

Поділитися
Вставка
  • Опубліковано 24 бер 2023
  • Learning system design is not a one time task. It requires regular effort and consistent curiosity to build large scale systems. Moreover, every system has different requirements and meeting them requires expertise and people with varied and specific knowledge. There are a lot of resources to learn through videos. But not everyone enjoys that mode of learning. Instead some people understand things better by reading and thinking on the points put forward by the author. Such people can access these in different ways - blogs, articles and books. We have come up with this video to put light on one such aspect, that is - how microservices communicate using events.
    ------------------------------------------------------------------
    Relevant Links discussed in the video:
    ------------------------------------------------------------------
    Book - www.thoughtworks.com/insights...
    ------------------------------------------------------------------
    Recommendations
    ------------------------------------------------------------------
    Our full courses on youtube:
    ✒ System Design Primer Course: • System Design Primer C...
    ✒ REST APIs made easy: • REST APIs MADE EASY
    Some paid courses that we recommend:
    ✒Educative.io: bit.ly/3qnW5ku
    ✒Interviewready.io: get.interviewready.io/ (Use coupon code SUDOCODE for extra discount)
    ------------------------------------------------------------------
    About Us
    ------------------------------------------------------------------
    Created and Instructed by:
    Yogita Sharma
    ✒ LinkedIn - / yogita-sharma-83400b55
    ✒ Instagram - / sudo.code1
    ✒ Facebook - / sudo.code
    ✒ Medium - / yogita088
    Post-production(editing, thumbnail etc) managed by:
    CiKi
    ✒ Website: www.ciki.co.in
    ✒ LinkedIn: / 74735937
    Colors and design by:
    Naini Todi
    ✒ LinkedIn - / nainitodi
    Both Arpit and Yogita are software engineers and want to help other software engineers become better by providing high quality and well researched content by adding their creativity and teaching twist.
    ------------------------------------------------------------------
    Join Us
    ------------------------------------------------------------------
    Hangout with sudoCode:
    ✒Discord Server: / discord
    For business:
    ✒Email: sudocode.yogita@gmail.com
    -----------------------------------------------------------------------------------------------------------------------------

КОМЕНТАРІ • 46

  • @premraj.m
    @premraj.m 7 днів тому

    excellent, this is the perfect way to teach, 13 went off very fast for me while watching this video

  • @xellos5262
    @xellos5262 3 місяці тому +3

    Concise, simple visuals, clean and non-monotone speech, in short fabulous. Thank you for the video, rare to get a good overview in such short time!

  • @evoxtorm
    @evoxtorm Рік тому +3

    We can also use Try-Confirm/Cancel approach also but we have to take care of out-of-order execution. But yes Saga are preferred due to their liner order of execution

  • @duffy9090
    @duffy9090 10 місяців тому

    Great video, thank you for putting these topics together

  • @sreejeshraj4800
    @sreejeshraj4800 Рік тому +2

    Thank you very much for your videos - excellent content, to the point. I have a request - can you please do a video comparing the similarities / differences between various styles of programming - messaging, event driven, asynchronous, reactive etc. I know that you have done vides on messaging, pub sub etc. - but a comparison video will make these concepts clear rather than doing separate videos for each topic.

  • @rakeshkhuntia2093
    @rakeshkhuntia2093 4 місяці тому

    Thank you so much, Its very simple and clear explanation.

  • @mhopado
    @mhopado Рік тому +3

    Thanks for explaining such complicated topics in simple way.
    In real world you, will find the hybrid approach, where a orchestrator service keep track of the state of the transaction while passing the events from one service to other.
    So in case of failure, the orchestrator will retry from the failure state of the transaction or revert back the previous operation.

    • @qichengri5517
      @qichengri5517 3 місяці тому

      COOL! Then your messaging/queuing system doesn't need to be as reliable.

  • @warriorfb2010
    @warriorfb2010 Місяць тому

    Excellent. I look forward to watching your other videos. Thank you!

  • @ashishjaiswal1090
    @ashishjaiswal1090 Рік тому +1

    Nice explanation through animated slides seems do a lot of work thanks for explaining in intersting way, is there any source/link using java it will be helpful.

  • @mohammedhuzaifa8654
    @mohammedhuzaifa8654 Рік тому +1

    thanks dd for putting it in a way that is easy to understand

  • @AK-vx4dy
    @AK-vx4dy Рік тому +2

    Very clear explanation of realy complicated things

  • @ammabalasimha
    @ammabalasimha 3 місяці тому +2

    Explanation is very clear. Thanks a lot

  • @Vaibhavatutube
    @Vaibhavatutube 2 місяці тому

    Brilliant explanation and presentation. Thanks!

  • @BitsAndBytes0101
    @BitsAndBytes0101 2 місяці тому

    You explained it very well. Thank a lot

  • @ravitejaakkala6114
    @ravitejaakkala6114 9 місяців тому

    well explained !!

  • @sachinshukla1095
    @sachinshukla1095 8 місяців тому

    Beautiful explanation....❤

  • @rajchaurasiya1265
    @rajchaurasiya1265 Рік тому +1

    Thank you mam for this valuable content 🙏

  • @phillipdino
    @phillipdino 2 місяці тому

    Such a grea video. Thank you for the explanation.

  • @blasttrash
    @blasttrash Рік тому +3

    nice video. but one question at 6:58, while doing backward recovery, what if one of the backward step also fails? 😅Then state of our system is stuck as we cant move forward nor can we move backward.

    • @ashishmaurya3669
      @ashishmaurya3669 Рік тому

      That's why it preferred async communication between microservice so request doesn't lose the track. Also if we go for sync we need to implement failover mechanism for eg retry the request to certain number.

  • @shashavalijava9
    @shashavalijava9 6 місяців тому

    I 💕💕💕 your explanation . thanks you

  • @soni.himansh
    @soni.himansh 8 місяців тому

    Great video

  • @nagareddy9744
    @nagareddy9744 6 місяців тому +1

    thank you

  • @Md_sadiq_Md
    @Md_sadiq_Md Рік тому +4

    Pushing the algorithm ❤️

  • @f135ta
    @f135ta 9 місяців тому +5

    Avoid distributed transactions at ALL costs in microservices - just use events and eventual consistency. This approach causes so many headaches I can't even list them all here

    •  24 дні тому

      What if I need strong consistency?

    • @jeevan19876
      @jeevan19876 15 днів тому

      Sagas are eventually consistent though they are distributed transactions. The events from one service to another are usually asynchronous.
      Two phase commit is used to achieve strong consistency snd should be avoided

    • @f135ta
      @f135ta 13 днів тому

      @@jeevan19876 - SAGA's are a serious complication that you need to be 100% sure you need before applying.. There are far simpler patterns that solve the problems just fine IMO

  • @AkshayMukadam
    @AkshayMukadam 3 місяці тому

    live demo would have been great i.e hands on would have been good

  • @kotojava
    @kotojava 6 місяців тому

    how to sort issues when some process just can't have compensations? eg we send money or we send email with some good eg ebook. So these actions can't be undone.

    • @jeevan19876
      @jeevan19876 15 днів тому

      There is a pivot point in transactions, if any failure occurs after pivot the services would retry the steps and run for completion
      Else if pivot is failed just rollback transactions before pivot

    • @kotojava
      @kotojava 15 днів тому

      @@jeevan19876 some actions might not be rollbacked.

  • @tendaikawadza4492
    @tendaikawadza4492 10 місяців тому

    how do i add user details to each service

    • @jeevan19876
      @jeevan19876 15 днів тому

      Your service would be communicating with user service to get details based on id
      Each kafka event would contain a userid

  • @bhaskarsadawarte7696
    @bhaskarsadawarte7696 8 місяців тому

    🙌

  • @jeevan19876
    @jeevan19876 15 днів тому

    I am in disagreement with that we need to avoid distributed transactions, distributed transactions are very common in microservices and sagas are used most of the time to ensure eventual consistency.

  • @chessmaster856
    @chessmaster856 9 місяців тому +1

    There are more and more failue points. You just keep doing lot more work keep lot of logs. Try again and just do too much work. It us easier to talk and go into architecture and blame developers failures in implementation.. there are too many failure scenarios possible.the best you can do is have robust hardware that wo t fail and kee forensic record or log of every step before doing and be able to go back and analyze retry. All this is easier in chat sites and more risky in financial world. You
    Tube can easily say that your count may nit be accurate on so and so date. That is fine. That is not possible in financial transavtions

    • @chessmaster856
      @chessmaster856 9 місяців тому +2

      Most architects have never implemented this in real life and would avoid going near development

    • @chessmaster856
      @chessmaster856 9 місяців тому

      But this video highlights most of issues in distributed transaction correctly

  • @s.sambit1676
    @s.sambit1676 Рік тому

    Mam, You start looking old😔 but ur explanation growing sharply.

    • @sudocode
      @sudocode  Рік тому +7

      Well dear ignorant youngster you should probably know that I am older than I look and younger than I feel. Sad that’s the most interesting thing you observed about me 😅

    • @theunusual4566
      @theunusual4566 5 місяців тому +4

      What a shit comment on the Excellent video.
      Mam you are amazing as always.

    • @warriorfb2010
      @warriorfb2010 Місяць тому

      And you're immature and likely not worthy of working within a professional business domain.

    • @CommonSense-person
      @CommonSense-person Місяць тому

      ​@@sudocode kya thoka usko wah