Apache Cassandra

Last updated
Apache Cassandra
Cassandra logo.svg
Original author(s) Avinash Lakshman, Prashant Malik / Facebook
Developer(s) Apache Software Foundation
Initial releaseJuly 2008;12 years ago (2008-07)
Stable release
3.11.10 [1]   OOjs UI icon edit-ltr-progressive.svg / 1 February 2021;3 months ago (1 February 2021)
Repository OOjs UI icon edit-ltr-progressive.svg
Written in Java
Operating system Cross-platform
Available inEnglish
Type NoSQL Database, data store
License Apache License 2.0
Website cassandra.apache.org   OOjs UI icon edit-ltr-progressive.svg

Apache Cassandra is a free and open-source, distributed, wide-column store, NoSQL database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers support for clusters spanning multiple datacenters, [2] with asynchronous masterless replication allowing low latency operations for all clients. Cassandra was designed to implement a combination of Amazon's Dynamo distributed storage and replication techniques combined with Google's Bigtable data and storage engine model. [3]

Contents

History

Avinash Lakshman, one of the authors of Amazon's Dynamo, and Prashant Malik initially developed Cassandra at Facebook to power the Facebook inbox search feature. Facebook released Cassandra as an open-source project on Google code in July 2008. [4] In March 2009 it became an Apache Incubator project. [5] On February 17, 2010 it graduated to a top-level project. [6]

Facebook developers named their database after the Trojan mythological prophet Cassandra, with classical allusions to a curse on an oracle. [7]

Releases

Releases after graduation include

VersionOriginal release dateLatest versionRelease dateStatus [16]
Old version, no longer maintained: 0.62010-04-120.6.132011-04-18No longer supported
Old version, no longer maintained: 0.72011-01-100.7.102011-10-31No longer supported
Old version, no longer maintained: 0.82011-06-030.8.102012-02-13No longer supported
Old version, no longer maintained: 1.02011-10-181.0.122012-10-04No longer supported
Old version, no longer maintained: 1.12012-04-241.1.122013-05-27No longer supported
Old version, no longer maintained: 1.22013-01-021.2.192014-09-18No longer supported
Old version, no longer maintained: 2.02013-09-032.0.172015-09-21No longer supported
Older version, yet still maintained: 2.12014-09-162.1.222020-08-31Still supported, critical fixes only
Older version, yet still maintained: 2.22015-07-202.2.192020-11-04Still supported
Older version, yet still maintained: 3.02015-11-093.0.242021-02-28Still supported
Current stable version:3.112017-06-233.11.102021-02-28Latest release
Latest preview version of a future release: 4.0n/a4.0-rc12021-04-25Release Candidate (RC)
Legend:
Old version
Older version, still maintained
Latest version
Latest preview version
Future release

Main features

Distributed
Every node in the cluster has the same role. There is no single point of failure. Data is distributed across the cluster (so each node contains different data), but there is no master as every node can service any request.
Supports replication and multi data center replication
Replication strategies are configurable. [17] Cassandra is designed as a distributed system, for deployment of large numbers of nodes across multiple data centers. Key features of Cassandra’s distributed architecture are specifically tailored for multiple-data center deployment, for redundancy, for failover and disaster recovery.
Scalability
Designed to have read and write throughput both increase linearly as new machines are added, with the aim of no downtime or interruption to applications.
Fault-tolerant
Data is automatically replicated to multiple nodes for fault-tolerance. Replication across multiple data centers is supported. Failed nodes can be replaced with no downtime.
Tunable consistency
Cassandra is typically classified as an AP system, meaning that availability and partition tolerance are generally considered to be more important than consistency in Cassandra, [18] Writes and reads offer a tunable level of consistency, all the way from "writes never fail" to "block for all replicas to be readable", with the quorum level in the middle. [19]
MapReduce support
Cassandra has Hadoop integration, with MapReduce support. There is support also for Apache Pig and Apache Hive. [20]
Query language
Cassandra introduced the Cassandra Query Language (CQL). CQL is a simple interface for accessing Cassandra, as an alternative to the traditional Structured Query Language (SQL).
Eventual consistency
Cassandra manages eventual consistency of reads, upserts and deletes through Tombstones.

