2. CAP Theorem | High Level Design for Beginners | CAP Partition Tolerance explained

  Рет қаралды 38,024

Concept && Coding - by Shrayansh

Concept && Coding - by Shrayansh

2 жыл бұрын

I have explained what is CAP theorem and what all possible combination we can use and when to use which property.
➡️ Join this channel to get access to member only perks:
/ @conceptandcoding

Пікірлер: 105
@gaming_with_ajey
@gaming_with_ajey Жыл бұрын
Partition Tolerance is : System is up and running Even If there is some network partition among nodes. that means, system is able to tolerate partition. Hence partition Tolerant.
@abhishekvithal8060
@abhishekvithal8060 Жыл бұрын
@Concept && Coding Is this correct ??
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Correct
@nitink8148
@nitink8148 Жыл бұрын
You have explained it in a far better manner than many utubers!
@ConceptandCoding
@ConceptandCoding Жыл бұрын
thank you
@kirtisingh2955
@kirtisingh2955 Ай бұрын
Legit I just switching between your playlist from java to spring to SD. Great effort!!
@RG-ed3lv
@RG-ed3lv 2 жыл бұрын
thanks !! waiting for more and more uploads in this playlist!
@prateekjain8374
@prateekjain8374 Жыл бұрын
sir u have explained it so well.. that even if somebody ask me about CAP... I can now clear his/her concept on CAP
@ConceptandCoding
@ConceptandCoding Жыл бұрын
thank you
@geekydanish5990
@geekydanish5990 Жыл бұрын
Thanks awsome explaination keep posting more !!!
@anshu-littlebitofeverythin21
@anshu-littlebitofeverythin21 2 жыл бұрын
You explained the concept very well. Keep doing it. Thanks for sharing knowledge
@ConceptandCoding
@ConceptandCoding 2 жыл бұрын
thank you
@nileshkumarvishwakarma
@nileshkumarvishwakarma Жыл бұрын
time kab jata hai pta hi nhi chlta, you got teaching skills man hatsoff!!
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thank you very much for the feedback
@TarunJain-is1im
@TarunJain-is1im Жыл бұрын
Best explanation found ever. Thanks!
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Glad it was helpful!
@swapnilsaxena81
@swapnilsaxena81 Жыл бұрын
Sir, you have explained this so well !!
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thank
@abhishek-94
@abhishek-94 3 ай бұрын
Hi, in the 3rd example when the system itself is down(so it is not partition tolerant), we only have consistency but we don't have availability either(so it is not CA)
@SaritBurman
@SaritBurman Ай бұрын
Same thought here
@subhamacharya4472
@subhamacharya4472 Жыл бұрын
Thanks for this explanation 🙂
@heroChaddi
@heroChaddi 8 ай бұрын
Bro CA m agar tumne poore system ko hi down kar diya toh phir yeh system ko CA kyu bol rhe, yaar availability bhi toh band kardi system down krke??!!
@LearnGrow-wd1en
@LearnGrow-wd1en Жыл бұрын
Well Explained , this concept is a bit hard to understand . With your examples it was super easy to digest. Thanks
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thanks
@ishitaamod5109
@ishitaamod5109 9 ай бұрын
very nicely explained!
@dhruvpurwar6642
@dhruvpurwar6642 Жыл бұрын
Great one!!
@vamsikrishna_16
@vamsikrishna_16 6 ай бұрын
Great Explaination
@skillupshivam
@skillupshivam Жыл бұрын
preparing for interview, this is very very helpfull for me, thank you so much for creating this playlist and video.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thanks
@kalravsharma178
@kalravsharma178 Жыл бұрын
Best explanation!!
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thank you
@tarunkundhiya5196
@tarunkundhiya5196 11 ай бұрын
Great explanation!! The key point that other videos don't tell: Partition Tolerant: Whether the system is able to take requests in case of some network failure in the system. The second thing Availability can be confused with the above definition "If the system is not taking requests how we are achieving availability?' This thing is confusing (individual DB nodes are available but the system itself is not) the A in CAP theorem is talking about whose availability of DB nodes or the system itself. This is confusing. What do you think about this ? how to clear up this concept?
@vigupta-uq1pn
@vigupta-uq1pn 9 ай бұрын
same doubt :\
@ayushshshsh
@ayushshshsh 2 ай бұрын
same doubt
@programmershub3887
@programmershub3887 Жыл бұрын
best explaination
@buntykumar7270
@buntykumar7270 Ай бұрын
Good explaination
@ramijsardar6678
@ramijsardar6678 11 ай бұрын
Great Explanation,
@ConceptandCoding
@ConceptandCoding 11 ай бұрын
Thank you
@chauhansingh7797
@chauhansingh7797 Жыл бұрын
really great
@ConceptandCoding
@ConceptandCoding Жыл бұрын
thank you
@Mohnishagrawal-zl9ke
@Mohnishagrawal-zl9ke 10 күн бұрын
Can you few ways in which CAP theorem is somewhat mitigated in the real work such as using QUORUM consensus, etc..
@jeetendragarg7718
@jeetendragarg7718 3 ай бұрын
Very well explained
@ConceptandCoding
@ConceptandCoding 3 ай бұрын
thanks
@kushagrabajpai7944
@kushagrabajpai7944 23 күн бұрын
So if System is down will it be considered under CA and vice versa?? btw thanks a lot for this great lecture!!
@SapnaKumari-bm7mn
@SapnaKumari-bm7mn Жыл бұрын
please share the rough worksheet it is very helpfull.
@AbheyBhatia
@AbheyBhatia 2 ай бұрын
Please explain with examples stating which DBs are supported in each case and why? Thanks
@ConceptandCoding
@ConceptandCoding 2 ай бұрын
sure
@bobbysadhwani991
@bobbysadhwani991 7 ай бұрын
Great Explanation bhaiya but, in absence of Partial Tolerance, the combination is Consistency & Availability which means a system is not up and running but it is consistence & avalaible. How it is possible?
@ConceptandCoding
@ConceptandCoding 7 ай бұрын
Yes it's (CA) is not possible in distributed systems it's hypothetical.
@kishorkshirsagar1163
@kishorkshirsagar1163 Ай бұрын
at 15:04 ( You said if there is a partition ) you should have said if there is breakdown
@sarthakbhatia7639
@sarthakbhatia7639 11 ай бұрын
Understood
@pritammohapatra876
@pritammohapatra876 9 ай бұрын
Why are you not using CQRS pattern with messages brokers?
@harishaseri
@harishaseri Жыл бұрын
Hi , I have quick doubt. When we want to achieve CA so we cant have partition tolerance . so you said that we have to take down the whole system(may be i have misunderstood this) . so in that case we have loss Availability right . so now system is not CA itself . please correct me if i am wrong
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Let me try to explain: When we choose "CA" , what we assume that Partition can not even happen in the system. And if partition can not happen, then only thing left is CA. But if Partition happened, means our assumption is false, then we can not choose CA, then we have to choose CP or AP. So CA, can exist in a non distributed world (with a single DB) where never partion can happen.
@sushil1922
@sushil1922 11 ай бұрын
@@ConceptandCoding understood
@rambeersharma2091
@rambeersharma2091 Жыл бұрын
Very nice but please explain the partition in details
@gurupreetsingh8347
@gurupreetsingh8347 8 ай бұрын
Hey at the length of 16:35, u explain how we can achieve CA without P by down the whole system whenever P occurs just to maintain the C but in this case System is also not available that means we couldn't not achieve A too and at the end we only got achieved C , right ? in the use case of CA system should available to o right ? can you explain it ? , I don't understand how we achieved A here even though our system is down
@rahulbhatt8583
@rahulbhatt8583 8 ай бұрын
For a application to be distributed, it has to support Partition Tolerance, either compromising consistency or availability. A distributed system having CA property is hypothetical and it cannot exist in real world examples. What he means is we can achieve CA without P, by having only one server(then no distributed application). CP - Banking system need consistency so they block all the write operation if any of the node fails, thus system is unavailable, (to provide C and P) AP - Application compromises on Consistency and user can see two different values of a same variable. (to provide A and P) CA - No Partition tolerance at all, means there is only one server, which always have a fresh copy and no need of replication to any nodes, hence not a distributed system. (to provide C and A)
@OMPRAKASH-fh3so
@OMPRAKASH-fh3so 3 ай бұрын
Is availiablity means all the node sholud be respond or the system is availabe in case of failure?
@ConceptandCoding
@ConceptandCoding 3 ай бұрын
availability means a distributed system can continue operating and responding to requests, even if some nodes are failing. It doesn't require all nodes to be responsive simultaneously but focuses on the overall system's ability to remain functional during failures.
@harishaseri
@harishaseri 11 ай бұрын
I have quick question regarding above lecture . right now it is not that we are just having distributed databases only , now days we have distributed application as well(like KZbin or insta) . I mean we have multiple servers or app servers . how does the CAP Theorem can be applied here . because here consistency concept is not applicable . may be partition tolerance we can apply . so basically here we can only think of AP only right ? I am not sure if my question is clear to you or not . In simple terms , how can we apply CAP Theorem on Distributed Application(not database application) ?
@ConceptandCoding
@ConceptandCoding 11 ай бұрын
See even we have distributed app server but database is not distributed (let's say it's centralised) then CAP can be applied and if we see, out system is only C not fulfilling AP. And if we have distributed database, irrespective whether we have distributed app server or not, then again CAP theorem can be applied and whatever we discussed in the video that is applicable.
@TanuKansal-nn4el
@TanuKansal-nn4el 3 ай бұрын
Hi sir, I have a doubt, In case of CP, As you told,,, user doesn't know which db node it is requesting,,, even if A gets down user can still request for data,,, and it will get response from B also. So can't we say in this case there is availability of system?
@ConceptandCoding
@ConceptandCoding 3 ай бұрын
in a CP system, if node A goes down after processing a request and another request comes in, the system relies on the remaining available nodes (like B) to handle the request. The system ensures that B has the necessary data by either replicating the data from A to B before A goes down (as its following Consistency). So we can say with CP, availability get reduced a bit
@arimardanyadav4500
@arimardanyadav4500 28 күн бұрын
### **Introduction:** - Discusses the concept of CAP Theorem (Consistency, Availability, Partition Tolerance) and its relevance in distributed systems. - Emphasizes the importance of considering CAP constraints early in system design to avoid costly changes later. ### **CAP Theorem:** - **CAP:** Stands for Consistency, Availability, Partition Tolerance. - **Desired Properties of Distributed Systems:** These three properties are desirable in a distributed system. - **CAP Trade-off:** You cannot have all three properties simultaneously. You must choose two out of the three. - **Example:** - Consider a distributed database with nodes in India and the US. - A user's data is replicated across both locations. - A distributed system should ideally be consistent (same data everywhere), available (responding to requests), and tolerant to partitions (network disruptions). ### **Understanding Each Property:** - **Consistency:** Ensures that all nodes have the same, up-to-date data at any given time. - **Availability:** Guarantees that every request is successfully processed by at least one node. - **Partition Tolerance:** Allows the system to continue functioning even if communication between nodes is disrupted. ### **Why CAP Properties Cannot Co-Exist:** - **Case 1: CA (Consistency and Availability) - Not possible with Partition Tolerance** - **Scenario:** A partition occurs, separating nodes A and B. - **Conflict:** Node A writes updated data, but node B cannot access it due to the partition. - **Result:** Inconsistency between nodes. - **Case 2: CP (Consistency and Partition Tolerance) - Not possible with Availability** - **Scenario:** A partition occurs, separating nodes A and B. - **Strategy:** To maintain consistency, only one node (A) is allowed to process writes. - **Result:** Node B becomes unavailable for writes during the partition. - **Case 3: AP (Availability and Partition Tolerance) - Not possible with Consistency** - **Scenario:** A partition occurs, separating nodes A and B. - **Strategy:** To maintain availability, both nodes can process writes. - **Result:** Potential for inconsistent data between nodes. ### **CAP Trade-off in Real-world Systems:** - **Importance of Partition Tolerance:** In today's distributed systems, network disruptions are common. - **Choosing between CP and AP:** - **CP:** Choose this option for systems where consistency is critical, even if it means some temporary downtime. - **AP:** Choose this option for systems where availability is paramount, even if it means some data inconsistency. ### **Key Takeaways:** - **Understanding CAP is crucial for effective distributed system design.** - **Early consideration of CAP constraints can prevent costly changes later.** - **The choice between CP and AP depends on the specific needs of your system.** - **Partition tolerance is a key factor in modern distributed systems.**
@apurvaagrawal2384
@apurvaagrawal2384 8 ай бұрын
I have a doubt...i know there would be flaw in it...please try and answer... I think all 3 are possible, If A updates B, C together always, there is no connection between B and C. So it is partition tolerant as if B and C connection breaks no effect, consistent becoz A is updating B and C so data will be same there, And available because both nodes will be available
@ConceptandCoding
@ConceptandCoding 8 ай бұрын
Nope, can you tell how Application will write in B and C together? Is it possible? If yes, then how?
@tejeswarpala2841
@tejeswarpala2841 Жыл бұрын
Great explanation. but not so great audio. : -)
@ConceptandCoding
@ConceptandCoding Жыл бұрын
All latest videos are made from new mic, so i have improved this part tejeswar
@kumarnishchay9065
@kumarnishchay9065 Жыл бұрын
Can i get the notes and the materials that you are making in this KZbin videos ?
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Hi, sorry i did not saved it but will do from future
@shantanumapari6679
@shantanumapari6679 9 ай бұрын
I did not understand how system achieves CP?
@ConceptandCoding
@ConceptandCoding 9 ай бұрын
This concept mostly resolved through DB design
@AnkushJaswals
@AnkushJaswals Жыл бұрын
20-05-2023 Thanks.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
thanks
@AnkushJaswals
@AnkushJaswals Жыл бұрын
@@ConceptandCoding Hi Today I booked 1:1 session with you on topmate. It is scheduled for 8-8:30 today. 22-5-2023
@AnkushJaswals
@AnkushJaswals Жыл бұрын
You didn't joined. I hope everything is ok at end.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
@@AnkushJaswals oops i missed it. Let me reschedule it
@AnkushJaswals
@AnkushJaswals Жыл бұрын
@@ConceptandCoding Thanks.
@rekhavs9547
@rekhavs9547 6 ай бұрын
Sir, can these videos in future be in English?
@ConceptandCoding
@ConceptandCoding 6 ай бұрын
I will add captions to these hindi videos
@rekhavs9547
@rekhavs9547 6 ай бұрын
Thanks sir@@ConceptandCoding
@Rock28099
@Rock28099 3 ай бұрын
I have one doubt. CA- here if network parition has happened then the system will shut down. Hence we indirectly compromise the AVAILABLITY too. Correct? Similary, In CP, if network parition happens then the system remains up therefore indirectly we are achieving the AVAILABLITY. Isn’t it??
@amritsatapathy7820
@amritsatapathy7820 2 ай бұрын
In CP, we cannot achieve AVAILABLITY because we will have to down the nodes without latest data (otherwise system will reflect different data since the nodes could not be updated due to parttion in system.). If we dont , we cannot achieve Consistency.(same data in all nodes) As for CA, a distributed system having CA property is hypothetical. It cannot exist in real world. We can achieve CA without P, by having only one node (meaning one node, no replicas, so we dont have a distributed system). Hope this helps !
@Rock28099
@Rock28099 2 ай бұрын
@@amritsatapathy7820thanks, bro. But the system following CP doesn’t go down na. Isn’t it? Shreyansh also said the same. If the system is the following Partitioning then when Network partitioned happens the system breaks into two partitions where devices in partition 1 can communicate and send data to each other and the same with devices in network partition 2 but if some devices from partition. 1 tries to communicate with the device of partition 2 then there will be a delay because the network partitione happened. If the system follows consistency and Partitioning and then still goes down then what is the meaning of following up?
@amritsatapathy7820
@amritsatapathy7820 2 ай бұрын
​@@Rock28099 Yes bro, the overall system will not go down, but the nodes/devices in partition 2 will be down or specifically, they are shut down so that no requests are served by those nodes and system is kept CONSISTENT. (because if not, they will give diiferent data violating Consistency). So, during this time, if any requests are going to devices of partiton2, we may/may not get a response. Here , the Availablity then gets violated.
@Rock28099
@Rock28099 2 ай бұрын
@@amritsatapathy7820 thanks bro… all clear now
@ravikumar-lg3yn
@ravikumar-lg3yn Жыл бұрын
Please try to give explanation in English
@ConceptandCoding
@ConceptandCoding Жыл бұрын
sure Ravi
@amazing_quotes7432
@amazing_quotes7432 Жыл бұрын
I cannot access ur java tutorials?
@ConceptandCoding
@ConceptandCoding Жыл бұрын
It's for channel members buddy
@amazing_quotes7432
@amazing_quotes7432 Жыл бұрын
@@ConceptandCoding how can i be a member?
@ConceptandCoding
@ConceptandCoding Жыл бұрын
@@amazing_quotes7432 pls check out the first video, i have shared the process buddy kzbin.info/www/bejne/fZaqaWxrh5p4qrc
@dpynsnyl
@dpynsnyl 10 ай бұрын
the explanation is a bit clouded.
@ConceptandCoding
@ConceptandCoding 10 ай бұрын
Sorry for that, pls do comment what is not clear, i will try to answer that
@shreyashs
@shreyashs Жыл бұрын
Bro its wrong....AC is not possible. For that PACELC is introduced
@ConceptandCoding
@ConceptandCoding Жыл бұрын
It is possible. PACELC is just an extension of CAP by introduction of Latency. But it never says it is introduced because AP is not possible. That's my view but we can discuss more on this.
@krishnachaitanya9986
@krishnachaitanya9986 Жыл бұрын
PACELC is introduced for a use case of Partition itself is not available in a distributed system(DS), then it can choose between Latency and Consistency. 1. Partition is available in DS, it can trade off between Consistency and Availability 2. System is running with out partition, it can trade off between Latency and Consistency So it reverses CAP theorem with PAC and adds else condition for Latency and Consistency, so the name PACELC (Partitioned Availability Consistency Else Latency Consistency)
@ConceptandCoding
@ConceptandCoding Жыл бұрын
@@krishnachaitanya9986 thanks Krishna. Very nicely explained the PACELC
@krishnachaitanya9986
@krishnachaitanya9986 Жыл бұрын
Thank you and kudos to your effort 🙏
@adityajaiswal3943
@adityajaiswal3943 9 күн бұрын
Stop replying to only the good comments with the "thank you" BS. Reply to the actual questions of the users!!
@rhythmjayee9707
@rhythmjayee9707 Жыл бұрын
Reach++
My thoughts on the CAP theorem
17:33
Hussein Nasser
Рет қаралды 24 М.
Which one of them is cooler?😎 @potapova_blog
00:45
Filaretiki
Рет қаралды 10 МЛН
UFC Vegas 93 : Алмабаев VS Джонсон
02:01
Setanta Sports UFC
Рет қаралды 195 М.
1❤️#thankyou #shorts
00:21
あみか部
Рет қаралды 88 МЛН
Balloon Stepping Challenge: Barry Policeman Vs  Herobrine and His Friends
00:28
What is CAP theorem in Hindi ?
10:12
Engineering Digest
Рет қаралды 17 М.
CAP Theorem - From the First Principles
42:42
Arpit Bhayani
Рет қаралды 22 М.
CAP Theorem Simplified
5:33
ByteByteGo
Рет қаралды 126 М.
Which one of them is cooler?😎 @potapova_blog
00:45
Filaretiki
Рет қаралды 10 МЛН