Explore Courses
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Birla Institute of Management Technology Birla Institute of Management Technology Post Graduate Diploma in Management (BIMTECH)
  • 24 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Popular
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science & AI (Executive)
  • 12 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
University of MarylandIIIT BangalorePost Graduate Certificate in Data Science & AI (Executive)
  • 8-8.5 Months
upGradupGradData Science Bootcamp with AI
  • 6 months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
OP Jindal Global UniversityOP Jindal Global UniversityMaster of Design in User Experience Design
  • 12 Months
Popular
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Rushford, GenevaRushford Business SchoolDBA Doctorate in Technology (Computer Science)
  • 36 Months
IIIT BangaloreIIIT BangaloreCloud Computing and DevOps Program (Executive)
  • 8 Months
New
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Popular
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
Golden Gate University Golden Gate University Doctor of Business Administration in Digital Leadership
  • 36 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
Popular
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
Bestseller
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
IIIT BangaloreIIIT BangalorePost Graduate Certificate in Machine Learning & Deep Learning (Executive)
  • 8 Months
Bestseller
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in AI and Emerging Technologies (Blended Learning Program)
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
ESGCI, ParisESGCI, ParisDoctorate of Business Administration (DBA) from ESGCI, Paris
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration From Golden Gate University, San Francisco
  • 36 Months
Rushford Business SchoolRushford Business SchoolDoctor of Business Administration from Rushford Business School, Switzerland)
  • 36 Months
Edgewood CollegeEdgewood CollegeDoctorate of Business Administration from Edgewood College
  • 24 Months
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with Concentration in Generative AI
  • 36 Months
Golden Gate University Golden Gate University DBA in Digital Leadership from Golden Gate University, San Francisco
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Deakin Business School and Institute of Management Technology, GhaziabadDeakin Business School and IMT, GhaziabadMBA (Master of Business Administration)
  • 12 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science (Executive)
  • 12 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityO.P.Jindal Global University
  • 12 Months
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (AI/ML)
  • 36 Months
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDBA Specialisation in AI & ML
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
New
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGrad KnowledgeHutupGrad KnowledgeHutAzure Administrator Certification (AZ-104)
  • 24 Hours
KnowledgeHut upGradKnowledgeHut upGradAWS Cloud Practioner Essentials Certification
  • 1 Week
KnowledgeHut upGradKnowledgeHut upGradAzure Data Engineering Training (DP-203)
  • 1 Week
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
Loyola Institute of Business Administration (LIBA)Loyola Institute of Business Administration (LIBA)Executive PG Programme in Human Resource Management
  • 11 Months
Popular
Goa Institute of ManagementGoa Institute of ManagementExecutive PG Program in Healthcare Management
  • 11 Months
IMT GhaziabadIMT GhaziabadAdvanced General Management Program
  • 11 Months
Golden Gate UniversityGolden Gate UniversityProfessional Certificate in Global Business Management
  • 6-8 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
IU, GermanyIU, GermanyMaster of Business Administration (90 ECTS)
  • 18 Months
Bestseller
IU, GermanyIU, GermanyMaster in International Management (120 ECTS)
  • 24 Months
Popular
IU, GermanyIU, GermanyB.Sc. Computer Science (180 ECTS)
  • 36 Months
Clark UniversityClark UniversityMaster of Business Administration
  • 23 Months
New
Golden Gate UniversityGolden Gate UniversityMaster of Business Administration
  • 20 Months
Clark University, USClark University, USMS in Project Management
  • 20 Months
New
Edgewood CollegeEdgewood CollegeMaster of Business Administration
  • 23 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
KnowledgeHut upGradKnowledgeHut upGradBackend Development Bootcamp
  • Self-Paced
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 5 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
upGradupGradUI/UX Bootcamp
  • 3 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
upGradupGradDigital Marketing Accelerator Program
  • 05 Months

