Apache Cassandra
- Problem solved: absorb billions of writes per day on hundreds of commodity machines, with no single point of failure, including across several datacenters.
- Era: started around 2007 during a Facebook hackathon, in production in June 2008, code released in July 2008, Apache Incubator on January 2, 2009, Apache top-level project on February 17, 2010.
- Category: distributed database (NoSQL, wide-column).
- Created by: Avinash Lakshman and Prashant Malik, at Facebook.
Historical context
In 2007, Facebook wants to solve the Inbox Search problem: letting every user search their messages. It means storing inverted indexes for hundreds of millions of people, absorbing "billions of writes per day" and replicating across datacenters to keep latency low. Classic solutions do not fit: before the launch, the 7 TB of inbox data lived in Facebook's MySQL infrastructure.
Avinash Lakshman, co-author of Amazon's Dynamo paper (SOSP 2007), joins Facebook and teams up with Prashant Malik from the Search team. They start the implementation during an internal hackathon, "about a year ago" as Lakshman wrote in August 2008. The idea, summed up by Jeff Hammerbacher (Facebook Data team): "a BigTable data model running on a Dynamo-like infrastructure". The LADIS 2009 paper explains why neither was enough on its own: Bigtable depends on a distributed file system, and Dynamo requires a read before every write to manage its vector clocks, which limits write throughput.
Inbox Search launches in June 2008 for about 100 million users. In July 2008, Facebook publishes the code on Google Code under the Apache 2.0 licence. The project enters the Apache Incubator on January 2, 2009, then becomes a top-level project on February 17, 2010. An external community takes over (Jonathan Ellis becomes a committer in March 2009, later project vice president and DataStax CTO).
An ironic twist: in November 2010, Facebook picks HBase, not Cassandra, for its new Messages product, finding "Cassandra's eventual consistency model to be a difficult pattern to reconcile". Cassandra thrives elsewhere anyway: Twitter, Netflix and Reddit are named as users as early as 2011, and in 2024 the project claims more than 30,000 user organizations.
Key idea
A masterless architecture: all nodes are equal, and any of them can receive a request and coordinate it. Data is spread over a ring by consistent hashing and copied to N nodes (the replication factor). There is no central node to protect and no single failure that stops the cluster.
The trade-off is deliberate: by default Cassandra is an AP database in CAP terms (available and partition tolerant). Consistency is tunable per query: you choose how many replicas must answer (one, a majority, all).
How it works
- Ring and partitioning: a hash function applied to the partition key gives a token; each node owns ranges of tokens. The 2009 paper used an order-preserving hash so that range scans were possible.
- Replication: each piece of data is copied to N nodes, with strategies that take racks and datacenters into account.
- Gossip: nodes periodically exchange their state (Scuttlebutt protocol in the paper). Failures are detected by an "accrual" (Phi) detector: on a 100-node cluster, detection drops from about 2 minutes to about 15 seconds.
- Write path: write to an on-disk commit log (durability), then to an in-memory table (memtable), later flushed to sorted immutable files (SSTables) merged by compaction. A Bloom filter per file avoids reading files that do not contain the key. This is the LSM-tree family.
- Hinted handoff: if a replica is down, the coordinator keeps a "hint" and sends the data when the replica comes back.
- CQL: the Cassandra Query Language replaced the old Thrift API (while staying compatible with data created through it). It looks like SQL, but without joins.
- Consistency level: with a replication factor of 3 and the
QUORUMlevel, the coordinator waits for 2 replicas to agree before answering.
CREATE KEYSPACE inbox
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};
-- in cqlsh: every query waits for a majority of replicas (2 out of 3)
CONSISTENCY QUORUM;
SELECT * FROM inbox.messages WHERE user_id = 42;
By the numbers
| Figure | Context | Source |
|---|---|---|
| 100 then 250 million | Inbox Search users at launch (June 2008) and in 2009 | LADIS 2009 paper |
| 50 TB on 150 nodes | Inbox Search data, spread between US east and west coast datacenters (2009) | LADIS 2009 paper |
| 15.69 ms | Median production read latency for interaction search (2009) | LADIS 2009 paper |
| 300 TB on 400 machines | Largest known Cassandra production cluster at the 1.0 release (October 2011) | ASF press release 2011 |
| Over 1,500 | Critical production deployments claimed for the project's 5th anniversary (April 2014) | ASF press release 2014 |
| Over 75,000 nodes, over 10 PB | Apple's Cassandra fleet, including one cluster over 1,000 nodes (2014) | Cassandra site, OpenSource Connections [S] |
| 1,700 nodes, 20 billion requests per day | Bloomberg fleet, on a nearly 1 PB dataset (site accessed November 2026) | Cassandra site |
| Over 1,000 bugs | Fixed thanks to new testing tools before 4.0 (July 2021) | Cassandra 4.0 blog |
Milestones
- October 2007: the Dynamo paper (Amazon) is published, with Avinash Lakshman as co-author.
- June 2008: Inbox Search launches at Facebook, the first use of Cassandra.
- July 2008: Facebook publishes the code on Google Code, under the Apache 2.0 licence.
- January 2, 2009: enters the Apache Incubator.
- July 20, 2009: version 0.3.0, released during incubation.
- February 17, 2010: Cassandra becomes an Apache top-level project.
- October 18, 2011: Cassandra 1.0 is released.
- November 9, 2015: Cassandra 3.0 is released.
- July 27, 2021: Cassandra 4.0 is released, six years after 3.0.
- September 5, 2024: Cassandra 5.0 is released.
Did you know?
- Named after a cursed prophetess: according to Wikipedia [S], the Facebook developers chose Cassandra, the Trojan prophetess condemned never to be believed.
- Three names at SIGMOD 2008: the first public presentation, at SIGMOD 2008, is by Avinash Lakshman, Prashant Malik and Karthik Ranganathan, the engineer who migrated the existing MySQL data into Cassandra for the first deployment.
- Surviving Hurricane Sandy: "During Hurricane Sandy, we lost an entire data center. Completely. Lost. It." said Outbrain in 2014, adding that the Cassandra data never went offline.
- Transactions, not yet: in 2008, distributed transactions were on the future work list. James Hamilton (Microsoft) commented: "I'll try to talk them out of this one". Lightweight transactions arrived before 2014.
Strengths and limitations
| Strengths | Limitations |
|---|---|
| High availability, native multi-datacenter | Eventual consistency by default, tuned query by query |
| Massive writes, linear scalability | Query-driven data modelling (denormalization) |
| Masterless, no single point of failure | No joins, limited ad hoc queries |
| Fine-grained consistency versus latency tuning | Demanding operations (repairs, compaction) at large scale |
What came next
- HBase: the other Bigtable heir, preferred by Facebook in 2010 for its simpler consistency model.
- Real-time analytical databases such as Druid for aggregation, where Cassandra serves key-based reads.
- Federated analytical queries over Cassandra with Trino.
Sources
raw-data/apache/cassandra/cassandra.md- https://www.cs.cornell.edu/projects/ladis2009/papers/lakshman-ladis2009.pdf
- https://engineering.fb.com/2008/08/25/core-infra/cassandra-a-structured-storage-system-on-a-p2p-network/
- https://www.allthingsdistributed.com/2007/10/amazons_dynamo.html
- https://perspectives.mvdirona.com/2008/07/facebook-releases-cassandra-as-open-source/
- https://techcrunch.com/2008/07/14/facebook-release-data-storage-cluster-code-as-open-source/ [S]
- https://incubator.apache.org/projects/cassandra.html
- https://news.apache.org/foundation/entry/the_apache_software_foundation_announces18
- https://news.apache.org/foundation/entry/the_apache_software_foundation_announces55
- https://engineering.fb.com/2010/11/15/core-infra/the-underlying-technology-of-messages/
- https://cassandra.apache.org/_/index.html
- https://cassandra.apache.org/_/cassandra-basics.html
- https://cassandra.apache.org/_/case-studies.html
- https://cassandra.apache.org/_/blog/Apache-Cassandra-4.0-is-Here.html
- https://cassandra.apache.org/_/blog.html
- https://opensourceconnections.com/blog/2014/09/17/cassandra-summit-2014/ [S]
- https://en.wikipedia.org/wiki/Apache_Cassandra [S]
- Name origin: only sourced by Wikipedia [S]; find a primary source.
- Exact dates for CQL, virtual nodes and lightweight transactions (the 2014 press release lists them without dates).
- Incubation date: the ASF page gives January 2, 2009, Wikipedia [S] says March 2009 (first mailing list message). The ASF press release of May 2010 also says Cassandra left the incubator in March 2010, versus February 17, 2010 on the incubation page.
- Apple figure: reported by the Cassandra site and a Cassandra Summit 2014 recap [S], not by Apple directly.
- DataStax founding: not sourced here.