{"id":16601,"date":"2021-09-22T16:27:01","date_gmt":"2021-09-22T10:57:01","guid":{"rendered":"http:\/\/ismiletechnologies.com\/?p=16601"},"modified":"2021-10-06T20:44:03","modified_gmt":"2021-10-06T15:14:03","slug":"an-overview-of-cassandra-architecture","status":"publish","type":"post","link":"https:\/\/ismiletechnologies.com\/en_us\/technology\/an-overview-of-cassandra-architecture\/","title":{"rendered":"An Overview of Cassandra Architecture"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Apache Cassandra<\/strong>&#8211; a name synonymous with availability, reliability and scalability is a NoSQL database with a unique architecture. Let\u2019s delve a little deeper into what the architecture of Cassandra comprises of&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Cassandra clusters<\/strong>&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Cassandra has distributed system architecture. Each&nbsp;<strong>Cassandra instance<\/strong>&nbsp;(document confirming to a specific data type definition (DTD)) is called a&nbsp;<strong>node<\/strong>. You can add multiple nodes by horizontally scaling to form a&nbsp;<strong>cluster.<\/strong>&nbsp;A cluster is a shell in the entire Cassandra database&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img fetchpriority=\"high\" decoding=\"async\" src=\"http:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img3.jpg\" alt=\"An Overview of Cassandra Architecture\" class=\"wp-image-16637\" width=\"527\" height=\"296\" srcset=\"https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img3.jpg 1007w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img3-300x169.jpg 300w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img3-768x432.jpg 768w\" sizes=\"(max-width: 527px) 100vw, 527px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"640\" height=\"256\" src=\"http:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/image-92.png\" alt=\"An Overview of Cassandra Architecture\" class=\"wp-image-16606\" srcset=\"https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/image-92.png 640w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/image-92-300x120.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">( Nodes&nbsp;to clusters by horizontal scaling)&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Column<\/strong>&#8211; It is the innermost layer in the Apache Cassandra database. It is divided into different headings. The headings carry the primary data for the specific entry made&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Rows<\/strong>&#8211; It is the next layer and are basically classifications under which the columns are divided.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Cassandra stores data in table and each table is grouped under columns and rows<\/strong>&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Structure of the table in Cassandra<\/strong>&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">USE&nbsp;User_data;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">CREATE TABLE&nbsp;User_table&nbsp;(&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User_id&nbsp;int,&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User_name&nbsp;text,&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User_add&nbsp;text,&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User_phone&nbsp;text,&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp; PRIMARY KEY (User_id)&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">);&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Insert into&nbsp;User_data&nbsp;(User_id,&nbsp;User_name,&nbsp;User_add,&nbsp;User_phone&nbsp;)&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUES(100, \u2018P\u2019, \u2018San Jose\u2019, \u20189899112453\u2019);&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Insert into&nbsp;User_data&nbsp;(User_id,&nbsp;User_name,&nbsp;User_add,&nbsp;User_phone&nbsp;)&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUES(101, \u2018P&nbsp;Maz\u2019, \u2018Alameda\u2019);&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>OUTPUT<\/strong>&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"http:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img4-1024x819.jpg\" alt=\"An Overview of Cassandra Architecture\" class=\"wp-image-16638\" width=\"474\" height=\"378\" srcset=\"https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img4-1024x819.jpg 1024w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img4-300x240.jpg 300w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img4-768x614.jpg 768w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img4-1536x1228.jpg 1536w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img4-2048x1638.jpg 2048w\" sizes=\"(max-width: 474px) 100vw, 474px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Key space<\/strong>&#8211; The key space is the outermost layer in the storage. It contains the main data, distributed according to their properties.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"383\" height=\"178\" src=\"http:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/image-8.jpeg\" alt=\"An Overview of Cassandra Architecture\" class=\"wp-image-16603\" srcset=\"https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/image-8.jpeg 383w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/image-8-300x139.jpeg 300w\" sizes=\"(max-width: 383px) 100vw, 383px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A cluster is the main entry point of the data into the Cassandra database.<\/strong>&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each node in Cassandra is capable of performing the entire database operations and deal with client requests individually without requiring any master node.&nbsp;<strong>The cluster doesn\u2019t hold a single point of failure owing to the distributed nature of architecture.<\/strong>&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One or more nodes in the cluster serve as replicas for the set of data. With data replication among the nodes, Cassandra ensures no single point of failure&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img2-1024x1024.jpg\" alt=\"An Overview of Cassandra Architecture\" class=\"wp-image-16636\" width=\"385\" height=\"385\" srcset=\"https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img2-1024x1024.jpg 1024w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img2-300x300.jpg 300w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img2-150x150.jpg 150w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img2-768x768.jpg 768w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img2-1536x1536.jpg 1536w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img2-2048x2048.jpg 2048w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img2-500x500.jpg 500w\" sizes=\"(max-width: 385px) 100vw, 385px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The cluster nodes communicate with each other through&nbsp;<strong>Gossip<\/strong>&nbsp;protocol. Gossip keeps&nbsp;one node apprised of the status of other nodes. Every second, one node gossips with three other nodes in the cluster.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A cluster in Cassandra is&nbsp;divided into&nbsp;<strong>racks (group of metal servers collaborating resources like network switches and power source) and data centers<\/strong>.&nbsp;<strong>Snitch configuration<\/strong>&nbsp;is used to group nodes into racks and data centers. Data replication depends on the configuration of racks and data centers.&nbsp;&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"261\" src=\"http:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/image-91.png\" alt=\"An Overview of Cassandra Architecture\" class=\"wp-image-16605\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Storage in Cassandra<\/strong>&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Commit Log-<\/strong>&nbsp;It\u2019s the crash recovery mechanism of Cassandra or to sync issues with the server on failure of the data node. All write operations are written to commit log.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Mem-table<\/strong>&#8211; After commit log the data is written to the Mem-table&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>SS table-<\/strong>&nbsp;When the contents of the Mem-table reach a threshold value, the data is flushed from it to a disk file called the SS- table&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img1-1024x458.jpg\" alt=\"An Overview of Cassandra Architecture\" class=\"wp-image-16635\" width=\"514\" height=\"229\" srcset=\"https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img1-1024x458.jpg 1024w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img1-300x134.jpg 300w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img1-768x343.jpg 768w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img1-1536x687.jpg 1536w, https:\/\/ismiletechnologies.com\/wp-content\/uploads\/2021\/09\/Overview-of-cassandra_img1-2048x916.jpg 2048w\" sizes=\"(max-width: 514px) 100vw, 514px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Data Replication in Cassandra<\/strong>&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every data entry item in the table is replicated at M hosts where M is the configured replication factor at each instance&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope that I have been able to outline the architecture of Apache Cassandra.&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Comment or write to us.\u00a0<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache Cassandra&#8211; a name synonymous with availability, reliability and scalability is a NoSQL database with a unique architecture. Let\u2019s delve a little deeper into what the architecture of Cassandra comprises of&nbsp; Cassandra clusters&nbsp; Cassandra has distributed system architecture. Each&nbsp;Cassandra instance&nbsp;(document confirming to a specific data type definition (DTD)) is called a&nbsp;node. You can add multiple [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":16809,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-16601","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/posts\/16601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/comments?post=16601"}],"version-history":[{"count":4,"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/posts\/16601\/revisions"}],"predecessor-version":[{"id":18317,"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/posts\/16601\/revisions\/18317"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/media\/16809"}],"wp:attachment":[{"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/media?parent=16601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/categories?post=16601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ismiletechnologies.com\/en_us\/wp-json\/wp\/v2\/tags?post=16601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}