April 20, 2021

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

Elite Hookey Ring Toss Game – Safer Than Darts, Just Hang it on a Wall and Start Playing

July 20, 2020

July 20, 2020

Amazon USA Amazon UK VERY POPULAR BIRTHDAY GIFTS FOR MEN, if you’re looking for unique gifts for men or birthday...

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

Cách kiếm tiền từ game bắn cá cực hay từ các cao thủ

December 18, 2020

December 18, 2020

Game bắn cá online là trò chơi đang rất thịnh hành và được nhiều người chơi yêu thích lựa chọn....

How To Play Yahtzee

July 24, 2020

July 24, 2020 47

This video tutorial will teach you how to play the dice game Yahtzee. WEBSITE: FACEBOOK: This video will start by...

PUBG LIVE | NO CHALLENGE ஜாலியா விளையாடலாம்..!!

July 23, 2020

July 23, 2020 1

Welcome to TAMIL WINGS YT FAMILY..! 🎀 Hope you all enjoy and don’t forget to Like, Comment, and Subscribe And...

CRAZY McDONALD'S ZOMBIES ★ Call of Duty Zombies Mod

July 26, 2020

July 26, 2020 39

Check this out! “SUPER MARIO HALLOWEEN ★ BLACK OPS 3 ZOMBIES MOD” -~-~~-~~~-~~-~- Welcome to YouAlwaysWin, proud home of Dumb...

Legendary Wings (NES) Mike Matei Live

July 26, 2020

July 26, 2020 30

Playthrough of Legendary Wings for NES. And briefly trying out GI Joe as well. Follow Mike Matei on Twitch ✜...

Cabo 1

July 27, 2020

July 27, 2020 7

How To Play Cabo Join the BouncinMouncin discord! If you want to donate to my channel to help pay for...


July 27, 2020

July 27, 2020

THE ONE AND ONLY “ORIGINAL FASTFOODTOYREVIEWS!” The Lego Movie 2: The Second Part is a 2019 computer-animated science fiction comedy...

How To Fix Render Lag in OBS/Streamlabs OBS for Smooth Livestreaming and Gaming

July 26, 2020

July 26, 2020 42

Do you struggle with stuttery gameplay and stream? You could be dealing with rendering lag caused by Windows 10 and...

Star Wars Battlefront: Princess Leia vs Boba Fett – JETPACK CALAMITY

July 26, 2020

July 26, 2020 35

Princess Leia Organa faces off against iconic Star Wars bounty hunter Boba Fett in an online hero battle. Who will...

Vintage Tabletop Bowling Game

July 19, 2020

July 19, 2020 32

This is a bowling game that was in my grandparents house when I was a kid. Sometimes when visiting them...

100 Sega Genesis / Mega Drive Games (Taken From an Original Genesis)

July 20, 2020

July 20, 2020 20

This is a vid of 100 Sega Genesis games as played on an original Sega Genesis, and recorded with a...

Cut Content in Fallout 3: Operation Anchorage?

July 26, 2020

July 26, 2020

Did you know there is a lot of cut content in Fallout 3, Operation Anchorage? Well, today I’m going to...


July 22, 2020

July 22, 2020 41

Hi guys, I am excited to bring you guys a fun solo tournament called the “BRAWL FEST” hosted by yours...

  • 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 *