October 21, 2020

Distributed Consensus and Data Replication strategies on the server

We talk about the Master Slave replication strategy for reliability and data backups. This database concept is often asked in system design interviews with discussions on consistency and availability tradeoffs.

Very closely tied to the master slave architecture is the concept of distributed consensus. When designing a system, we must make sure that the individual components can agree on a particular value. (Leader election, distributed transactions, etc…) Some popular techniques are 2 phase commit, Multi Version Concurrency Control, SAGAs and Quorum.

0:00 Problem Statement
0:53 Replication
1:24 Synchronous replication vs. Asynchronous replication
3:36 Peer to Peer data transfer
4:44 Split brain problem

Also useful when used with Master Slave replication is sharding. You can check out the video mentioned below.


Made by engineers from Google and Uber, this site helps you build your algorithmic skills using code and white board explanations.
Be sure to use the code ‘gaurav’ for the discount. You get 15% off!

System Design Course:

System Design Playlist:
Designing Data Intensive Applications –

You can follow me on:

#SystemDesign #Databases #Replication

Nguồn: https://liberty2010.org/

Xem thêm bài viết khác: https://liberty2010.org/game/

in Game
Related Posts

How to make Bowling Arcade Board Game from Cardboard DIY at HOME

July 24, 2020

July 24, 2020 2

diy diy christmas gifts diy halloween costumes diy christmas decor diy christmas ornaments diy network diy halloween decorations diy projects...

USA Trench VS HUGE Chinese army ! Operation Anchorage – Fallout Mod

July 23, 2020

July 23, 2020 37

Operation Anchorage has begun ! Go sub to Baron – previous video : Sponsor my channel by becoming a patron?...

ACADe Drawing Design (Basic/2D) Book's Tutorial | CH5

July 27, 2020

July 27, 2020

বাংলা ভাষায় প্রথম প্রকাশ ‘প্রফেশনাল অটোক্যাড ইলেকট্রিক্যাল ড্রয়িং ডিজাইন (বেসিক/2D)’ বইয়ের চ্যাপ্টারভিত্তিক ভিডিও টিউটোরিয়াল। এটি হচ্ছে পঞ্চম অধ্যায়ের ভিডিও যেখানে...

Free Fire Live Hindi [FF Live] – Brawler Bash Fest Free Mechnical Wings & Lol Emote!!

July 19, 2020

July 19, 2020 23

Free Fire Live Hindi [FF Live] – Brawler Bash Fest Free Mechnical Wings & Lol Emote!! Free Fire Live Pro...


July 21, 2020

July 21, 2020 26

