In case you missed it, this blog post is a recap of Cassandra Lunch #19, covering the combined use of relational databases and Cassandra. We will discuss the advantages of using relational databases and Cassandra separately, before covering the advantages and methods for using both concurrently.
Relational Databases
The typical relational database use case is a setup where objects are stored such that a single master object has many different details in various fields associated with it. Document attributes are 1-1 with an is or has style relationship, meaning that a document is or has certain attributes. Lookup is n to 1, meaning that many different objects are placed within a single category together to define them as a group. Connections are n to n, meaning that any number of things can be related to any other number of things with various relationships.
The advantage of relational databases is that they are consistent since they are often either not distributed or fully replicated. They can do relatively high-speed arbitrary queries. Relational databases have access to joins and views which NoSQL databases may not. They also integrate well with existing BI tools. Relational databases can be ACID compliant, where we can be sure that our data is consistent immediately.
Cassandra
People move to Cassandra because the relational model fails at high speed. Relational databases can’t scale without getting bigger and faster computers. Cassandra is a distributed architecture, so it scales natively. It also provides high speed reads/writes. Cassandra is also a popular choice for moving from relational databases because the structure is familiar. CQL tables are similar to SQL tables. The query languages are also similar.
The advantages of Cassandra are that it runs predefined queries very quickly. Queries that the data model is set up for run quickly. We can materialize our own view for high speeds. Data is replicated, potentially across the entire world. We can run reads and writes from any part of the cluster. Cassandra scales natively and is eventually consistent. Cassandra’s consistency is actually tunable, relating to updating replicas.
Combined
People may use both relational databases and Cassandra as part of a shift from using relational databases to Cassandra to take advantage of its unique capabilities. A microservices model allows parts of your system to use Cassandra while other parts continue using relational databases. Even when most of your platform has shifted to using Cassandra, there are still some good reasons to continue using relational databases. Using CQRS you can update both a Casandra table and a relational database table in response to some events.
Cassandra Use Cases
Use Cassandra in a combined system for transactions, when many users across the world need to be able to access your system, Cassandra can serve them the data that they need quickly. Normal transactions can flow through Cassandra, and enable high speed and high capacity access to users. Cassandra also provides access to big data analytics systems like Spark and Flink. Cassandra’s real-time access capabilities can also do real-time visualization. Combining Cassandra and Spark can also allow you to deploy a model, which is something that cannot be done in a relational database.
Relational Database Use Cases
A relational database’s ensured consistency can help ensure that critical transactions take place. Relational databases with mirrored data from Cassandra tables can be used to run analytics with SQL-only BI tools. SQL also is compatible with SQL compliant Data Warehouses.
ICYMI
Cassandra.Link
Cassandra.Link is a knowledge base that we created for all things Apache Cassandra. Our goal with Cassandra.Link was to not only fill the gap of Planet Cassandra, but to bring the Cassandra community together. Feel free to reach out if you wish to collaborate with us on this project in any capacity.
We are a technology company that specializes in building business platforms. If you have any questions about the tools discussed in this post or about any of our services, feel free to send us an email!