Distributed Transactions are Hard (How Two-Phase Commit works)

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

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

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

    Head to database.husseinnasser.com for a discount coupon to my Introduction to Database Engineering course. Link redirects to udemy with coupon applied.

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

    Please talk about Saga Design Pattern in the BE Show.

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

      What is BE show

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

      @@arenazo the better question - what is sega design pattern

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

      @@filcondrat it's about coordination of microservices

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

      @@JohnZakaria I was somewhat ironic

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

      I heard MAGA.

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

    As a student, for my project, I had to deploy my application on multiple servers for scaling (horizontal scaling). Since I was using docker and docker swarm to help in containers and orchestrestration, came the time to think 🤔 on how to handle the database.
    Question was : How do I horizontally scale the database while keeping its state across these servers?
    Ans : Distributed Transactions.
    After going deep in it and understanding the level of complexity behind scaling a database horizontally, my prof advised me to just use a single database, cuz this problem is still, as of date not yet completely solved.
    Distributed Databases is still an active area of research and development. He/She who solves the problem is set to impact the industry massively.
    Just food for thought and Thanks for the video. :)

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

      It depends on your system, I don't believe absolute consistency exist in distributed databases. But eventual consistency is pretty much solved and used in any large scale system.

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

      horizontal scaling of databases means? creating a new database when the existing database is full?

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

    Great Video!
    Can you please discuss about Saga Implementation details.

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

    We try to solve one issue and get a new one. 😅
    Great video though even though I am not a dev.

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

    Thanks for informative video . Would love to hear from you about 3 -Phase and SAGA .

    • @Gerald-iz7mv
      @Gerald-iz7mv 9 หลายเดือนก่อน +1

      2 phase, 3 phase and saga differences would be great. how does it change consistency etc.

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

    Very good video, very well explained, Thnx !

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

    We can maintain two leaders, both of them accessing some database like etcd which is an inmemory distributed key value store. So if one goes down, the other is there. Or we can just keep one and spin up another when one goes down.

  • @pollathajeeva23
    @pollathajeeva23 9 หลายเดือนก่อน

    Upon revisiting the video a year later, I discovered that Raft implements a 2-phase commit protocol. If the leader fails, a random leader election occurs with the highest term index.

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

    Very well explained!

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

    We mostly use Paxos or Raft in distributed databases these days.

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

    We could've done other way right ? Like as soon as co ordinator realized that he didn't got response from one DB , It will ask other DB's to rollback that commit and don't accept Tx's anymore until that offline node comes back online and then all of them will commit tx. But ofcourse , As CAP theorem says we are trading consistensy for availability then.

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

    Maybe you could tackle transactional outbox next? I think you could apply the same even though it's meant for databae+messaging.

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

    We used two phased commits

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

    Go Saga next

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

    who wants book shelf tour

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

    Hussein you're a GOD, you literally published this video 2h before my exam and now I've understood that! Thank you very much! Hope to see more videos about DB stuff 😉

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

    I have a small doubt regarding the Three-Phase Commit (3PC) protocol: If the coordinator fails after sending the 'CanCommit' requests in 3PC, how is this scenario effectively managed differently from the Two-Phase Commit (2PC) protocol, where a similar failure leads to a blocking issue?

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

    Is it moments like these when I should start considering NoSql for microservices rather than trying to achieve a fake sense of acidity through XA and Saga implementations of DT?

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

    Database 3 : Ohh what happened, O was in a coma 😂😂😂

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

    Make a video on mnesia database from erlang ecosystem

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

    Ladees vashrum

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

    Feeling , I am able to understand arabic language

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

    It is not necessary to synchronize the distributed databases.
    There are two arguements for this.
    1. All human are distributed, our memories are not synchronized. What is important is just network communications to pass messages.
    2. If you synchronize the databases, it is the same as having one database. This is wasteful and should be avoided. Only minimal backup as 'disk' is necessary.

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

    First

  • @DipankarDas-cm1zs
    @DipankarDas-cm1zs 2 ปีที่แล้ว

    Just want to ask what about timestamp protocol compared to 2 phase protocol couldnt understand their respective drawbacks🥲