Like if you think these crazy guys need to get on YouTube. Music: Intro – Paul Flint – Savage [NCS...

SQUAD Alpha – Render Test [60FPS – 4K downscaled]

July 26, 2020

July 26, 2020 9

Recently I updated my recording software for Squad to Dxtory with UtVideo YUV422 BT.709 codec, which allows a nearly loseless...

Fallout Operation Manhattan – EP1

July 19, 2020

July 19, 2020 31

Join me in my new miniseries as I join up with the Brotherhood of Steel in the Operation Manhattan mod....

Free Fire Live Brawler Bash Fest Free Mechnical Wings & Lol Emote – Garena Free Fire

July 16, 2020

July 16, 2020 33

Free Fire Live Brawler Bash Free Mechnical Wings & Free Lol Emote Garena Free Fire Live Streamer From India Killing...

Super BinGo 2 – Android Gameplay – World 101-110 – Part10

July 20, 2020

July 20, 2020

Super BinGo 2 – Android Gameplay – World 101-110 – Part10 Playlist: For more Android Gameplay, Sub to my Channel:...

GoSports Ring Toss Game 2017

July 28, 2020

July 28, 2020

Link to GoSports Ring Toss Game 2017 : The GoSports ring toss set is a fun game for all ages...

The 20 Hardest Sega MegaDrive/Genesis Games Ever Made!!!

July 24, 2020

July 24, 2020 24

Hey whatup guys OSG back with another hardest games video and this time we are going to look at the...

CPU intel core i5 thế hệ 10, cấu hình render video 4k mượt mà, chơi game bao phê | HongTS

July 23, 2020

July 23, 2020 1

Thật bất ngờ với thông số của dàn core i thế hệ 10. nó mạnh hơn hẳn các thế hệ...

Bingo Pop – Android Gameplay

July 25, 2020

July 25, 2020 27

Bingo Pop Android Gameplay HD [Full HD] MORE GAMES [ Description: Welcome to Bingo Pop, the classic bingo game that’s...

Minecon 2016 Cringe Compilation (Awkward/cringe)

July 18, 2020

July 18, 2020 49

Minecon 2016 Cringe compilation (Cringe/Awkward) is finally here. If you’re new to the channel make sure to subscribe and share...

Game of Thrones – Ender's Game | Theme Mashup | Super Martin Bros

July 24, 2020

July 24, 2020 4

Here is our long awaited, much requested cover of the spectacular Game of Thrones theme – with a twist! Watch...

  • Hey man, awesome Videos on important topics! Actually, I haven't come across any other good source on Systems Design.

    Can you recommend some literature or a crash course on Systems Design? Or maybe you can make a whole course, going from topic to topic in a structured manner, more like how the topics are structured in a book, so that it can serve as a starter basic overview on the whole field.
    Cheers 😉

  • In many Amazon interviews, they usually ask Command execution framework design and play store design. Can i have material for that?

  • If there is single database, my application is scaling up in terms of user then the load balancer will not help, all the load will be in single database, for that how to serve fast in terms of user experience(read/write), how to scale or design the database??? i m seeking help for sql server

  • 06:00 The balance deduction thing, the 2 messages deduction 100 and deduction 50 are different messages right ? so what's wrong with deducting 150 ? I think I am missing a key point.

  • Hi Gaurav.
    I have been going through your blogs for a while now and they helped me ace my WalmartLabs interview where i started a couple of months back.
    Litlle context on the practical application of this video, this is a very common problem in distributed systems where solution to the problem through only sharding is prettymuch rare as data is expected to be available anywhere and everywhere.
    I have been using Microsoft's offering of AZURE COSMOS DB which is a planet scale document based db solution where you get triggers or events when the state of your data changes so that it can be asynchronously communicated to other nodes/clusters. So, AZURE COSMOS DB offer's the option of multiple master for writes which asynchronously sync with each other and in case if a conflict there are 2 options _ the last write wins / you can execute a stored proc for some custom logic. So all of this is very relevant.

  • Great content (upvoted and subbed). Don't see any other channel with short and precise summaries of fairly complicated concepts.

    One more benefit of Master-Slave – Move replicated data closer (geographically) to the end user. For better user experience – lower latency.
    Also sharding and replication scheme are tangential and often work in tandem. Generally you will have sharded databases with each shard replicated. Replicated shard could be a slave or a master (consensus based).

    I vote for distributed consensus. In fact this would cover the meat of distributed systems and could be broken down into multiple smaller introductory videos
    Video 1> Inherent problems with distributed systems (failure detection, n/w partitions, byzantine(non) faults, clock skews).
    Video 2> Why do we need consensus ? Protocols to tackle #1 and what they tradeoff to offer consensus (CAP axis). Protocols – 2pc, 3pc, paxos (intro).
    Video 3> Real applications and tradeoff they make for better performances. (Why distributed acid applications are hard and to be avoided).

    I see lot of interviewees(i'm interviewer in one of the FANG) have surface knowledge of these concepts and often incorrectly adjust to a constraint (been guilty myself). Content like yours can help someone find gaps in their understanding.

  • Hi Gaurav, awesome video.
    Do you happen to know which system design is probably used in the scenario when you run out of locks during distributed consensus pretty fast. Something like rate limiting for acquiring locks ?

  • If our system has 'n' replicas, which replica amongst those 'n' stand chance to be master? What is the criteria for selecting one single replica amongst pool of replicas?

  • Excellent video as always gaurav.
    A few points from my side.
    1. Taking snapshots at regular intervals of the db is one way to avoid the single point of failure.
    2. Log reconstruction is one more way. Before writing to the db first flush to a log file. So if the db crashes the log file can be used to restore the db.
    3. I think when you talk about the databases communicating with each other , you mean there is an API that sits in front of them and these API's communicate with each other.
    Or is it that there is an API in front of the db which writes to a queue and another process that polls the queue and talks to the second db.
    4. One way to deal with the split brain problem is through the paxos algorithm.

    Great job and thanks !!! 🙂

  • Why don't you make a technical meme page. Where we get knowledge with laughter. haha 😛
    Amazing video and amazing memes in between 😛

  • Hi Gaurav,
    Nice video. I have some elementary doubts.
    1) how communication between two DB could get broken which results in Split brain problem. My guess is they communicate on particular port. Closing of port is only way to cause this issue.

    2) how master master architecture is achieved in DB. Bcz server would be configured to sent data to particular DB say DB1, howcome data could be dynamically sent to DB2. As much I know there is no load balancer behind DB set up.

    Thanks lot.

  • hey can you slow down your speed a bit. looks like its 1.3x instead of 1.0x. i know you get excited but if you can tone down your speed people can follow a bit better.

  • Hey, another great video. But i have some doubts regarding how states are maintained. Say there are 3 nodes(A,B,C), each at state S0. Link between A and B is broken. A gets an update and propogates it to C and now both of them are on state S2. Now if C gets an update and tries to propogate it to B, B will take note the C's state is not the same as its own. So….how will it be decides who is ahead and who is behind? According to your example, B will just tell C to rollback and force its own state onto C which is not right. So how will this work?

  • Hello Gaurav. Just want to ask what is your view on data science in industry field? Are you planning to switch to data science field in the near future?

  • HI! i love your competitive programming videos. do u think you can make a serie of fendwick tree (some applications of it in problems, not the theory). i think it is hard to conceptualize a problem and using fendwick tree to solve it, so it would be really helpful.

  • Hi Gaurav , this was very helpful video to understand master slave architecture , I have few queries like what if load balancer itself goes down , how master and slave notify each other I mean what mechanism they will use so that both with will be in synch? I am facing one problem with load balancer I have posted the question in stackoverflow https://stackoverflow.com/questions/54923637/wildfly14-undertow-load-balancer-is-retriggering-the-rest-call-internally
    could you please suggest me here what I am doing worng ?

  • Nice work Gaurav! This is the only channel for which I have enabled notifications. You are helping the whole community. Thanks a lot.
    PS: start an instagram page and post all these memes there also.😀

  • Your videos are great and you've done a great job in your explanations. You should do a video on book recommendations that aid people on learning about systems design thinking in this way.

  • Hi Gaurav, good video. Can you make a video over "how large scale Indian Unified Payment Interface works"? Focus on technical/Networking and Database aspects. Thanks !!!

Leave a Reply

Your email address will not be published. Required fields are marked *