Database Replication Explained | System Design Interview Basics

Поділитися
Вставка
  • Опубліковано 24 лип 2024
  • Relational databases have been around for more than 30 years. Effective Database replication patterns are one of the reasons why they did withstand the test of time so well.
    Today, we look into the iconic main-replica pattern and ask how does it work and even more importantly how does it scale? This video is part of my system design interview preparation series.
    00:00 - Intro
    00:36 - Why Replication Matters
    02:04 - What is replication?
    03:28 - A brief history of replication
    03:46 - Main-replica pattern
    06:08 - Replace a replica node
    07:29 - Replace the main node
    10:06 - Why scalability matters
    11:10 - Scaling reads
    11:52 - Scaling write requests
    14:21 - Summary
    🐦 Follow me on Twitter:
    / hinsencamp
    🙌 Our Big Tech Community on discord!
    / discord
    ✏️ Download FREE system component library for Excalidraw:
    bigtechcoach.gumroad.com/l/ex...
    ⭐️ Enrol to my 5.0-rated Course on System Design Interview Preparation:
    www.udemy.com/course/the-bigt...
    🚀 Ace your system design interview!
    #systemDesignInterview #replication #SQLdatabase
  • Наука та технологія

КОМЕНТАРІ • 24

  • @hafizmfadli
    @hafizmfadli 8 днів тому +1

    wow this is an amazing explanation, you can wrap several concepts in just a single video. Thanks for creating this video, this video helps me to prepare my incoming interview

    • @big_tech_coach
      @big_tech_coach  5 днів тому

      Awesome to hear that it was that helpful to you!

  • @Spade2351
    @Spade2351 Рік тому +1

    Thank you so much for this video. It answered so many questions I had. Should be a must watch for anyone studying system designs / intro to system designs

    • @fabianhinsenkamp613
      @fabianhinsenkamp613 Рік тому

      Thank you, that's very kind! 😋

    • @Spade2351
      @Spade2351 Рік тому

      @@fabianhinsenkamp613 no ty! I have a systems interview in 2 hours and your videos are covering a ton of points the recruiter told me to study up on

    • @big_tech_coach
      @big_tech_coach  Рік тому

      Glad it was helpful!

  • @nehasinghal9772
    @nehasinghal9772 4 місяці тому

    You are doing great job... keep creating the content related to database. Well explained replication to shards.

  • @brianligat9493
    @brianligat9493 4 місяці тому

    Very well and clearly explained

  • @nilsfrahm1323
    @nilsfrahm1323 Рік тому +3

    Replication is also used for distributed, ocasionally connected apps. This tutorial doesn't mention anything about it. Just because websites using databases with replication is popular now, doesn't mean replication doesn't have other uses.
    It would be interesting to see a tutorial on replication for distributed databases, all handling reads and writes with thousands of tables, frequently changed schema and how updates are handled in such a system.

  • @ahmedroma8697
    @ahmedroma8697 4 місяці тому

    Thank you man

  • @inderjitsingh2341
    @inderjitsingh2341 11 місяців тому +1

    This video is really good! Concise explanation with great visuals. You deserve a lot more viewers! I have a few questions:
    1. Why do we worry so much about replication and sharding when most of this is taken care by the database system itself. It is not usually implemented at an application level I believe (correct me if I am wrong).
    2. How does data replication in SQL databases compare to that in NoSQL databases.
    3. What happens in case a user tries to write to the main/master node from 2 multiple instances simultaneously?

    • @big_tech_coach
      @big_tech_coach  11 місяців тому +2

      Thank you very much! Let me answer your questions :
      Replication & Sharding:
      It's crucial for devs to understand these, even if databases handle them. Design impacts efficiency. Some apps might need custom sharding for unique control.
      SQL vs. NoSQL Replication:
      SQL often uses master-slave; writes go to master, then replicate to slaves. NoSQL varies: some are peer-to-peer, some use primary-secondary. NoSQL often focuses on availability.
      Multiple Writes to Master:
      Databases use locking for consistency. In multi-master setups, conflicts can arise, leading to strategies like "last write wins" or requiring resolution.

    • @inderjitsingh2341
      @inderjitsingh2341 11 місяців тому +1

      ​@@big_tech_coachUnderstood! Thank you so much for replying!

  • @jibin7277
    @jibin7277 Рік тому +3

    Excellent content. You need more viewers

  • @mohamedmoideen2061
    @mohamedmoideen2061 10 місяців тому +1

    Once Report Manager Started, then replication is initialised.

  • @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???that is matter of configuration on load balancer or that would b explicitly written by app developer on gateway level?

    • @big_tech_coach
      @big_tech_coach  Рік тому +1

      Hi Jibran :-D Good questions! main-replica strategies are typically configured on database level. Routing is not a concern to application level design. You wouldn't manually define which node to address for reads or writes, that all happens on system level.

  • @jayshah5695
    @jayshah5695 2 роки тому +3

    volume too low

    • @big_tech_coach
      @big_tech_coach  2 роки тому

      Thanks for pointing that out jay! I fix it for the next one.