Cassandra to Get ACID Transactions via New Accord Consensus Protocol
The next release of Apache Cassandra, the super-scalable NoSQL database backed by DataStax, will gain support for ACID transactions, thereby opening it up for more demanding use cases. The method that will enable transactions is a new distributed transaction protocol dubbed Accord.
ACID refer to the ability of a computer system to maintain four attributes as it processes transactions, including atomicity, consistency, isolation, and durability. For some types of applications, such as banking applications, ACID support provide the best guarantee that transactions are bullet-proof and will processed as expected, even amid network and computer failures.
Traditional relational database management systems (RDBMS) like Oracle, Postgres, and SQL Server have long offered full ACID transaction support as a core feature. Banks and other organizations that demanded the highest level of integrity for their transactions built their applications atop RDBMS, which have been the standard bearer for enterprise computing for the past 40-plus years.
However, spurned by the relative rigidity of relational databases, many developers over the past 15 years have switched to a new class of databases, loosely grouped into the NoSQL category. These systems, such as Apache Cassandra and MongoDB, offered features like schema flexibility and distributed scalability that are desired by developers, but typically come at the cost of full ACID support.
Now many of these popular NoSQL databases (as well as some new distributed SQL databases) are trying to deliver ACID transaction support but without compromising on the features that made them popular alternatives to traditional RDBMS in the first place.
Several different methods of arriving at a consensus among nodes in a distributed cluster have been used. Paxos is the name of one of the first consensus protocols, which helps coordinate a consensus among the various nodes in a database to determine what the value should be. Google Cloud Spanner uses Paxos along with atomic clocks to provide a globally consistent distributed database. Since 2013, Apache Cassandra has used the Paxos consensus protocol, but it only enables a form of “lightweight” transactions (as it doesn’t work at the database “table” level).
MongoDB delivered full ACID support over four years ago using a version of the Raft consensus protocol, which was a follow-on to Paxos. CockroachDB, a scalable relational database, also uses Raft, as does YugaByte, another new SQL database, and Neo4j, a graph database. Other databases have adopted the Calvin consensus algorithm, including FaunaDB, a NoSQL database created by former Twitter engineers, and FoundationDB, a NoSQL database acquired by Apple in 2015 and subsequently open sourced in 2018.
While some databases are getting traction out of the Raft and Calvin consensus protocols, their use of a single elected leader and need for multiple round-trips among the nodes in a cluster would introduce unacceptable limitations to the shared-nothing architecture of Cassandra, says Patrick McFadin, the vice president of developer relations and chief evangelist for Cassandra at DataStax.
“Cassandra assumes failures as a part of running a large distributed system. One or more nodes going offline should not cause rapid performance degradation or availability issues,” McFadin writes in a recent story announcing ACID support for Cassandra in The New Stack. “Our criteria are about holding true to the core beliefs on how distributed systems should run. Performance and scaling should always be preserved while operating multiple nodes across one or more data centers.”
However, with the Accord protocol created by researchers at Apple and the University of Michigan, the folks at DataStax think they have found a way for Cassandra to deliver support for full ACID transactions while maintaining its performance and scalability standards.
According to McFadin, Accord tackles two problems that Raft and Calvin have been unable to solve, including “how can we have a globally available consensus and achieve it in one round trip?”
The first novel mechanism, he says, is the reorder buffer, which measures the difference between nodes in addition to the latency between them. “Each replica can use this information to correctly order data from each node and account for the differences, guaranteeing one round-trip consensus with a timestamp protocol,” McFadin writes.
The second mechanism is fast-path electorates. “Failure modes can create latency when electing a new leader before resuming,” the DataStax VP writes. “Fast-path electorates use pre-existing features in Cassandra with some novel implementations to maintain a leaderless fast path to quorum under the same level of failure tolerated by Cassandra.”
A recent white paper on Accord describes the protocol in greater detail. The white paper, which was written by three Apple researchers, including Benedict Elliot Smith, Blake Eggleston, and Scott Andreas, and one University of Michigan researcher, Tony Zhang, is available here.
“Compared to prior systems that achieve strict serializable multi-shard transactions, Accord achieves optimal performance by utilizing real time timestamps and a message reorder buffer,” the researchers write. “Unlike Tempo [another recently proposed consensus protocol], Accord does not rely on additional periodic broadcast mechanisms for timestamp stability, and commutative commands do not interfere.
“Importantly, Accord addresses the poor fast-path stability of existing systems by introducing a configurable fast-path electorate. This provides optimal failure tolerance and consistent performance under any number of tolerated failures. Accord is the first leaderless protocol that is sufficiently stable for practical use in a large scale industrial database system. Finally, to the best of our knowledge, no commercial or open-source database systems offer strict serializable transactions across regions in a single wide area round-trip.”
The work to integrate Accord into Cassandra is still ongoing, according to McFadin. But Cassandra users can expect that work to be done by the next major release of Cassandra, which will be the first to support full transactions, he says.
AWS Working to Scale Aurora DB Writes Globally, Like Spanner
Cockroach Labs Ready for Primetime with Scale-Out Database
Has FaunaDB Cracked the Code for Global Transactionality?