Learn System design : Distributed datastores | RDBMS scaling problems | CAP theorem

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ย. 2024
  • Learn system design easily!!
    Distributed Data Stores provide incredible performance and scalability at the cost of consistency or availability.
    In this video you will learn what are the different ways to scale DB and what are all the problems you will face!!

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

  • @nknnithinabc
    @nknnithinabc 5 ปีที่แล้ว +37

    1:58 - Write Operation occurs in Master DB, Read op occurs from Slave DB
    2:58 - Inconsistent situation
    3:58 - Sharding [All are having same power unlike Master/Slave]
    5:17 - N times efficient
    6:42 - Joins between them
    7:36 - CAP Example
    9:43 - Availability
    10:11 - Partition Tolerance - Even if the link b/w 2 serves A and B goes down, they will still be able to communicate[Via C]
    We can ONLY have any 2 of CAP - Most of the Data Stores provide AP
    Eventual consistency - You will be getting old Un-updated data readily
    VS
    Strong Consistency offers up-to-date data but lately after updation of all nodes.
    20:10 - BASE

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

    A comment about CAP theorem. In general, distributed systems don't have control over network failures. So, partition has to be tolerated. It's actually a choice between Consistency and Availability. In case there are no network failures (ideal scenario), all 3 can be satisfied. here's the excerpt from Wikipedia -
    "No distributed system is safe from network failures, thus network partitioning generally has to be tolerated. In the presence of a partition, one is then left with two options: consistency or availability. When choosing consistency over availability, the system will return an error or a time out if particular information cannot be guaranteed to be up to date due to network partitioning. When choosing availability over consistency, the system will always process the query and try to return the most recent available version of the information, even if it cannot guarantee it is up to date due to network partitioning.
    In the absence of network failure - that is, when the distributed system is running normally - both availability and consistency can be satisfied.
    CAP is frequently misunderstood as if one has to choose to abandon one of the three guarantees at all times. In fact, the choice is really between consistency and availability only when a network partition or failure happens; at all other times, no trade-off has to be made.
    Database systems designed with traditional ACID guarantees in mind such as RDBMS choose consistency over availability, whereas systems designed around the BASE philosophy, common in the NoSQL movement for example, choose availability over consistency.
    The PACELC theorem builds on CAP by stating that even in the absence of partitioning, another trade-off between latency and consistency occurs."
    Source: en.wikipedia.org/wiki/CAP_theorem

  • @mitsiddharth
    @mitsiddharth 5 ปีที่แล้ว +13

    Nice explanation. Your observation about current systems choosing AP over C applies for majority of cases. There is one special class of apps which need consistency though: e-wallets, banking etc. Discussing some approaches to mitigate inconsistencies on those systems might be interesting.

    • @jesus-love
      @jesus-love 5 ปีที่แล้ว

      You could get all 3 of them with Cassandra. It's all about configuring it properly.

    • @renning22
      @renning22 5 ปีที่แล้ว

      blockchain please.

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

    Thank you for serving humanity. Levi and you are one of humanity's greatest soldier.

  • @jesus-love
    @jesus-love 5 ปีที่แล้ว +7

    You are doing a very good work. You deserve a lot more subscribers and views. Thank you so much.

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

    Best channel for understanding System Design and other software development aspects. Cracked multiple interviews by going through your videos. Thanks a lot man. Great stuff.

  • @akn4336
    @akn4336 5 ปีที่แล้ว +38

    A in ACID stands for Atomicity not Availability

    • @akn4336
      @akn4336 5 ปีที่แล้ว

      @@kittgs Thanks for the comment. Just fixed it.

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

      A more relevant term for A in ACID is abortability. Source: Klepman

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

    It's interesting that Base and Acid are terms that sits at the two ends of a pH scale in chemistry, a fair analogy of the different characteristics between an eventual consistency and a strong consistency RDBMS.

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

    P in CAP: The definition listed here "Even in case of internal network failure, the system should be up and running" is very misleading. I think it should be "Even in case of internal network failure, the guarantees (either C or A) promised by system will continue to hold"

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

      can you explain how to solve the problem at 5:45?

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

      Bhanu is correct. Partition happens by default. We should choose either C or A

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

    A video on consistency model would be great

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

    Thank you. Very nice explanation. May God ALLAH guide and bless you

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

    Good video. But I think consistency in ACID and CAP are different. In ACID it talks about database invariants/rules such as cascades, constraints etc. Also keeping 'P' optional in CAP may not be possible in distributed systems as we can't avoid network failures.

    • @vikas20013
      @vikas20013 4 ปีที่แล้ว

      Why P is always included when we cannot handle network failures?

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

      I thought the same...its not in our hand to choose partition (P) or not....Design should be made with a mindset that if partition occurs .... what are you going to prefer ? consistency or Availability (i.e essentially choosing your partition tolerance strategy). Partition not happening is the best case possible cos then you have both consistency and availability.

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

    Thanks so much for this great explanation!

  • @sweetyb3287
    @sweetyb3287 5 ปีที่แล้ว

    Great explanation again! Have tried reading about CAP theorem but your video clarifies it very nicely. Can you please post the link of the video that you mentioned at the end where you'll use cassandra DB to explain the distributed DBs concept?

  • @wastabirrajvee8867
    @wastabirrajvee8867 5 ปีที่แล้ว

    Excellent video really liked it. Thank you so much for your efforts.

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

    CAP is frequently misunderstood as if one has to choose to abandon one of the three guarantees at all times. In fact, the choice is really between consistency and availability only when a network partition or failure happens; at all other times, no trade-off has to be made

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

    Great work sir!

  • @9fxhrlif9er
    @9fxhrlif9er 3 ปีที่แล้ว

    Some NoSQL databases like MongoDB are not only fully ACID compliant, but it's also fully consistent. Even DynamoDB has consistent read mode.

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

    Thank You so much for your explanation. Could you please do a session on system design of the GrubHub or Seamless system.

  • @algorithmimplementer415
    @algorithmimplementer415 5 ปีที่แล้ว

    Geez .. so much time on CAP theorem!! Did you explain how to merge/join the results from two nodes which triggered the discussion of CAP?

    • @HimanshuSingh_92
      @HimanshuSingh_92 4 ปีที่แล้ว

      Even I wanted to learn about that. Can you please share here if you find anything related to it? Thanks.

  • @w.maximilliandejohnsonbour725
    @w.maximilliandejohnsonbour725 4 ปีที่แล้ว

    Very informative video...!!!!!.

  • @zishanshaikh3068
    @zishanshaikh3068 4 ปีที่แล้ว

    Great job

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

    Nice 👍

  • @sharthakghosh970
    @sharthakghosh970 5 ปีที่แล้ว

    Awesome explanation !!

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

    Thanks

  • @msha4887
    @msha4887 4 ปีที่แล้ว

    For financial application we can't do a AP model. Good and information.thanks

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

    thank you, you rock the concepts

  • @AshutoshKumar-xz9hs
    @AshutoshKumar-xz9hs 3 ปีที่แล้ว

    If we are partitioning in master and slave form then how we can write to slave, directly as you said ?
    In that case we need to make all db as master right?
    Correct me if I am wrong

  • @ashrafulalamfoysal8672
    @ashrafulalamfoysal8672 4 ปีที่แล้ว

    Hey!can you solve this problem :
    An owner designed a security system with two sensors, motion and heat, and an alarm for his home. If the system is disabled, there is no alarm even if the two sensors detect a stimulus. When the system is enabled, it triggers an alarm if either of the two sensors detect a stimulus. The triggering of the alarm is done by passing a signal to the system output. The system can be considered to have two blocks, A and B. Block A sends the signal to block B whether to pass the alarm sound or not. Design the circuits of the two blocks.

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

    key is how to write the application that can check the index of records on a pre-existing database and shards it automatically when in need. scalar function

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

    if sharding is used , is consistency solved? if so when we need to worry about consistency? Mongodb uses both master slave and sharding?

  • @AbhishekSharma-si8ui
    @AbhishekSharma-si8ui 4 ปีที่แล้ว

    AWESOME

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

    In reality you can really choose either AP or CP you can't build system which is CA (network is reliable fallacy)

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

    17:20 Its not ok to forgo consistency.. It depends on the application you are working/designing. Agree with systems like FB, insta etc but not with traditional enterprise applications in domains like health, banking, insurance etc..
    Also, reading from slaves and writing to master is not a bad strategy always.. Some major companies still use it.. again it depends on the use case..
    bitbucket.org/blog/scaling-bitbuckets-database

  • @arisrahmanudin9094
    @arisrahmanudin9094 5 ปีที่แล้ว

    thank you, that is clear my doubt

  • @SunilPatil-hs8wd
    @SunilPatil-hs8wd 4 ปีที่แล้ว

    In ACID principle A stands for Atomicity

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

    It is never a choice to pick any 2 in CAP theorem - partitioning is actually partition-tolerance which is a static problem with distributed data stores connected via networks, thus the trade-off is between Availability and Consistency. [AP or CP].
    Also, the CAP theorem is fading out and the PACELC theorem is the more detailed extension of it.

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

      CA type databases are generally the monolithic databases that work on a single node and provide no distribution. Hence, they require no partition tolerance.

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

    Small correction I think A in ACID stands for Atomicity not Availability..

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

    Is your playlist is in sequential order ?

  • @nishantsehgal455
    @nishantsehgal455 5 ปีที่แล้ว

    Can you explain how RDBMS is COnsistent and Highly available as per CAP therorem?
    system can either be CP or AP according to me.

  • @MrSushil430
    @MrSushil430 5 ปีที่แล้ว

    Nice videos :)

  • @manjunathdavanam3901
    @manjunathdavanam3901 4 ปีที่แล้ว

    Can you please make video on columnar storage

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

    When we already shared, why write on one shared will go to other? I thought each shards will have replicas which makes sense but why shard s1 will replicate to shard s2? Does not make sense

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

    I think you could have explained CAP Theorem better by showing an AP setup, and then showing how you can sacrifice one of them to gain consistency.

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

      You don't sacrifice a or p, you sacrifice c or a in the event of p - choose consistency or availability in the event of a network partition.

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

    Does somebody know about models for distributed database that sync only on demand to keep traffic low?
    I see mongoDB is a choice but I cannot find material on how it handles inconsistency and sync on demand.

  • @IC-kf4mz
    @IC-kf4mz 3 ปีที่แล้ว

    Here only one type of master and slave is discussed. Does anyone know where I can find some examples of distributed databases?

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

    kya baat hai yaar

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

    under which CAP scenario Conistancy AND Availability will exist together ?

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

      Under none. It can be available and eventually consistent though

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

    If I choose A & P meaning, my system will always be available, and the partition will always be working (Always Connected). So If I have chosen A & P, how come the problem of 'Inconsistency' can occur?

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

      In fact, the choice is really between consistency and availability only when a network partition or failure happens; at all other times, no trade-off has to be made. (Taken from Wikipedia & comments below). Got my answer. Added this, just in case anyone has the same dilemma.

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

    Mate, ACID is A for Atomicity ^& I for Isolation (NOT availability & Integrity !!)

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

    how is consistency + partition tolerance possible , if you bring in partition tolerance arent you compromising consistency almost always

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

    Suggestion : You should not look back and forth between the board and the camera so often, it is completely distracting when you turn your head twice every second. Try finishing a concept once, and then turning to the camera to discuss. Thanks.

    • @TechDummiesNarendraL
      @TechDummiesNarendraL  5 ปีที่แล้ว

      Never thought about it, Thanks for the suggestion

    • @arun5741
      @arun5741 5 ปีที่แล้ว

      Rohit Kumar Sharma
      U r my hero. Can u pls share ur number

  • @amoghasoda
    @amoghasoda 4 ปีที่แล้ว

    ACID - Atomicity, Consistency, Isolation, Durability

  • @reddykiran9320
    @reddykiran9320 5 ปีที่แล้ว

    Can you give an example of CP

    • @subvind
      @subvind 5 ปีที่แล้ว

      PostgresQL

  • @vikas20013
    @vikas20013 4 ปีที่แล้ว

    Why P is always included when we cannot 100% handle network failures?

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

    ACIP - Atomicity,Consistency,Isolation,Durability :: Its Atomicity not Availability

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

      Oh yess!! My bad. I will update the video. Thanks

    • @Atpugtihsrah
      @Atpugtihsrah 5 ปีที่แล้ว

      It's ACID not ACIP.

    • @blasttrash
      @blasttrash 5 ปีที่แล้ว

      @@Atpugtihsrah lol

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

    can anybody pls tell me how t achieve CA and CP?

  • @vaibhavgoel9254
    @vaibhavgoel9254 5 ปีที่แล้ว

    Sorry but... where was RDMBS scaling ???

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

    What a terrible explanation of CAP . He kept repeating same thing over and over again