From b0f5d69cab39773eb40e71d6292449bcc472bba3 Mon Sep 17 00:00:00 2001 From: Om Jogani Date: Wed, 10 Jan 2024 17:11:41 +0530 Subject: [PATCH] [Add]: CAP Theorem --- _config.yml | 26 ++++++------ _posts/2023-10-05-cap-theorem.md | 70 ++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 13 deletions(-) create mode 100644 _posts/2023-10-05-cap-theorem.md diff --git a/_config.yml b/_config.yml index d68f3bd..e52eac1 100644 --- a/_config.yml +++ b/_config.yml @@ -9,40 +9,40 @@ theme: jekyll-theme-chirpy lang: en # Change to your timezone › https://kevinnovak.github.io/Time-Zone-Picker -timezone: +timezone: Asia/Calcutta # jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md # ↓ -------------------------- -title: Chirpy # the main title +title: Om Jogani # the main title -tagline: A text-focused Jekyll theme # it will display as the sub-title +tagline: Crafting the world with Software Engineering # it will display as the sub-title description: >- # used by seo meta and the atom feed - A minimal, responsive and feature-rich Jekyll theme for technical writing. + Blogs & Learning of different technologies all wrapped at one place - @omjogani # Fill in the protocol & hostname for your site. # e.g. 'https://username.github.io', note that it does not end with a '/'. -url: "" +url: "https://blog-omjogani.github.io" github: - username: github_username # change to your github username + username: omjogani # change to your github username twitter: - username: twitter_username # change to your twitter username + username: omjoganii # change to your twitter username social: # Change to your full name. # It will be displayed as the default author of the posts and the copyright owner in the Footer - name: your_full_name - email: example@domain.com # change to your email address + name: Om Jogani + email: om080jogani@gmail.com # change to your email address links: # The first element serves as the copyright owner's link - - https://twitter.com/username # change to your twitter homepage - - https://github.com/username # change to your github homepage + - https://twitter.com/omjoganii # change to your twitter homepage + - https://github.com/omjogani # change to your github homepage # Uncomment below to add more social links # - https://www.facebook.com/username - # - https://www.linkedin.com/in/username + - https://www.linkedin.com/in/omjogani google_site_verification: # fill in to your verification string @@ -73,7 +73,7 @@ theme_mode: # [light|dark] img_cdn: # the avatar on sidebar, support local or CORS resources -avatar: +avatar: https://github.com/omjogani.png # boolean type, the global switch for TOC in posts. toc: true diff --git a/_posts/2023-10-05-cap-theorem.md b/_posts/2023-10-05-cap-theorem.md new file mode 100644 index 0000000..57ee761 --- /dev/null +++ b/_posts/2023-10-05-cap-theorem.md @@ -0,0 +1,70 @@ +--- +title: CAP Theorem +date: 2023-10-05 10:00:00 -500 +categories: [database] +tags: [cap,essentials] +--- + +# CAP Theorem + + + +→ Any Database can either achieve CA, CP or AP, but it can not achieve all three of them. + +→ Most Famous NoSQL Databases + +→ HBase - CP + +→ MongoDB - CP + +→ Cassandra - AP + +### Why NoSQL Databases can’t achieve CA, CP, AP all? + +→ Not any NoSQL Database will comes under CA, Now the question is why? that’s because It is RDBMS. CA has no clue how to partitioning the data. + +→ If any product is able to achieve all three of them that means the product is using multiple databases in order to achieve CA, CP and AP. + +→ Most of All the NoSQL databases uses a concept called Replication of block. + +→ Consider you have data and with help of replication it is available at 3 different places. + + + +→ at 8:30 AM you are updating data and all the replicas needs to be updated. + +→ Suppose you are requesting data at the time second replicas is getting update and unfortunately your request goes to second replicas. + +→ Now the problem is you received wrong result (Previous Value). That’s why all CP, CA, AP can’t be achievable by NoSQL Databases. + +# What is Cassandra? + +→ It’s a NoSQL Database. + +→ Amazon DynamoDB + Google Big Table = Cassandra + +→ For communication with Cassandra we use CQL (Cassandra Query Language). It has CQLSH shell similar to mongo shell. + +→ Built in JAVA & Cassandra Shell built in Python + +→ In Cassandra databases is called keyspaces + +→ Each node of Cassandra may contain 2 - 4 TB of Data + +### Cassandra Peer to Peer | Types of Nodes + +- Advantage of Peer to Peer + - Single Point of Communication + - Single Point of Failure + + If any node goes down other will get to know about it. Each and every node will share heart bit to other nodes. + +- Types of Nodes + - Cassandra Node + - All the node available in a cluster + - Co-Ordinator Node + - In Cassandra each and every node can handle read and write request. + - The Node that can take care of READ or WRITE request is called Co-Ordinator Node. + - One node can handle one or more request. + +### \ No newline at end of file