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

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 38

  • @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.

    • @kapssul
      @kapssul Месяц назад

      does CockroachDB handle all that even if the coordinator node goes down? i searched your youtube channel but found no video about CockroachDB.. i wonder why.. is there something wrong with CockroachDB ?

  • @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 года назад +6

      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 4 месяца назад

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

  • @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 года назад +3

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

  • @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.

  • @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.

  • @RakshYadav
    @RakshYadav 2 года назад +14

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

  • @pollathajeeva23
    @pollathajeeva23 Год назад

    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.

  • @spacewalker839
    @spacewalker839 8 дней назад

    What would be disadvantages of 1 phase commit, say where each node sends ready to commit message, as soon as transaction work is done and forcing it on stable storage. The coordinator then only sends commit/abort to all the nodes?

  • @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.

  • @mohamedhatimwahdani8514
    @mohamedhatimwahdani8514 2 года назад +2

    Very good video, very well explained, Thnx !

  • @Mmmmmkoogfssdvbhvggg
    @Mmmmmkoogfssdvbhvggg 9 месяцев назад

    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?

  • @jobosan4855
    @jobosan4855 2 года назад +2

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

  • @abisheksoni3354
    @abisheksoni3354 2 года назад +4

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

    • @Gerald-iz7mv
      @Gerald-iz7mv Год назад +1

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

  • @hippo50410
    @hippo50410 10 месяцев назад

    Very well explained!

  • @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?

  • @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 😉

  • @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.

  • @sureshchaudhari4465
    @sureshchaudhari4465 10 месяцев назад +1

    who wants book shelf tour

  • @danku1013
    @danku1013 2 года назад +2

    Go Saga next

  • @HariRoshan93
    @HariRoshan93 2 года назад

    Make a video on mnesia database from erlang ecosystem

  • @TechCornerWithAjay
    @TechCornerWithAjay 10 месяцев назад

    We used two phased commits

  • @shubhankar915
    @shubhankar915 2 года назад

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

  • @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.

  • @nikhil199029
    @nikhil199029 Год назад

    Ladees vashrum

  • @rajankesharwani9486
    @rajankesharwani9486 10 месяцев назад

    Feeling , I am able to understand arabic language

  • @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🥲