Atomic batches in 2013, single-partition Paxos compare-and-swap later that year, and now strictly serializable cross-partition transactions with Accord in unreleased Cassandra 6. We explore each on a three-node cluster with an accounting workload.
You are getting early access to this article as a subscriber. Your support makes articles like this possible. Thank you.
Cassandra is a compelling data system. It is one of extremely few vendor-neutral, open-source databases supporting a SQL-like query language with builtin sharding and builtin replication. A desirable combination. And a reason Cassandra has so many (large) users including Apple, eBay, Bloomberg, and Netflix.
Cassandra has evolved significantly since its first release. From an eventually consistent data model without transactions and a schemaless, NoSQL interface over Thrift to where (in the upcoming 6.0 release) it stands as an ACID transactional SQL-like database (granted: severe SQL limitations, transactions are non-interactive, we’ll get to that later).
Meanwhile the lack of joins plus automatic sharding (and a limited secondary index story) means a key characteristic has stayed the same: you model tables based on queries. And as a result your application might end up denormalizing, turning a single write into multiple writes in order to position the database to efficiently answer different queries later on.
In this article we’ll set up a three-node Cassandra cluster on one machine, running the cassandra-6.0 branch (a pre-release state) to test out some transactional workloads across four of Cassandra’s transactional options: none (the default), BATCH updates, Lightweight transaction (LWT) updates, and Accord (i.e. ACID) updates. Accord transactions will become available only when Cassandra 6 is released (perhaps later this year), which is why we are using the pre-release branch.
Setting up a cluster#
Install Java 21 and the ant build system, and gcc and Go for our concurrent test runner Monastery.
sudo apt-get install -y openjdk-21-jdk ant gcc golang git clone https://github.com/theconsensuslabs/monastery cd monastery CGO_ENABLED = 1 go build -buildmode = plugin -o cql.so ./plugins/cql CGO_ENABLED = 1 go build -o monastery .
Then grab and build Cassandra.
... continue reading