Cassandra Query Language

Cassandra introduced the Cassandra Query Language (CQL). CQL is a simple interface for accessing Cassandra, as an alternative to the traditional Structured Query Language (SQL). CQL adds an abstraction layer that hides implementation details of this structure and provides native syntaxes for collections and other common encodings. Language drivers are available for Java (JDBC), Python (DBAPI2), Node.JS (Datastax), Go (gocql) and C++. [21]

Below an example of keyspace creation, including a column family in CQL 3.0: [22]

CREATEKEYSPACEMyKeySpaceWITHREPLICATION={'class':'SimpleStrategy','replication_factor':3};USEMyKeySpace;CREATECOLUMNFAMILYMyColumns(idtext,Lasttext,Firsttext,PRIMARYKEY(id));INSERTINTOMyColumns(id,Last,First)VALUES('1','Doe','John');SELECT*FROMMyColumns;

Which gives:

 id | Last | First ----+------+------   1 | Doe  | John  (1 rows)

Known issues

Up to Cassandra 1.0, Cassandra was not row level consistent, [23] meaning that inserts and updates into the table that affect the same row that are processed at approximately the same time may affect the non-key columns in inconsistent ways. One update may affect one column while another affects the other, resulting in sets of values within the row that were never specified or intended. Cassandra 1.1 solved this issue by introducing row-level isolation. [24]

Tombstones

Deletion markers called "Tombstones" are known to cause severe performance degradation. [25]

Data model

Cassandra is wide column store, and, as such, essentially a hybrid between a key-value and a tabular database management system. Its data model is a partitioned row store with tunable consistency. [19] Rows are organized into tables; the first component of a table's primary key is the partition key; within a partition, rows are clustered by the remaining columns of the key. [26] Other columns may be indexed separately from the primary key. [27]

Tables may be created, dropped, and altered at run-time without blocking updates and queries. [28]

Cassandra cannot do joins or subqueries. Rather, Cassandra emphasizes denormalization through features like collections. [29]

A column family (called "table" since CQL 3) resembles a table in an RDBMS (Relational Database Management System). Column families contain rows and columns. Each row is uniquely identified by a row key. Each row has multiple columns, each of which has a name, value, and a timestamp. Unlike a table in an RDBMS, different rows in the same column family do not have to share the same set of columns, and a column may be added to one or multiple rows at any time. [30]

Each key in Cassandra corresponds to a value which is an object. Each key has values as columns, and columns are grouped together into sets called column families. Thus, each key identifies a row of a variable number of elements. These column families could be considered then as tables. A table in Cassandra is a distributed multi dimensional map indexed by a key. Furthermore, applications can specify the sort order of columns within a Super Column or Simple Column family.

Management and monitoring

Cassandra is a Java-based system that can be managed and monitored via Java Management Extensions (JMX). The JMX-compliant nodetool utility, for instance, can be used to manage a Cassandra cluster (adding nodes to a ring, draining nodes, decommissioning nodes, and so on). [31] Nodetool also offers a number of commands to return Cassandra metrics pertaining to disk usage, latency, compaction, garbage collection, and more. [32]

Since Cassandra 2.0.2 in 2013, measures of several metrics are produced via the Dropwizard metrics framework, [33] and may be queried via JMX using tools such as JConsole or passed to external monitoring systems via Dropwizard-compatible reporter plugins. [34]

Notable applications

According to DB-Engines ranking, Cassandra is the most popular wide column store, [35] and in September 2014 became the 9th most popular database. [36]

See also

Related Research Articles

