Apache Cassandra Explained

Apache Cassandra
Author:Avinash Lakshman, Prashant Malik / Facebook
Developer:Apache Software Foundation
Programming Language:Java
Operating System:Cross-platform
Language:English
Genre:NoSQL Database, data store
License:Apache License 2.0

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 data centers,[1] 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.[2]

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.[3] In March 2009, it became an Apache Incubator project.[4] On February 17, 2010, it graduated to a top-level project.[5]

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

Releases

Releases after graduation include

VersionOriginal release dateLatest versionRelease dateStatus[15]
2010-04-120.6.132011-04-18No longer maintained
2011-01-100.7.102011-10-31No longer maintained
2011-06-030.8.102012-02-13No longer maintained
2011-10-181.0.122012-10-04No longer maintained
2012-04-241.1.122013-05-27No longer maintained
2013-01-021.2.192014-09-18No longer maintained
2013-09-032.0.172015-09-21No longer maintained
2014-09-162.1.222020-08-31No longer maintained
2015-07-202.2.192020-11-04No longer maintained
2015-11-093.0.292023-05-15Maintained until 5.0.0 release (Nov-Dec 2023)
2017-06-233.11.152023-05-05Maintained until 5.0.0 release (Nov-Dec 2023)
2021-07-264.0.92023-04-14Maintained until 5.1.0 release (~July 2024)
2022-06-174.1.42024-02-14Latest 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.[16] 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,[17] 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.
    MapReduce support
  • Cassandra has Hadoop integration, with MapReduce support. There is support also for Apache Pig and Apache Hive.[18]
    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++.[19]

    The keyspace in Cassandra is a namespace that defines data replication across nodes. Therefore, replication is defined at the keyspace level. Below an example of keyspace creation, including a column family in CQL 3.0:[20] CREATE KEYSPACE MyKeySpace WITH REPLICATION = ;

    USE MyKeySpace;

    CREATE COLUMNFAMILY MyColumns (id text, lastName text, firstName text, PRIMARY KEY(id));

    INSERT INTO MyColumns (id, lastName, firstName) VALUES ('1', 'Doe', 'John');

    SELECT * FROM MyColumns;Which gives: id | lastName | firstName----+----------+---------- 1 | Doe | John

    (1 rows)

    Known issues

    Up to Cassandra 1.0, Cassandra was not row-level consistent,[21] 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.[22]

    Cassandra is not supported on Windows as of version 4, see issue CASSANDRA-16171.[23]

    Tombstones

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

    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.[25] 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]

    See also

    Bibliography

    External links

    Notes and References

    1. Web site: 2013-07-25 . Joaquin . Casares . 2012-11-05 . DataStax . Multi-datacenter Replication in Cassandra . Cassandra’s innate datacenter concepts are important as they allow multiple workloads to be run across multiple datacenters… .
    2. Web site: Apache Cassandra Documentation Overview . 2021-01-21.
    3. Web site: 2009-06-04 . July 12, 2008 . Facebook Releases Cassandra as Open Source . James . Hamilton.
    4. Web site: Is this the new hotness now? . Mail-archive.com . 2009-03-02 . 2010-03-29 . https://web.archive.org/web/20100425071855/http://www.mail-archive.com/cassandra-dev%40incubator.apache.org/msg00004.html . 25 April 2010 . live .
    5. Web site: Cassandra is an Apache top level project . Mail-archive.com . 2010-02-18 . 2010-03-29 . https://web.archive.org/web/20100328090322/http://www.mail-archive.com/cassandra-dev%40incubator.apache.org/msg01518.html . 28 March 2010 . live .
    6. Web site: The meaning behind the name of Apache Cassandra . https://web.archive.org/web/20161101091045/http://kellabyte.com/2013/01/04/the-meaning-behind-the-name-of-apache-cassandra . 2016-11-01 . 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[.] . dead .
    7. Web site: The Apache Software Foundation Announces Apache Cassandra Release 0.6 : The Apache Software Foundation Blog. 13 April 2010 . 5 January 2016.
    8. Web site: The Apache Software Foundation Announces Apache Cassandra 0.7 : The Apache Software Foundation Blog. 11 January 2011 . 5 January 2016.
    9. Web site: [Cassandra-user] [RELEASE] 0.8.0]. Eric Evans. 5 January 2016. https://web.archive.org/web/20150608075711/http://grokbase.com/t/cassandra/user/1162fkpwx2/release-0-8-0. 8 June 2015. dead.
    10. Web site: Cassandra 1.0.0. Is Ready for the Enterprise. InfoQ. 5 January 2016.
    11. Web site: The Apache Software Foundation Announces Apache Cassandra™ v1.1 : The Apache Software Foundation Blog. 24 April 2012 . 5 January 2016.
    12. Web site: The Apache Software Foundation Announces Apache Cassandra™ v1.2 : The Apache Software Foundation Blog. apache.org. 2 January 2013 . 11 December 2014.
    13. Web site: [VOTE SUCCESS] Release Apache Cassandra 2.1.0]. Sylvain Lebresne. 10 September 2014. mail-archive.com. 11 December 2014.
    14. Web site: Cassandra 2.2, 3.0, and beyond. 16 June 2015. 22 April 2016. 20 April 2016. https://web.archive.org/web/20160420061323/http://www.planetcassandra.org/blog/cassandra-2-2-3-0-and-beyond/. dead.
    15. Web site: Cassandra Server Releases. cassandra.apache.org. 15 December 2015.
    16. Web site: Deploying Cassandra across Multiple Data Centers. DataStax. 11 December 2014.
    17. Web site: The CAP Theorem - Learn Cassandra. teddyma.gitbooks.io.
    18. http://wiki.apache.org/cassandra/HadoopSupport "Hadoop Support"
    19. Web site: DataStax C/C++ Driver for Apache Cassandra. DataStax. 15 December 2014.
    20. Web site: CQL. 5 January 2016. https://web.archive.org/web/20160113141740/http://cassandra.apache.org/doc/cql3/CQL.html. 13 January 2016. dead.
    21. Web site: WAT - Cassandra: Row level consistency #$@&%*! - datanerds.io. datanerds.io. 28 November 2016. 26 November 2016. https://web.archive.org/web/20161126212225/http://datanerds.io/post/cassandra-no-row-consistency/. dead.
    22. News: Coming up in Cassandra 1.1: Row Level Isolation. Lebresne. Sylvain. 2012-02-21. DataStax: always-on data platform NoSQL Apache Cassandra. 2018-07-18. en-US.
    23. Web site: Remove Windows scripts . Cassandra issue tracker . 2023-04-04 . 2023-04-04.
    24. Web site: Rodriguez . Alain . About Deletes and Tombstones in Cassandra . 27 Jul 2016.
    25. Web site: 2013-07-25 . DataStax . DataStax . 2013-01-15 . About data consistency . https://web.archive.org/web/20130726185743/http://www.datastax.com/docs/1.2/dml/data_consistency . 2013-07-26 . dead .
    26. Web site: 2013-07-25 . Jonathan . Ellis . 2012-02-15 . Schema in Cassandra 1.1 . DataStax .
    27. Web site: 2013-07-25 . Jonathan . Ellis . 2010-12-03 . What's new in Cassandra 0.7: Secondary indexes . DataStax .
    28. Web site: 2013-07-25 . Jonathan . Ellis . 2012-03-02 . The Schema Management Renaissance in Cassandra 1.1 . DataStax .
    29. Web site: 2013-07-25 . Sylvain . Lebresne . 2012-08-05 . Coming in 1.2: Collections support in CQL3 . DataStax .
    30. Web site: DataStax. Apache Cassandra 0.7 Documentation - Column Families. Apache Cassandra 0.7 Documentation. 29 October 2012.
    31. Web site: NodeTool. Cassandra Wiki. 5 January 2016. https://web.archive.org/web/20160113122938/http://wiki.apache.org/cassandra/NodeTool. 13 January 2016. dead.
    32. Web site: How to monitor Cassandra performance metrics. 3 December 2015. Datadog. 5 January 2016.
    33. Web site: Metrics. Cassandra Wiki. 5 January 2016. 12 November 2015. https://web.archive.org/web/20151112112756/http://wiki.apache.org/cassandra/Metrics. dead.
    34. Web site: Monitoring. Cassandra Documentation. 1 February 2018.