Это видео недоступно.
Сожалеем об этом.

CAP | Consistency, Availability and Partitioning | System Design Tutorials | Lecture 19 | 2020

Поделиться
HTML-код
  • Опубликовано: 15 авг 2024
  • This is the ninteenth video in the series of System Design Primer Course. We talk about one more important component of System Design: CAP Theorem.
    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.
    Reference: ksat.me/a-plain...
    ------------------------------------------------------------------
    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.interviewr... (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:54 - What is Consistency ?
    4:20 - How to maintain Consistency ?
    5:32 - What do we mean by Availability ?
    7:15 - What are highly available systems ?
    8:28 - What do we mean by Partitioning ?
    10:02 - Consistency and Availability in Partition tolerant systems
    12:12 - Consistency, availability and partitioning in distributed systems
    15:45 - Outro

Комментарии • 108

  • @sudocode
    @sudocode  3 года назад +23

    Correction at 11:42: When one partner stops taking order, the system is consistent but not available because one of the nodes is not available. For a system to have property of availability, all the nodes(number of partners here) of the system should be available.

    • @laterlater8348
      @laterlater8348 Год назад +2

      this is wrong. When one node is not present for consistency no request is honoured. But for availability even if one node is available then it is available but the serving may not be consistent. As per your example if one partner does not take order then by virtue of CAP that order is served by the other person , end result is the client will not get something but may not be what he ordered. So for property of availability even if one node is present then it is available but may not be consistent , here we are comprimising consistency. For consistency all nodes must be present , that is the request is honoured only when all nodes are available, so even if one node is not present the request is not honoured there by we are compromising on availability.

    • @datta3268
      @datta3268 Год назад +1

      @@laterlater8348 Exactly! Availability means at least one node should be available to process the request, whereas Consistency requires all the nodes to be available.

    • @girishanker3796
      @girishanker3796 3 месяца назад

      But if one of the nodes goes down, the system can still be consistent right. Now instead of N nodes we have an N-1 node which is serving the requests and serving the same data throughout. And a system is said to be highly available when we have multiple systems spread across which helps in serving more requests. I think what she said is right here

  • @prathameshlakhpati9970
    @prathameshlakhpati9970 10 месяцев назад +5

    The story telling is really fantastic. I was able to recreate the same situation while being interviewed. Thanks alot

  • @ShubhamSharma-ii9jn
    @ShubhamSharma-ii9jn 3 года назад +18

    Great that someone is not just click-baiting and teaching something that's useful.
    Keep up the good work.

    • @sudocode
      @sudocode  3 года назад +5

      I appreciate your honest comment. This is one of the qualities we are focusing on for our channel. Thanks for appreciating.

  • @alishachhabra7995
    @alishachhabra7995 2 года назад +24

    Having high availabilty and high consistency at the same time might be possible or not. But in real life scenarios I think, partition tolerance cannot be ignored. Hence, we have to choose either between the availability or consistency with partition tolerance, i.e., AP OR CP.

  • @Manojshankaraj
    @Manojshankaraj 3 года назад +6

    This is the best video on CAP theorem in RUclips. Thanks for the clear explanation. Looking forward to more of your videos on System Design!

  • @princechhabra9342
    @princechhabra9342 Год назад +2

    Thankyou Sister for making such wonderful playlist.. Your videos were so helpful in preparing intrws.. I think Interviewer asked everything from this playlist, at one point I thought he had also watched your videos.. lol
    He asked CAP theorm and I vent out everything that I learnt here and at the end he said”very good”.. that was such a lovely feeling

  • @yogeshpathak
    @yogeshpathak 8 месяцев назад

    after watching more then 7-8 videos on CAP theorem found this video easy to understand. Thanks for the Food and Bar example

  • @thecloudbaba8668
    @thecloudbaba8668 3 месяца назад

    Partition P is must in real world for sure... now you have trade off between A & C ..
    Example of of AP - Social Media like Instagram, Facebook, LinkedIn etc. Where Consistence can be given off for eventual consistence or delayed consistency but Availability and Partiotion are preferred. for example, its okay to wait to read the comments or post r like with some eventual consistency.
    Example of CP - Banking, Finance where transaction needs consistence following the ACID properties. Where A transaction like sending and receiving funds needs constancy. hence C is must else your core service will have no purpose... now you have trade off between P and A but P is must... so most financial sectors follows PC
    CAP is itself a huge topic

  • @msrabea
    @msrabea 2 года назад +8

    CAP is not possible, CA is RDBMS, AP such as Cascanda or CouchDB, CP such as MongoDB, HBase, BigTable

  • @PankajVerma-ct8ho
    @PankajVerma-ct8ho 7 месяцев назад

    I really admire how clearly you explained, by taking a very practical human-level example, that one could relate to and follow. Keep up the good work. Thank you so much!

  • @lalatenduguru8121
    @lalatenduguru8121 5 месяцев назад

    I read many content on CAP, but my doubt got clarified in this video. Thanks for all effort!

  • @anjumanislamiachhatarpur7093
    @anjumanislamiachhatarpur7093 Год назад +1

    Nice examples, theories are available on internet but the examples you provided for CAP & MQs are awesome, that's the quality of goood teacher. Thank you.

  • @ishankagarwal7798
    @ishankagarwal7798 2 года назад +3

    All your videos are great Yogita. Thanks for sharing your knowledge.

  • @pathakutkarsh05
    @pathakutkarsh05 3 года назад +3

    A superb example that makes good sense. Kudos

  • @NeerajPahuja
    @NeerajPahuja 3 года назад +8

    Network partitions are unavoidable . I don’t think you have a choice of not having partition . The only choice you can make is between consistency and availability, that is, CP or AP

    • @sudocode
      @sudocode  3 года назад

      That's almost correct. More details in next video!

  • @aditatu4762
    @aditatu4762 2 года назад +2

    Another brilliant video!!! - Thanks for making and sharing them.

  • @jaytube277
    @jaytube277 2 года назад +1

    Excellent, Great explanation. Thank you very much Yogita

  • @kapilrules
    @kapilrules 2 года назад +3

    Hi Yogita thank you for the video. In case of active active we have high availability but it may not be consistent and in case of active stand by it will be consistent but not HA even though active can failover to standby any case of disaster.
    By consistency do we mean when A receives data copy of It is sent to B and then acknowledgement is sent back to client?
    I feel consistency and partioning are mutually exclusive
    Please correct me if I am wrong

  • @RKARAN-zs5zn
    @RKARAN-zs5zn 3 месяца назад

    ONe of the Best explanation

  • @alishachhabra7995
    @alishachhabra7995 2 года назад +1

    This is the best tutorial on CAP ever. Really appreciate your efforts. Looking forward to learn from you.

  • @deadpool4098
    @deadpool4098 Год назад +1

    Awesome. Very clean video with clear understanding

  • @easylearning2401
    @easylearning2401 3 года назад +2

    Simple and easy to learn! Great job

  • @apnejtbhaiya6058
    @apnejtbhaiya6058 7 месяцев назад

    CAP is possible.
    Let's start to take a order based on decided range of order id by person1 & person2. Whenever customer will ask the status then redirect request to corresponding person's server.

  • @eddanapudir
    @eddanapudir 3 месяца назад

    Very well explained. 🙏

  • @mystiqkc
    @mystiqkc 3 года назад +1

    Great example of partner and orders. Thank you!

  • @kartikayagrawal5825
    @kartikayagrawal5825 3 года назад +5

    The example for explaining CAP was too good. I think I should use this example to explain it to others. By the way one can only achieve two properties at a time in CAP. All the three can't be achieved at the same time.

  • @namahshrestha3226
    @namahshrestha3226 Год назад

    Understood the concepts properly
    1. System needs to be Consistent as well as Available. Partitions cannot be tolerated because that would make the system inconsistent. Availability does not get affected in this case. This case we have CA.
    2. System needs to Tolerate Partition and be Consistent. Then sacrifice one of the partitions by shutting that partition down. The system is Consistent as we chose one of the two partitions. No communication errors will occur. Also the system has just tolerated paritition. But it is not Available since we just shut down an entire partition. This case we have PC.
    3. The system needs to Tolerate Paritition and be Available. Do not shut down one of the paritions. This means we do not shut down any partition and keep being available to the customer. But now Consistency is an issue since the partitions have a broken communication channel between them. This case we have PA.
    So you can have either: CA, PC, PA

  • @NegiWorld24
    @NegiWorld24 Год назад +1

    Great explanation Yogita

  • @alivation3409
    @alivation3409 10 месяцев назад

    having partitioning tolerance should always be assumed, so really the only combos would be CP or AP, because partitions will always happen at some point, and having a point of failure due to them is a flaw in design imo

  • @harshthakkar7503
    @harshthakkar7503 3 года назад

    Really mam this example of foo and bar is nicely explained.

    • @sudocode
      @sudocode  3 года назад

      Thanks Harsh. Glad you found it useful.

  • @gouravkumar-or6jy
    @gouravkumar-or6jy Год назад

    Consistency can only achieved by RDBMS and they rarely goes down so they can also provide availability and High availability can only provided by Cassandra cause of its ring partitioning of the nodes and For Partition i preferred MongoDB, DynamoDB etc.

  • @kartiksood5508
    @kartiksood5508 Год назад +1

    Having consistency without partition tolerance is not possible because if there is no partition tolerance, that means there is no communication between nodes, there is no way for system to be consistent.

  • @dangidelta
    @dangidelta 2 года назад

    Beautifully explained... Loved it 👍🏻

  • @vasanthdhage
    @vasanthdhage 3 года назад +1

    Was looking for this... Thank you

  • @shyamsundervr5749
    @shyamsundervr5749 2 года назад

    As easy as it can get - this explanation is really the most easily understood one for CAP. Thanks.

    • @sudocode
      @sudocode  2 года назад +1

      You're very welcome Shyam :)

  • @onepercentswe
    @onepercentswe Год назад

    We can't achieve perfect CA system which is scalable. It won't be scalable. Hence, most of the systems, achieve Availability with eventual consistency. Means, we prefer to keep the system available all the time and bring the system to consistent state eventually as the time passes by synchronising the data in background. Not immediately.

  • @vanessacarly5140
    @vanessacarly5140 2 года назад

    This is really helpful! Explained it better than any of the explanations I've seen so far as I've been trying to learn this to prepare for interviews. Thank you!

    • @sudocode
      @sudocode  2 года назад

      You're very welcome!

  • @sohitbhaskarwar3546
    @sohitbhaskarwar3546 3 года назад

    Thanks for the both videos. It was really good. Thank You

    • @sudocode
      @sudocode  3 года назад

      Glad you enjoyed it!

  • @SujeetYadav-pu9nb
    @SujeetYadav-pu9nb 2 года назад +1

    same example is share by SCALER Academy by Ansuman..

  • @jinalpatel9154
    @jinalpatel9154 3 года назад +2

    Good explanation...specially analogy with ordering system. In context of CAP , there is one another concept going around PACELC. Hopefully going to see more detail in coming videos. :)

    • @sudocode
      @sudocode  3 года назад

      Thanks for sharing Jinal :)

  • @laterlater8348
    @laterlater8348 Год назад

    Writing this for those who are new to this topic and the video is a bit misleading. When one node is not present for consistency no request is honoured. But for availability even if one node is available then it available but the serving may not be consistent. As per your example if one partner does not take order then by virtue of CAP that order is served by the other person , end result is the client will get something but may not be what he ordered. So for property of availability even if one node is present then it is available but may not be consistent , here we are comprimising consistency (AP). For consistency all nodes must be present , that is the request is honoured only when all nodes are available, so even if one node is not present the request is not honoured there by we are compromising on availability (CP). Also the premise here is the system is distributed in nature and a Partition (P )has occured for reasons like network failure or node failure . Finally in case of no partition that is system completely healthy then we get both Consistency and Availability (CA)

    • @sudocode
      @sudocode  Год назад

      I would appreciate if you can mark the time stamp where wrong information is shared from my end. It will help me learn and also publish errata if something is actually wrong.

    • @laterlater8348
      @laterlater8348 Год назад

      @@sudocode I have replied to your other comment , you can get the time stamp there

  • @amadousallah8916
    @amadousallah8916 24 дня назад

    Thank you.

  • @subee128
    @subee128 2 месяца назад

    Thank you very much

  • @Quenchedfooty
    @Quenchedfooty Год назад

    Firstrate explanation 👌👌

  • @amantiwari9275
    @amantiwari9275 2 года назад

    Thanks a lot for such quality content

  • @sureshiva4605
    @sureshiva4605 Год назад

    HI...Why don't we hash the CustomerphoneNO or CustomerId while receiving order and send it to specific service for that hash...SO that data don't have to be consistent while taking orders...We can sync data in parallel if we need to be...

    • @sureshiva4605
      @sureshiva4605 Год назад

      We have to start with more services...We would be estimating in advance how many customers we would be serving(based on survery's) ....While customer's about to increase...we replicate data to more services with hashfunction( parllely with original system) a month in advance to more machines...and reboot Loadbalancer with new services+old service info...

  • @vaibhavvasani2401
    @vaibhavvasani2401 2 года назад

    very good explanation.. Thanks :)

  • @reshusingh6005
    @reshusingh6005 2 года назад

    Thank you so much for this Mam!!

  • @saumyasundaram2768
    @saumyasundaram2768 2 года назад

    check for CA (not very high because there could be network issues) AP CP

  • @bilaladoui5866
    @bilaladoui5866 6 месяцев назад

    I would say, it can be implemented but it's not guarantee , there will be always a possibility for a failure.

  • @jay-rathod-01
    @jay-rathod-01 3 года назад

    As requests increases in DS the load increases in which A with P is not possible , C without P is possible . C and A without P will only be a good choice.

    • @sudocode
      @sudocode  3 года назад +3

      C and A without P will only be a good choice. and if we have single server then there is no problem of consistency and partitioning - then it won't be a case of CAP theorem since it is applicable to only distributed systems. Besides, availability means a node being available in the system. It does not entails the capacity at which requests are being served. Refer these slides: www.researchgate.net/publication/221343719_Towards_robust_distributed_systems

    • @jay-rathod-01
      @jay-rathod-01 3 года назад +1

      Oh my bad.🤦

  • @harshsonigra3040
    @harshsonigra3040 3 года назад +1

    Nice❤️❤️

  • @maherbhavsar7420
    @maherbhavsar7420 2 года назад

    what if the order id is based on customer data like the phone number of customer, then both bar and foo will have consistent data, and if a customer places multiple orders, then we append the order id with _1, _2,... both at foo and bar ? can you please let me know

  • @nimishgupta8357
    @nimishgupta8357 2 года назад

    What if we keep a pub sub model, do we still need to care about partition tolerence?

  • @shreyasbhargava55
    @shreyasbhargava55 2 года назад

    very well explained

  • @risaromana7545
    @risaromana7545 3 года назад

    this was a great explanation! thank you :)

  • @tanveer.shaikh
    @tanveer.shaikh 2 года назад

    nicely explained

  • @pawankrishna8918
    @pawankrishna8918 2 года назад

    possibility is CAP, CP, AP is it true??

  • @ganeshaditya3042
    @ganeshaditya3042 3 года назад

    Thank you for your videos

    • @sudocode
      @sudocode  3 года назад

      Glad you like them!

  • @VijaySharma-hw4kv
    @VijaySharma-hw4kv 3 года назад

    C and A is possible in case of non-distributed(single instance of system handling everything) systems but not in distributed.

    • @sudocode
      @sudocode  3 года назад +2

      That's absolutely correct. CAP theorem talks about distributed systems. Refer page 4 in these slides - www.researchgate.net/profile/Eric_Brewer3/publication/221343719_Towards_robust_distributed_systems/links/09e41511a6f75c93ff000000.pdf

  • @RajVerma-mc2pj
    @RajVerma-mc2pj 3 года назад

    Awesome work .Pls start distributed systems series

    • @sudocode
      @sudocode  3 года назад

      We will, very soon :)

  • @kunalthorat3290
    @kunalthorat3290 3 года назад

    Ma'm after this video my curiosity levels are going very please kindly upload the next part of the video asap. Giving gratitude for ur excellent explaination skills that made me fall in love with system designs.

    • @sudocode
      @sudocode  3 года назад

      Thanks a lot Kunal. Next video will be up soon!

  • @santoshr4212
    @santoshr4212 Год назад

    Why we need partition?

  • @adityagarg9806
    @adityagarg9806 3 года назад

    how to handle that scenario if before replicating a particular data channel breaks?eg after writing to A then a will sync it to b but before that a fails?

    • @sudocode
      @sudocode  3 года назад +1

      The whole write is failed/rejected in that case.

  • @buzzword4433
    @buzzword4433 Год назад

    We can achieve only two of them at a time.

  • @channaveerhakari7319
    @channaveerhakari7319 2 года назад

    Hi, awesome video as always.
    If it's a monolithic database application then can we call that it's Highly Consistent and Highly Available?

    • @rohankulkarni6029
      @rohankulkarni6029 2 года назад +1

      If it's monolithic architecture, then I feel the system will be highly consistent, but there's also a risk of a single point of failure. If the database fails, the system is no longer available.

  • @shubhamdeshmukh9287
    @shubhamdeshmukh9287 Год назад

    W O W

  • @yogeshdixit8111
    @yogeshdixit8111 3 года назад

    maam where have you read such things !!
    i also want to read please suggest!

    • @sudocode
      @sudocode  3 года назад

      A video on books on system design is coming soon Yogesh!

  • @sushmitagoswami7320
    @sushmitagoswami7320 3 года назад +1

    I think only possible combinations would be
    1. CA - partially.
    2. AP
    3. CP

  • @shridhar_rao
    @shridhar_rao 2 года назад

    ♥️🌠🎆

  • @shivamojha7999
    @shivamojha7999 3 года назад

    Ma'am please make videos of system design of facebook, twitter etc.

    • @sudocode
      @sudocode  3 года назад +1

      We will in the future Shivam. 🙂

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd 3 года назад

    Thanks a lot for such an amazing video. Request you to please upload video on like Facebook messager, New Feed , Uber , etc full system design video. Thanks a lot for your effort and hard work to deliver this kind of informative contents. :)

    • @sudocode
      @sudocode  3 года назад +1

      Sure I will. Thanks a lot for appreciation!

  • @sanathmugeraya6061
    @sanathmugeraya6061 3 года назад

    Great work Madam . Pls start low level design in java from scratch . Like ticket booking system etc .

    • @sudocode
      @sudocode  3 года назад

      Thanks Sanath. Will try!

  • @himanshushekhardas1730
    @himanshushekhardas1730 9 месяцев назад

    no cap

  • @myLifeSk98
    @myLifeSk98 2 года назад

    #50k soon ❤️ sudocode thanks

  • @asjjain191183
    @asjjain191183 3 года назад

    You are so beautiful, its really difficult to concentrate on the technical thinks :)