history NEW

Apache Cassandra: Non-relational database

To fully appreciate Apache Cassandra and what it can do, it is helpful to first understand NoSQL databases and then look more specifically at Cassandra's architecture and capabilities. Doing so provides a good introduction to the system, so you can determine if it is right for your business.

What is Cassandra?

Apache Cassandra is a distributed database management system that is built to handle large amounts of data across multiple data centers and in the cloud. Its main features are:

  • High scalability
  • Offers high availability
  • Does not have a single point of failure

Written in Java, it is a NoSQL database that offers many things that other NoSQL and relational databases cannot.

Cassandra was originally developed at Facebook for their inbox search feature. Facebook made it open source in 2008, and Cassandra became part of the Apache incubator in 2009. As of early 2010, it is a top-tier Apache project. It is currently a key part of the Apache Software Foundation and can be used by anyone who wants to benefit from it.

Cassandra stands out among database systems and offers some advantages over other systems. Its ability to handle large volumes makes it especially beneficial for large corporations. Therefore, it is currently used by many large companies, such as Apple, Facebook, Instagram, Uber, Spotify, Twitter, Cisco, Rackspace, eBay and Netflix.

What is a NoSQL database?

A NoSQL database, often called "not-just-SQL," is one that stores and retrieves data without requiring it to be stored in a tabular format. Unlike relational databases, which require a tabular format, NoSQL databases allow unstructured data. This type of database offers:

  • A simple design
  • Horizontal scale
  • Extensive availability control

NoSQL databases do not require a fixed schema, allowing for easy replication. With its simple API, I like Cassandra for its overall consistency and ability to handle large amounts of data.

That said, using this type of database has its pros and cons. Although NoSQL databases offer many advantages, they also have drawbacks. In general, NoSQL databases:

  • Only supports simple query language (SQL)
  • They are only "eventually consistent"
  • Transactions are not supported

However, they are effective with large amounts of data and offer easy, horizontal scaling, making this type of system suitable for many large companies. Some of the most popular and powerful NoSQL databases are:

  • Apache Cassandra
  • Apache HBase
  • MongoDB

What makes Apache Cassandra unique?

Cassandra is one of the most efficient and used NoSQL databases. One of the main advantages of this system is that it offers a highly available service without a single point of failure. This is key for businesses that can afford to have their system crash or lose data. With no single point of failure, it offers truly constant access and availability.

Another key advantage of Cassandra is the enormous volume of data the system can handle. It can effectively and efficiently handle huge amounts of data across multiple servers. In addition, it is capable of quickly writing huge amounts of data without affecting reading efficiency. Cassandra offers users "incredibly fast writes," and speed or accuracy is not affected by large volumes of data. It is as fast and accurate for large volumes of data as it is for smaller volumes.

Another reason why so many companies use Cassandra is its horizontal scalability. Its structure allows users to cope with sudden increases in demand by allowing users to simply add more hardware to accommodate additional clients and data. This makes it easy to scale without requiring major stops or adjustments. Additionally, its linear scalability is one of the things that helps maintain the system's fast response time.

Other advantages of Cassandra are

  • Flexible data storage. Cassandra can handle structured, semi-structured and unstructured data, giving users flexibility with data storage.
  • Flexible data distribution. Cassandra uses multiple data centers, allowing easy distribution of data where or when needed.
  • Supports ACID. The ACID properties (atomicity, consistency, isolation and durability) are supported by Cassandra.

Clearly, Apache Cassandra offers some discrete benefits that other NoSQL and relational databases cannot. With continuous availability, operational simplicity, easy data distribution across multiple data centers, and an ability to handle massive amounts of volume, it is the database of choice for many businesses.

How does Cassandra work?

Apache Cassandra is a peer-to-peer system. Its distribution design is based on Amazon's DynamoDB and its data model on Google's Big Table.

The basic architecture consists of a cluster of nodes, each and every one of which can accept a read or write request. This is a key aspect of its architecture, as there are no master nodes. Instead, all nodes communicate equally.

While nodes are the specific location where data lives in a cluster, the cluster is the entire set of data centers where all data is stored for processing. Related nodes are grouped into data centers. This type of structure is built to be scalable and when additional space is needed, nodes can simply be added. The result is that the system is easy to scale, built for volume, and made to handle concurrent users across the system.

Its structure also allows data protection. To help ensure data integrity, Cassandra has a commit log. This is a backup method and all data is written to the commit log to ensure that data is not lost. The data is then indexed and written to a memory table. The memtable is simply a data structure in memory that Cassandra writes to. There is one active memtable per table.

When memtables reach their threshold, they are flushed to disk and converted to immutable SSTables. More simply, this means that when the commit log is full, it triggers a flush in which the contents of the memtables are written to SSTables. The commit log is an important aspect of the Cassandra architecture because it provides a fail-safe method of protecting data and providing data integrity.

Who should use Cassandra?

If you need to store and manage large amounts of data across many servers, Cassandra could be a good solution for your business. It is ideal for companies that:

  • You can't afford to lose data
  • They can't have their database down due to a single server outage

Plus, it's easy to use and scale, making it ideal for businesses that are constantly growing.

At its core, the Apache Cassandra framework is “built for scale” and can handle large amounts of data and concurrent users on a system. It allows large companies to store large amounts of data in a decentralized system. However, despite decentralization, it still allows users to have control and access to data.

Furthermore, the data is always accessible. With no single point of failure, the system offers true continuous availability, avoiding downtime and data loss. Additionally, because you can scale by simply adding new nodes, uptime is constant and there is no need to shut down the system to accommodate more clients or more data. Given these advantages, it's no wonder so many major companies use Apache Cassandra.