Multi-master replication is a method of database replication which allows data to be stored by a group of computers, and updated by any member of the group. All members are responsive to client data queries. The multi-master replication system is responsible for propagating the data modifications made by each member to the rest of the group and resolving any conflicts that might arise between concurrent changes made by different members.

Apache Solr Open-source enterprise-search platform

Solr is an open-source enterprise-search platform, written in Java. Its major features include full-text search, hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration, NoSQL features and rich document handling. Providing distributed search and index replication, Solr is designed for scalability and fault tolerance. Solr is widely used for enterprise search and analytics use cases and has an active development community and regular releases.

Apache CouchDB

Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.

Dynamo is a set of techniques that together can form a highly available key-value structured storage system or a distributed data store. It has properties of both databases and distributed hash tables (DHTs). It was created to help address some scalability issues that Amazon.com's website experienced during the holiday season of 2004. By 2007, it was used in Amazon Web Services, such as its Simple Storage Service (S3).

A database shard, or simply a shard, is a horizontal partition of data in a database or search engine. Each shard is held on a separate database server instance, to spread load.

A NoSQL database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases. Such databases have existed since the late 1960s, but the name "NoSQL" was only coined in the early 21st century, triggered by the needs of Web 2.0 companies. NoSQL databases are increasingly used in big data and real-time web applications. NoSQL systems are also sometimes called "Not only SQL" to emphasize that they may support SQL-like query languages or sit alongside SQL databases in polyglot-persistent architectures.

Apache ZooKeeper

Apache ZooKeeper is an open-source server for highly reliable distributed coordination of cloud applications. It is a project of the Apache Software Foundation.

Riak is a distributed NoSQL key-value data store that offers high availability, fault tolerance, operational simplicity, and scalability. In addition to the open-source version, it comes in a supported enterprise version and a cloud storage version. Riak implements the principles from Amazon's Dynamo paper with heavy influence from the CAP Theorem. Written in Erlang, Riak has fault tolerant data replication and automatic data distribution across the cluster for performance and resilience.

Apache Hive

Apache Hive is a data warehouse software project built on top of Apache Hadoop for providing data query and analysis. Hive gives an SQL-like interface to query data stored in various databases and file systems that integrate with Hadoop. Traditional SQL queries must be implemented in the MapReduce Java API to execute SQL applications and queries over distributed data. Hive provides the necessary SQL abstraction to integrate SQL-like queries (HiveQL) into the underlying Java without the need to implement queries in the low-level Java API. Since most data warehousing applications work with SQL-based querying languages, Hive aids portability of SQL-based applications to Hadoop. While initially developed by Facebook, Apache Hive is used and developed by other companies such as Netflix and the Financial Industry Regulatory Authority (FINRA). Amazon maintains a software fork of Apache Hive included in Amazon Elastic MapReduce on Amazon Web Services.

Standard column family

The standard column family is a NoSQL object that contains columns of related data. It is a tuple (pair) that consists of a key–value pair, where the key is mapped to a value that is a set of columns. In analogy with relational databases, a standard column family is as a "table", each key–value pair being a "row". Each column is a tuple consisting of a column name, a value, and a timestamp. In a relational database table, this data would be grouped together within a table with other non-related data.

Voldemort is a distributed data store that was designed as a key-value store used by LinkedIn for highly-scalable storage. It is named after the fictional Harry Potter villain Lord Voldemort.

A tombstone is a deleted record in a replica of a distributed data store. The tombstone is necessary, as distributed data stores use eventual consistency, where only a subset of nodes where the data is stored must respond before an operation is considered to be successful.

Oracle NoSQL Database

Oracle NoSQL Database (ONDB) is a NoSQL-type distributed key-value database from Oracle Corporation. It provides transactional semantics for data manipulation, horizontal scalability, and simple administration and monitoring.

