Apache Cassandra is an open source NoSQL database that stores data as collections of key value pairs. It was originally built at Facebook, then released as open source and moved to the Apache Software Foundation, where it has been developed ever since. Its design borrows ideas from two well known systems: Google’s BigTable for how data is organized into column families, and Amazon’s Dynamo for how data is distributed and replicated across a cluster without relying on a single master node.
A write in Cassandra is recorded to the commit log first, then moves to a memtable. Once that memtable reaches its size threshold, its contents are flushed to an SSTable on disk. Data is automatically partitioned and replicated across the cluster as this happens, and Cassandra periodically consolidates SSTables together, clearing out data that is no longer needed in the process.
A read works from the other direction. Cassandra checks the memtable first for the most recent data, then uses bloom filters to quickly narrow down which SSTables on disk are actually worth checking, rather than scanning every file on the node.
Cassandra has never supported ACID transactions in the full, multi row sense a relational database offers, and that tradeoff is deliberate, it is part of what lets Cassandra scale the way it does. Since version 2.0, Cassandra has offered lightweight transactions using the Paxos consensus protocol, which support compare and set operations on a single row, useful for things like making sure a username has not already been claimed before creating it, but not a substitute for a general purpose transaction.
That is changing. Apache Cassandra 6.0, currently in alpha, introduces a new consensus protocol called Accord, which brings general purpose, multi row ACID transactions to Cassandra for the first time. This is a genuinely significant shift, since it opens up workloads, such as financial transactions or inventory reservations, that teams have historically routed to a relational database specifically because Cassandra could not offer that guarantee.
Spark does not talk to Cassandra natively. The connection goes through the Spark Cassandra Connector, a library originally built by DataStax and now developed as part of the Apache Cassandra project itself, which lets Spark read Cassandra tables as DataFrames or RDDs, write Spark data back into Cassandra tables, and run CQL queries directly from a Spark application.
val df = spark.read
.format(“org.apache.spark.sql.cassandra”)
.options(Map(“keyspace” -> “my_keyspace”, “table” -> “my_table”))
.load()
df.write
.format(“org.apache.spark.sql.cassandra”)
.options(Map(“keyspace” -> “my_keyspace”, “table” -> “my_table”))
.mode(“append”)
.save()
This is the piece that actually makes Apache Spark and Cassandra work as a pair, letting Spark’s processing and analytics run directly against data that lives in Cassandra, rather than needing to export it somewhere else first.
You are comfortable designing around Cassandra’s data model rather than relying on complex joins across many tables, which it is not built for.
That covers Cassandra’s architecture and how Spark connects to it. To go further, explore Prwatech’s Apache Spark training program, which includes placement assistance.