Need advice about which tool to choose?Ask the StackShare community!
Cassandra vs Google Cloud Spanner: What are the differences?
Introduction: Cassandra and Google Cloud Spanner are both widely used and powerful distributed database systems. However, they differ in several key aspects. This article aims to highlight the key differences between Cassandra and Google Cloud Spanner.
Data Model: Cassandra is a NoSQL database that follows a columnar data model, while Google Cloud Spanner is a globally distributed relational database with support for strong consistency. This means Cassandra is schema-less and allows flexible data modeling, while Spanner enforces a relational model with schemas and relationships between tables.
Scalability: Cassandra is designed for massive scalability and can easily handle a large amount of data and high traffic workloads. It can distribute data across multiple nodes in a cluster for improved performance and fault tolerance. On the other hand, while Spanner is also designed for scalability, it provides automatic scaling within predefined limits and offers global consistency, which comes with additional coordination overhead.
Consistency Model: Cassandra follows a tunable consistency model, which allows choosing the level of consistency between replicas based on performance and reliability requirements. It provides eventual consistency by default but can be configured for strong consistency if needed. In contrast, Spanner offers strong consistency globally, ensuring that all replicas see the same consistent data at all times.
Query Language: Cassandra uses Cassandra Query Language (CQL), which is similar to SQL but has some differences due to its NoSQL nature. It supports querying using CQL statements and has built-in support for secondary indexes. On the other hand, Spanner supports SQL-like queries with its own enhancements for distributed querying and scale. It provides transactional SQL semantics and supports powerful features like joins, indexing, and multi-version concurrency control.
Architecture: Cassandra follows a masterless distributed architecture, where all nodes in the cluster are equal peers. It uses a peer-to-peer gossip protocol for coordination and event dissemination. Spanner, on the other hand, has a distributed architecture with a single-node leader and multiple followers. It uses the Paxos algorithm for consensus and replication to ensure consistency and fault tolerance.
Pricing Model: Cassandra is an open-source project and can be used without any licensing fees. However, the cost of running and managing a Cassandra cluster can vary based on factors like infrastructure costs, maintenance efforts, and support requirements. Google Cloud Spanner, being a managed service, has a usage-based pricing model that considers factors like the number of nodes, storage, and data transfer. It provides automatic replication and maintenance, reducing the operational overhead for users.
In summary, Cassandra is a highly scalable, schema-less NoSQL database with tunable consistency and a flexible data model. Google Cloud Spanner is a globally distributed relational database with strong consistency, automatic scaling, and transactional SQL semantics. The choice between the two depends on the specific requirements of the application, such as data model flexibility, consistency needs, scalability, query language preference, and cost considerations.
The problem I have is - we need to process & change(update/insert) 55M Data every 2 min and this updated data to be available for Rest API for Filtering / Selection. Response time for Rest API should be less than 1 sec.
The most important factors for me are processing and storing time of 2 min. There need to be 2 views of Data One is for Selection & 2. Changed data.
Scylla can handle 1M/s events with a simple data model quite easily. The api to query is CQL, we have REST api but that's for control/monitoring
Cassandra is quite capable of the task, in a highly available way, given appropriate scaling of the system. Remember that updates are only inserts, and that efficient retrieval is only by key (which can be a complex key). Talking of keys, make sure that the keys are well distributed.
i love syclla for pet projects however it's license which is based on server model is an issue. thus i recommend cassandra
By 55M do you mean 55 million entity changes per 2 minutes? It is relatively high, means almost 460k per second. If I had to choose between Scylla or Cassandra, I would opt for Scylla as it is promising better performance for simple operations. However, maybe it would be worth to consider yet another alternative technology. Take into consideration required consistency, reliability and high availability and you may realize that there are more suitable once. Rest API should not be the main driver, because you can always develop the API yourself, if not supported by given technology.
Pros of Cassandra
- Distributed119
- High performance98
- High availability81
- Easy scalability74
- Replication53
- Reliable26
- Multi datacenter deployments26
- Schema optional10
- OLTP9
- Open source8
- Workload separation (via MDC)2
- Fast1
Pros of Google Cloud Spanner
- Strongly consistent1
- Horizontal scaling1
- Scalable1
Sign up to add or upvote prosMake informed product decisions
Cons of Cassandra
- Reliability of replication3
- Size1
- Updates1