DataStax, Inc. is a data management company based in Santa Clara, California. Its product provides commercial support, software, and cloud database-as-a-service based on Apache Cassandra. DataStax also provides event streaming support and a cloud service based on Apache Pulsar. As of January 2021, the company has roughly 500 customers distributed in over 50 countries.

FoundationDB is a free and open-source multi-model distributed NoSQL database developed by Apple Inc. with a shared-nothing architecture. The product was designed around a "core" database, with additional features supplied in "layers." The core database exposes an ordered key-value store with transactions. The transactions are able to read or write multiple keys stored on any machine in the cluster while fully supporting ACID properties. Transactions are used to implement a variety of data models via layers.

A wide-column store is a type of NoSQL database. It uses tables, rows, and columns, but unlike a relational database, the names and format of the columns can vary from row to row in the same table. A wide-column store can be interpreted as a two-dimensional key–value store.

Presto is a high performance, distributed SQL query engine for big data. Its architecture allows users to query a variety of data sources such as Hadoop, AWS S3, Alluxio, MySQL, Cassandra, Kafka, MongoDB and Teradata. One can even query data from multiple data sources within a single query. Presto is community driven open-source software released under the Apache License.

Scylla (database)

Scylla is an open-source distributed NoSQL wide-column data store. It was designed to be compatible with Apache Cassandra while achieving significantly higher throughputs and lower latencies. It supports the same protocols as Cassandra and the same file formats (SSTable), but is a completely rewritten implementation, using the C++20 language replacing Cassandra's Java, and the Seastar asynchronous programming library with threads, shared memory, mapped files, and other classic Linux programming techniques. In addition implementing Cassandra's protocols, Scylla also implements the Amazon DynamoDB API.

YugabyteDB is a free and open-source, distributed, relational, NewSQL database management system designed to handle large amounts of data spanning across multiple availability zones and geographic regions while providing single-digit latency, high availability, and no single point of failure.

A distributed SQL database is a single relational database which replicates data across multiple servers. Distributed SQL databases are strongly consistent and most support consistency across racks, data centers, and wide area networks including cloud availability zones and cloud geographic zones. Distributed SQL databases typically use the Paxos or Raft algorithms to achieve consensus across multiple nodes. Sometimes distributed SQL databases are referred to as NewSQL but NewSQL is a more inclusive term that includes databases that are not distributed databases.