Cassandra Architecture Explained: A Comprehensive Tutorial

Updated on 23 November, 2022

5.61K+ views
7 min read

Since its inception at Facebook, Cassandra has become one of the most popular Apache projects. It is a widely-used open-source, high performance and distributed database and makes the lives of software engineers, data scientists, and web developers easier. 

The users of this robust database solution include the likes of IBM, Facebook, Reddit, eBay, and Twitter.  

However, to get familiar with Cassandra, you must know about its architecture and Apache Cassandra architecture can be a little tricky to understand. 

That’s why we have created the following introductory guide on Cassandra architecture. It will make you familiar with all the necessary concepts of Cassandra architecture:

Basics of Cassandra Architecture

The Apache Cassandra architecture has no master or slave nodes. Instead, it has a ring-like architecture where the nodes are logically distributed in a ring. The architecture allows data to be distributed automatically across all nodes. Like HDFS, data in Cassandra gets replicated across the nodes for redundancy and is stored in memory. It uses the hash values of the keys to distribute data among the nodes in the cluster. 

The Cassandra architecture allows the system to function irrespective of a single point of failure. This means if a cluster has a hundred nodes and one of them fails, the cluster would still be running. On the other hand, with Hadoop, the failure of a namenode would fail the entire system. 

Cassandra architecture offers high scalability so a cluster can even have thousands of nodes. Moreover, you can add a new node to a cluster without interrupting its operations. 

Apart from the features, we discussed above, Apache Cassandra architecture also supports multiple data centres and enables data replication across data centres. 

Topology and Design

Cassandra architecture is based on a distributed system architecture. The simplest version of Cassandra can run on one machine and work well with basic testing. One Cassandra instance is called a node. 

Cassandra offers horizontal scalability where you can add more than one node as a component of a cluster. It works with peer to peer architecture where each node is connected to every other node. Every Cassandra node performs all database operations and servers client requests without a master node. 

This peer-to-peer distributed architecture ensures that a single point of failure doesn’t cause the entire system to fail. Clusters in Cassandra can communicate with each other for numerous functions. The following concepts are vital for such communication:

Gossip

Gossip is a Cassandra protocol its nodes use for peer-to-peer communication. It informs a node about the other nodes’ states. Every second, one node performs gossip with up to three other nodes and every gossip message follows specific formats and version numbers to keep the communication efficient. 

Seeds

Every node in Cassandra configures a list of seeds which is a list of other nodes. A seed node doesn’t have any purpose other than bootstrapping a node when it first joins a cluster. After bootstrap, a node doesn’t require a seed on restarting. It’s best to use two or three seed nodes per Cassandra data centre and keep the seeds list uniform.  

Database Structure

In Cassandra, data is stored in tables where every table is organized into rows and columns. Moreover, tables in Cassandra are grouped in keyspaces such as tables on customer data can all be grouped in one keyspace while tables on business transactions can be stored in another.

Every table has a primary key which is divided into clustering columns and partition key. Note that the clustering columns are optional. Cassandra uses the partition key to index the data. All the rows with a common partition key constitute one data partition, the basic unit for data partitioning. 

Partitioning in Cassandra

In Cassandra, a partitioner converts partition keys into tokens. There are multiple partitioner options present in Cassandra where the Murmur3Partitioner is the default. Every token is assigned an integer value between -2^63 to +2^63-1, and the name of this range is the token range. 

Every Cassandra owns a part of this range and it mainly possesses data related to the range. We use a token to locate the data precisely among the nodes. 

You can understand the ownership system with this concept: If a cluster has only one node then that node would own the complete token range. With the addition of more nodes, the token range ownership would get split accordingly.

 

Virtual Nodes

Cassandra simplifies the token calculation and assignment challenges by using virtual nodes, also known as Vnodes. 

