Database Replication | Synchronous vs Asynchronous | System Design Tutorials | Lecture 18 | 2020

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ค. 2024
  • This is the eighteenth video in the series of System Design Primer Course. We talk about one more important component of System Design: Database Replication.
    We want software engineers and aspiring software engineers to develop basics and get ready for the world of interviews as well as excelling as a Software Engineer.
    ------------------------------------------------------------------
    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
    ------------------------------------------------------------------------------------------------------------------------------------
    Timestamps:
    0:00 - Intro
    0:53 - What does replication mean ?
    5:45 - Understanding replication lag
    7:21 - Replicating Synchronously
    9:44 - Advantages of synchronous replication
    11:24 - Asynchronous Replication
    16:10 - DB replica versus Snapshot
    17:27 - Summary

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

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

    Hello peeps! Hope you like the video. Apologies about the traffic noise in the start. Was recording this late at night in my home town in India. :)

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

      No problem at all.... This video was really helpful and I sincerely encourage you you to please make more videos like these.Thanks a ton!!

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

      Hi, Firstly I would like to thank you for creating such great videos on System designs. I have just one thing to ask that I can't the reference links in your description for couple of videos. Can you please share across those links, will help me to dig deep in the topics you covered. Thanks in advance

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

      This is great content, thank you so much. could you please do more content on db replication and faults and failure handling like the previous video in the series.

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

      Can anyone help me how i can actually implement it, i hve understood the concept but to to implement

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

    Thank you so much, I've watch couple of videos but you are the one that makes me get it!

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

    I was searching all over the internet for System design videos that are basic and which I can easily understand. This series helped me a lot in understanding the basic concepts. Nicely explained. Now I'm thinking about why I didn't start searching a little early 🙂. Please add the reference links in your description. I can't find them. Thanks again Yogita.

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

    loving this video series - finding it very helpful!

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

    That's a great video. Would love to see a lesson on multi-master replication, and how to handle conflicts in those cases.

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

    I was confused with aerospike db for implementing a ratelimiter algorithm to store and access atomic counters in faster way, as it has many read write polices between master and slaves. Finally this video clears my doubts to understand such systems.

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

    Awesome one, Thanks for sharing.

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

    Excellent Explanation. Keep it up 👍

  • @roberto-rodriguez
    @roberto-rodriguez 2 ปีที่แล้ว

    Awesome video. Thanks you very much!!

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

    Very good video with wonderful explanation. ✨✨

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

    Very good videos. Thanks for the content.

  • @ashishverma-mj1kl
    @ashishverma-mj1kl 3 ปีที่แล้ว

    couldn't be more perfect!

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

    Thanks for the very helpful video.

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

    Hello Yogita,
    Great informative video as always but was really looking forwards to learn more about the different replication models which you were touching upon briefly throughout the video. You seem to stress a lot on exploring the additional resource links in the description of the video. But unfortunately, they seem to have been missed somehow. This has been the case in past few of the videos too.
    Could you please update the descriptions of video to have those links added?
    Thanks in advance.

  • @official-DRFRE
    @official-DRFRE 2 ปีที่แล้ว +1

    Thank you so much it is really helpful.

  • @gulshankumar-jc2kg
    @gulshankumar-jc2kg ปีที่แล้ว

    thanks for knowledge sharing...😊

  • @shahulhameed-xc1to
    @shahulhameed-xc1to 5 หลายเดือนก่อน

    Superbly made ❤

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

    I understand very easily by the way you teach. So please make a in depth video of database replication as it becomes very important when data transaction is very large.

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

    Nice Ma'am!

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

    Thank you so much 👍🏼🎉⭐🙏

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

    a very good explanation.

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

    Thanks for this !!

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

    Neat explanation

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

    hi, thanks for the video Yogita :)
    , one doubt is whether the snapshots are also distributed across all the nodes or specific to a node

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

    @sudoCODE, Yogita, thanks for the detailed explanation. Could you please update the links as you mentioned, couldn't find them in the description box. Thank u.

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

    Yes please, replication primer 👍

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

    Thank you so much!

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

    great vid

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

    thank you..😊😊

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

    Thank you very much

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

    love the video

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

    Another great Video! :)

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

      Thanks again!

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

    Conceptually you are the best teacher mam...

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

      Thanks Mridul

  • @SahilSharma-ug8xk
    @SahilSharma-ug8xk 2 ปีที่แล้ว

    Nice👌🏻

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

    Clear concept

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

    Nice explanation!!
    Also, it would be great if explain a bit about multi-leader replication, and how to handle conflicts in that case.
    Please keep on making videos!!
    Thanks for sharing your knowledge ma'am!!

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

      Thanka a lot Rupesh. Yes I will definitely make video on leader election, consensus, paxos etc.

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

    Very useful video..thanks a lot!

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

      Glad it was helpful!

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

    Very good video ! Thank you

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

      Glad you liked it!

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

    Nice video !! A replication primer for sure :)

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

      Hehe. Thanks

  • @ravikumar-yq5df
    @ravikumar-yq5df 3 ปีที่แล้ว +1

    Awesome content.

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

    hello sudoCode, as you explain very welll but still want to know more details the things, please attach some online linkes or materials for every topics from where we can get the full/details context.... Thanks In Advance :)

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

    Greate content thanks a lot.
    But I have a doubt that in all the replication methods (sync or async or hybrid) If one of the replications (write in R1, R2, R3) write fails (suppose in R3 write fails) then how to manage that situation. So in this case Data inconsistency problem might occur.
    Correct me if I am wrong.
    Thanks again for producing beautiful content.

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

    Thanks

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

    Hi Yogita, I really liked the series, especially the real-world analogies given at the start. However, I would request you to please add the resources in the description, as they are missing in many videos.

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

      Sure 😊

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

    Awesome content ☺️

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

      Thanks Shani 😊

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

    Short and sweet introduction to replication. Though you mention it is short information of big topic, in replication if primary goes down then one of secondary become primary and in case of asynchronous how to make sure that secondary selected out of consistent only.

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

      That depends on implementation level.

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

    Great video! Can you make a video on data models? For example Relational/Document/Graph/wide-column? Their applicability, use-cases and examples?

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

      Guess what? I already did :) th-cam.com/video/O_c7lzNbcKo/w-d-xo.html

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

    Big ups

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

    You are going great job.
    Please make more detailed video database replication .

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

      Sure I will

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

    No resources in the description

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

    i want to know more on data replication engine,i want you to make a complete vedio for data replication project,how it works....the way you teach is greate.
    thanks

  • @PANKAJKUMAR-nu6oc
    @PANKAJKUMAR-nu6oc 2 ปีที่แล้ว

    Very insightful mam

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

      Thanks a lot

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

    Nice explanation.

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

    I liked your video. The explanation is simple and easy to understand but can you please add the links that you mention in your video? I cannot find them

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd 3 ปีที่แล้ว +1

    Thanks a lot for the nice explanation. Shared the channel link to the coding community sites to acquire the greater number of audience for such an informative topics of system design. Pls do post video on system design example
    - facebook feed, google serarch, instagram working , uber architecture.
    Thanks

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

      That's very kind of you! Thanks a ton.

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

    Really good content mam

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

      Thanks Kalyan

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

    There could have been an overall slide for this video on strategy, like you have done for caching video

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

    Hi Yogita, Thanks for providing such good and clear content! I was looking for the links you said (in video) to be their in description but cannot find any here. Is there someother resource i need to check other than the courses ?

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

    Hey, I am a bit confused about synchronous replication and how it solves consistency issues in case of high latency between the replicas. You explained that the write is initiated on the master and is broadcasted to all the replicas. The replicas execute the write command and send back acknowledgments. What happens if there is a read during this process? It is quite possible that a read request on the master is going to be different from the read request to one of the replicas. Do we accept that inconsistency? In a write and read-heavy system, this will happen a non-trivial number of times.

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

      i think till the master sends acknowledgement to the writer service for synchronised replication for example updating a order, other services like for example invoice service won't enquire about that particular transaction even if it accessing the inconsistent replicas. They might want to enquire about already consistent transactions. Hope this makes sense may be..

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

    Please explain about eventually consistent

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

    Thanks for this amazing video ❤ 🙏 i have a doubt when I insert bulk data in million then slave started 100% cpu utilisation and due to the same my server -read stop working till the operation completed. Pls suggest how I can handle this situation?
    Thanks in advance 🙏

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

    hi really great explanation, it will be nice if you add subtitle for people like me who rly hard to understand spoken English (I'm not native English speaker), it'll really help me, thank you in advance :)

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

    Hi Yogita, while we do understand the different methods to update the replicas , be it hybrid , sync or async , in case of a transaction driven app , as you said , can be banking , which of these has to be used since I see a glitch in all three in terms of data consistency for example Hybrid - R1 is updated and main DB says write complete , user is accessing R2 which means user wouldn’t get the updated data .
    So isn’t it like it should first update the replica which user is accessing and all others later ?

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

    Hi.. I could not find the link to the docs u mentioned? Could u pls share that

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

    Hi, I like the video I am unable to find resources in the description.

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

    so can you please tell me more about table replica

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

    Hi Yogita, thanks for sharing these wonderful videos. it is really helping us to understand the concepts. One Question though - in every video you mentioned the link for additional content but i never found it. Generally it has details about past and future video, link about your linkedin and hangout... i am not sure if i am looking at the right place. Please suggest.

    • @AnkurKumar-vx3xv
      @AnkurKumar-vx3xv 3 ปีที่แล้ว

      Hey I am getting same problem . Have you found it

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

      @@AnkurKumar-vx3xv no

  • @GauravSharma-wb9se
    @GauravSharma-wb9se 2 ปีที่แล้ว

    how all replica DBs will be locked for read operation when master is updating using synchronous approach ? that time also read can happen and reader can get wrong data if update is not completed from master. ?

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

    U forgot to add or mention about the latency topic in any video. Pls check and make a video on that as well.

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

    I don't know but whenever I see your explanation it feels like my big sister is teaching me.. Although I don't have one 😐... Amazing content can't imagine it's for free..

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

      This made my day 💙

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

    Hello maam, i have a doubt in the method of solving replication lag. The lag can happen between the secondary DBs as well. The acknowledgment will also take time to reach and will the time taken i suppose will be exactly equal to the the lag. Hence, we were never able to solve the problem

  • @NeerajSharma-xf1xk
    @NeerajSharma-xf1xk 2 ปีที่แล้ว

    what is row based replication & statement based replication ? Please explain.

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

    What will happen if Replica fail to update? What will be the best approach to handle this ?

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

    Streaming is like broadcasting all database in cloud and accessing is available all time as soon as new data uploaded

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

    Hi Yogita, nice videos very informative - keep it up!
    I don't see links to additional resources in description from past few videos - Can you please check it once? I would love to read/explore more on these topics using the links you have in mind. Thanks :)

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

      Will check and try to update.

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

      @@sudocode Hi Yogita, do you have the additional resources? In many videos, they are not there in the description. Thank you for the great content!

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

    Nice! So database system will take care of copying data to slaves, it is matter of configuration on database system level....what about routing read n writing request to the respective db node,would that b implemented on the application level via some gateway to filter n send to respective db i.e., read or write???eagerly curious :-))

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

    Excellent !! I dont see any references or links in the description as you mentioned...

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

      let me check the links.

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

    I'm thinking of created an application service that will act as a db read cache. But pass thought writes.

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

    If we also able to demo this theories

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

      I am trying to build demos.

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

    I'm confused between this and CQRS .

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

    In synchronous replication only one of replica is in sync with primary db, correct me if wrong.

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

      It depends on the implementation. All replicas can be first synced before committing writes.

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

    Mam you always say "links in description" for further read. I couldn't find anything in the description.

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

    Please try to create a database replication course.

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

      Can’t promise. Will do if there’s a lot of ask for it.

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

    Ma'am please share notes of these lecture.

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

      Will try!

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

    the way you explained synchronous replication feels incomplete. To me, if the replicas are serving the reads (as described a minute before.) then there is a time when some of the replicas have done the write and sent their ack, and others have replicas have not yet done so. At that point the replicas which have not yet acknowledged will be reporting the old value, and those that have acknowledged should return the new one.
    I suspect there is another round of of packets to circulate to confirm (commit) that the write has succeeded, and only after the second round trip should the master answer that the write has succeeded.

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

    my notes below:
    Replication:
    Pros - Fault tolerance, secondary mains, latency reduction, cqrs, Performance improvement, availability.
    Cons - dissynchronization(replication lag) -> Data inconsistency.
    Solution for data consistency
    Read after write consistency
    To be continued....
    #SR7

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

    I can hear the traffic in the background xD

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

    Hey Yogita, Can you please explain what happens in case of synchronous replication where there is data exchange from both sides at the same time?
    example: data variable x is updated to 1 at time t1 on primary DB, and at the same time t1,data variable x is updated to 2 on secondary DB. How does DB handle these situations? do database engineers keep a check on race conditions while configuring the replica setup?

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

      This is a classic concurrent event case. In distributed systems there is no way to conclude the exact ordering of concurrent events, so it depends on the consensus algorithm used to reach and agree on a result.

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

    hmm the location of Ireland seems a bit off..

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

      Yeah. Sorry for that Van 😑

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

    where is link , are you getting lazy

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

    Master slave is a wrong terminology, leader worker is the right one

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

    sorry no hates but she looks like Github LOGO

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

      Thank you it’s an honour 😃

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

    hello sudoCode, as you explain very welll but still want to know more details the things, please attach some online linkes or materials for every topics from where we can get the full/details context.... Thanks In Advance :)