References

  1. "Release cassandra-3.11.10" . Retrieved 13 February 2021.
  2. Casares, Joaquin (2012-11-05). "Multi-datacenter Replication in Cassandra". DataStax. Retrieved 2013-07-25. Cassandra’s innate datacenter concepts are important as they allow multiple workloads to be run across multiple datacenters…
  3. "Apache Cassandra Documentation Overview" . Retrieved 2021-01-21.
  4. Hamilton, James (July 12, 2008). "Facebook Releases Cassandra as Open Source" . Retrieved 2009-06-04.
  5. "Is this the new hotness now?". Mail-archive.com. 2009-03-02. Archived from the original on 25 April 2010. Retrieved 2010-03-29.
  6. "Cassandra is an Apache top level project". Mail-archive.com. 2010-02-18. Archived from the original on 28 March 2010. Retrieved 2010-03-29.
  7. "The meaning behind the name of Apache Cassandra". Archived from the original on 2016-11-01. Retrieved 2016-07-19. Apache Cassandra is named after the Greek mythological prophet Cassandra. [...] Because of her beauty Apollo granted her the ability of prophecy. [...] When Cassandra of Troy refused Apollo, he put a curse on her so that all of her and her descendants' predictions would not be believed. [...] Cassandra is the cursed Oracle[.]
  8. "The Apache Software Foundation Announces Apache Cassandra Release 0.6 : The Apache Software Foundation Blog" . Retrieved 5 January 2016.
  9. "The Apache Software Foundation Announces Apache Cassandra 0.7 : The Apache Software Foundation Blog" . Retrieved 5 January 2016.
  10. Eric Evans. "[Cassandra-user][RELEASE] 0.8.0". Archived from the original on 8 June 2015. Retrieved 5 January 2016.
  11. "Cassandra 1.0.0. Is Ready for the Enterprise". InfoQ. Retrieved 5 January 2016.
  12. "The Apache Software Foundation Announces Apache Cassandra™ v1.1 : The Apache Software Foundation Blog" . Retrieved 5 January 2016.
  13. "The Apache Software Foundation Announces Apache Cassandra™ v1.2 : The Apache Software Foundation Blog". apache.org. Retrieved 11 December 2014.
  14. Sylvain Lebresne (10 September 2014). "[VOTE SUCCESS] Release Apache Cassandra 2.1.0". mail-archive.com. Retrieved 11 December 2014.
  15. "Cassandra 2.2, 3.0, and beyond". 16 June 2015. Retrieved 22 April 2016.
  16. "Cassandra Server Releases". cassandra.apache.org. Retrieved 15 December 2015.
  17. "Deploying Cassandra across Multiple Data Centers". DataStax. Retrieved 11 December 2014.
  18. "The CAP Theorem - Learn Cassandra". teddyma.gitbooks.io.
  19. 1 2 DataStax (2013-01-15). "About data consistency". Archived from the original on 2013-07-26. Retrieved 2013-07-25.
  20. "Hadoop Support" Archived 2017-11-16 at the Wayback Machine article on Cassandra's wiki
  21. "DataStax C/C++ Driver for Apache Cassandra". DataStax. Retrieved 15 December 2014.
  22. "CQL". Archived from the original on 13 January 2016. Retrieved 5 January 2016.
  23. "WAT - Cassandra: Row level consistency #$@&%*! - datanerds.io". datanerds.io. Retrieved 28 November 2016.
  24. Lebresne, Sylvain (2012-02-21). "Coming up in Cassandra 1.1: Row Level Isolation". DataStax: always-on data platform | NoSQL | Apache Cassandra. Retrieved 2018-07-18.
  25. Rodriguez, Alain (27 Jul 2016). "About Deletes and Tombstones in Cassandra".
  26. Ellis, Jonathan (2012-02-15). "Schema in Cassandra 1.1". DataStax. Retrieved 2013-07-25.
  27. Ellis, Jonathan (2010-12-03). "What's new in Cassandra 0.7: Secondary indexes". DataStax. Retrieved 2013-07-25.
  28. Ellis, Jonathan (2012-03-02). "The Schema Management Renaissance in Cassandra 1.1". DataStax. Retrieved 2013-07-25.
  29. Lebresne, Sylvain (2012-08-05). "Coming in 1.2: Collections support in CQL3". DataStax. Retrieved 2013-07-25.
  30. DataStax. "Apache Cassandra 0.7 Documentation - Column Families". Apache Cassandra 0.7 Documentation. Retrieved 29 October 2012.
  31. "NodeTool". Cassandra Wiki. Archived from the original on 13 January 2016. Retrieved 5 January 2016.
  32. "How to monitor Cassandra performance metrics". Datadog. Retrieved 5 January 2016.
  33. "Metrics". Cassandra Wiki. Retrieved 5 January 2016.
  34. "Monitoring". Cassandra Documentation. Retrieved 1 February 2018.
  35. DB-Engines. "DB-Engines Ranking of Wide Column Stores".
  36. DB-Engines. "DB-Engines Ranking".
  37. Luca Martinetti: Apple runs more than 100k [production] Cassandra nodes. on Twitter
  38. "Datastores on Appscale". Archived from the original on 2013-09-07. Retrieved 2011-07-07.
  39. "Top Cassandra Summit Sessions For Advanced Cassandra Users". Archived from the original on 2017-03-08. Retrieved 2015-12-20.
  40. "Multi-Tenancy in Cassandra at BlackRock".
  41. "A Persistent Back-End for the ATLAS Online Information Service (P-BEAST)".
  42. "Re: Cassandra users survey". Mail-archive.com. 2009-11-21. Archived from the original on 17 April 2010. Retrieved 2010-03-29.
  43. Finley, Klint (2011-02-18). "This Week in Consolidation: HP Buys Vertica, Constant Contact Buys Bantam Live and More". Read Write Enterprise.
  44. Eure, Ian. "Looking to the future with Cassandra".
  45. Quinn, John. "Saying Yes to NoSQL; Going Steady with Cassandra". Archived from the original on 2012-03-07.
  46. Schonfeld, Erick. "As Digg Struggles, VP Of Engineering Is Shown The Door".
  47. "Is Cassandra to Blame for Digg v4's Failures?".
  48. Vishnevskiy, Stanislav (2017-01-14). "How Discord Stores Billions of Messages". Discord Blog. Retrieved 2019-07-02.
  49. Cozzi, Martin (2011-08-31). "Cassandra at Formspring".
  50. Nunes, Alexandre (2016-06-22). "Cassandra At The Heart Of Globo's Live Streaming Platform".
  51. Blackie, William (2018-07-26). "Cloud infrastructure at Grubhub". Grubhub Bytes. Retrieved 2019-03-29.
  52. "Mahalo.com powered by Apache Cassandra™" (PDF). DataStax.com. Santa Clara, CA, USA: DataStax. 2012-04-10. Archived from the original (PDF) on 2014-12-17. Retrieved 2014-06-13.
  53. Watch Cassandra at Mahalo.com |DataStax Episodes |Blip Archived 2011-12-10 at the Wayback Machine
  54. "We had issues with Monzo on 29th July. Here's what happened, and what we did to fix it". Monzo. Retrieved 2020-12-09.
  55. "We secured thousands of Cassandra clients to keep Monzo's data safe". Monzo. Retrieved 2020-12-09.
  56. Cockcroft, Adrian (2011-07-11). "Migrating Netflix from Datacenter Oracle to Global Cassandra". slideshare.net. Retrieved 2014-06-13.
  57. Izrailevsky, Yury (2011-01-28). "NoSQL at Netflix".
  58. "Nutanix Bible". Archived from the original on 2015-12-10. Retrieved 2015-04-18.
  59. Ooyala (2010-05-18). "Designing a Scalable Database for Online Video Analytics" (PDF). DataStax.com. Mountain View CA, USA. Archived from the original (PDF) on 2014-12-17. Retrieved 2014-06-14.
  60. Mainstay LLC (2013-11-11). "DataStax Case Study of Openwave Messaging" (PDF). DataStax.com. Santa Clara, CA, USA: DataStax. Archived from the original (PDF) on 2014-09-07. Retrieved 2014-06-15.
  61. Ad Serving Technology - Advanced Optimization, Forecasting, & Targeting |OpenX Archived 2011-10-07 at the Wayback Machine
  62. "Hadoop and Cassandra (at Rackspace)". Stu Hood. 2010-04-23. Retrieved 2011-09-01.
  63. david [ketralnis] (2010-03-12). "what's new on reddit: She who entangles men". blog.reddit. Archived from the original on 25 March 2010. Retrieved 2010-03-29.
  64. Posted by the reddit admins at (2010-05-11). "blog.reddit -- what's new on reddit: reddit's May 2010 "State of the Servers" report". blog.reddit. Archived from the original on 14 May 2010. Retrieved 2010-05-16.
  65. Pattishall, Dathan Vance (2011-03-23). "Cassandra is my NoSQL Solution but".
  66. "Cassandra at SoundCloud". Archived from the original on 2013-09-05. Retrieved 2013-07-15.
  67. Hermann, Jeremy. "Meet Michelangelo: Uber's Machine Learning Platform".
  68. Onnen, Erik. "From 100s to 100s of Millions".

Bibliography