It divides a cluster into numerous virtual nodes to assign tokens and every physical node gets an equal quantity of Vnodes. The default number of Vnodes owned by a node is 256. You can set the same by using the num_tokens property. When you add a new node to a cluster, the token allocation algorithm would allocate the required tokens by using the Vnodes. 

Replication

Cassandra replicates the data present in every keyspace with a replication factor. One primary replica of the data remains with the token owner node while the rest are placed by Cassandra on particular nodes through its replica placement strategy. Note that all replicas have equal importance for most database operations. 

Two settings affect replica placement in Cassandra, which are snitch and the replication strategy. Snitch determines the data centre and the rack a node belongs to. They are responsible for informing Cassandra about the topology for keeping things efficient.

The replication strategy is set at the keyspace level and there are two of them: NetworkTopologyStrategy and simple strategy. The former is a rack and data centre aware while the latter is not. 

CAP Theorem

Every distributed system works based on the CAP theorem. According to this theorem, any distributed system can properly deliver any two out of the three properties, Consistency, Availability, and Partition-tolerance. 

In Cassandra, you can choose between availability and consistency. This means the data can either be highly consistent with lower availability or highly available with low consistency. 

The concept of requesting a specific number of acknowledgements is called tunable consistency and you can apply it at the individual query level. 

Write Process

In this process, the data is written to a comment log on a disk and then sent to a responsible node according to the hash value. 

After that, nodes write data to an in-memory table called memtable from where the data is written to a “sstable” in memory. Next, it gets updated to the actual table. 

If the responsible node is down for some reason, the data gets written to another node.

Learn More About the Cassandra Architecture

Understanding Apache Cassandra architecture would help you understand how this solution works. By now, you also know why Cassandra stands out in the competition and why it’s so popular. 

If you’re interested in learning more about databases, you can check out the following resources:

SQL for Data Science: Why SQL, List of Benefits & Commands

20 Most Common SQL Interview Questions & Answers [For Freshers]

SQL Free Online Course with Certificate [2022-23]

On the other hand, if you’re looking for a personalized learning experience, we recommend taking a data science course. At upGrad, we offer a PG Diploma in Data Science and a Master of Science in Data Science. These courses will teach you all the necessary skills to become a data science professional. 

Conclusion 

If you are interested to know more about Big Data, check out our Advanced Certificate Programme in Big Data from IIIT Bangalore.

Check our other Software Engineering Courses at upGrad.

Frequently Asked Questions (FAQs)

1. What are clusters in Cassandra?

A cluster is a group of nodes that together form a single system. Cassandra clusters are one of the shells that make up the Cassandra database as a whole. A cluster is essentially a database's exterior shell or storage unit. Cassandra clusters are made up of many storage levels. Each layer is made up of layers that are themselves made up of layers. The database's primary data source is always a cluster. Users can start the Cluster Builder by issuing a series of instructions. It enables users to do a variety of detailed actions on a cluster as it is being created.

2. What makes the Gossip protocol important in Cassandra?

In Cassandra, the Gossip Protocol is a peer-to-peer communication protocol that allows nodes to select whom they wish to share their state information with. The nodes share information regarding themselves and the other nodes about whom they have gossiped or communicated, allowing all nodes in the cluster to learn very quickly about each other. In the Gossip protocol, the technique of acknowledging messages aids in failure detection. Because a node can't transmit or receive information when it is down or failing, acknowledgements are not accepted.

3. What are the benefits of Cassandra?

Cassandra has several advantages. To begin with, the most significant benefit of using Apache Cassandra is its elastic scalability, which allows a large number of servers to be added and the cluster to be scaled up and down as needed. Second, because Cassandra is an Apache software, it is open source, which means it is absolutely free to use. For execution, Cassandra uses a peer-to-peer architecture, which implies that all servers are on the same level, and any computer may respond to a client request. As a result, there are only a few opportunities for failure. It encrypts the data and distributes it across different servers. If one server goes down or is hacked, the user may easily get the data from another location.