Skip to content

Commit

Permalink
[Add]: CAP Theorem
Browse files Browse the repository at this point in the history
  • Loading branch information
omjogani committed Jan 10, 2024
1 parent 8bc13e5 commit b0f5d69
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 13 deletions.
26 changes: 13 additions & 13 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
70 changes: 70 additions & 0 deletions _posts/2023-10-05-cap-theorem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: CAP Theorem
date: 2023-10-05 10:00:00 -500
categories: [database]
tags: [cap,essentials]
---

# CAP Theorem

<!-- Image 1 -->

→ 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.

<!-- Image of CAP -->

→ 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.

###

0 comments on commit b0f5d69

Please sign in to comment.