Need advice about which tool to choose?Ask the StackShare community!
Cassandra vs Redis: What are the differences?
Introduction
Cassandra and Redis are both popular NoSQL databases known for their high performance and scalability. However, they have distinct differences in terms of data model, data persistence, data types, use cases, and data consistency.
Data Model: Cassandra is a wide-column store database that uses a tabular format with rows and columns to store data. It supports flexible schema design and is suitable for handling large amounts of structured and unstructured data. In contrast, Redis is a key-value store database that uses a simple key-value data model, which is optimized for quick access and data retrieval based on the key.
Data Persistence: Cassandra provides durable storage by persisting data on disk, allowing for high availability and fault tolerance. It also offers tunable consistency levels for reads and writes. On the other hand, Redis primarily stores data in memory for faster access, making it highly scalable and suitable for use cases that require low-latency data access. However, Redis also supports persistence to disk for data durability.
Data Types: Cassandra supports a wide range of data types, including primitive types (e.g., integers, boolean), collections (e.g., lists, sets, maps), and user-defined types. This flexibility facilitates complex data modeling and query operations. In contrast, Redis has a limited set of data types, including strings, lists, sets, sorted sets, and hashes. While the simplicity of these types allows for efficient storage and retrieval, it may require additional application logic for handling complex data structures.
Use Cases: Due to its scalability, fault-tolerance, and support for large data sets, Cassandra is well-suited for use cases that involve storing and processing massive amounts of data, such as big data analytics, content management systems, and time-series data. On the other hand, Redis is commonly used for caching, real-time analytics, pub/sub (publish/subscribe) messaging, and session management, where low-latency data access is crucial.
Data Consistency: Cassandra uses a tunable consistency model that provides eventual consistency by default, allowing for high availability and fault tolerance. It supports configurable consistency levels for both read and write operations. Redis, on the other hand, emphasizes data consistency and provides strong consistency guarantees in a single-node configuration. However, in a distributed setup, Redis also offers eventual consistency like Cassandra.
Scalability: Cassandra is designed for linear scalability, allowing it to handle large workloads by distributing data across multiple nodes. It employs a distributed architecture with built-in mechanisms for automatic data partitioning and replication. Redis, while also capable of horizontal scaling through clustering, is primarily optimized for vertical scaling on a single server by utilizing high-speed RAM and multi-core processors.
In summary, Cassandra excels in handling massive amounts of structured and unstructured data, providing high availability and fault tolerance, while Redis specializes in fast data access and low-latency use cases such as caching and real-time analytics. Both databases offer different trade-offs in terms of data model, persistence, data types, use cases, data consistency, and scalability.
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 Redis
- Performance886
- Super fast542
- Ease of use513
- In-memory cache444
- Advanced key-value cache324
- Open source194
- Easy to deploy182
- Stable164
- Free155
- Fast121
- High-Performance42
- High Availability40
- Data Structures35
- Very Scalable32
- Replication24
- Great community22
- Pub/Sub22
- "NoSQL" key-value data store19
- Hashes16
- Sets13
- Sorted Sets11
- NoSQL10
- Lists10
- Async replication9
- BSD licensed9
- Bitmaps8
- Integrates super easy with Sidekiq for Rails background8
- Keys with a limited time-to-live7
- Open Source7
- Lua scripting6
- Strings6
- Awesomeness for Free5
- Hyperloglogs5
- Transactions4
- Outstanding performance4
- Runs server side LUA4
- LRU eviction of keys4
- Feature Rich4
- Written in ANSI C4
- Networked4
- Data structure server3
- Performance & ease of use3
- Dont save data if no subscribers are found2
- Automatic failover2
- Easy to use2
- Temporarily kept on disk2
- Scalable2
- Existing Laravel Integration2
- Channels concept2
- Object [key/value] size each 500 MB2
- Simple2
Sign up to add or upvote prosMake informed product decisions
Cons of Cassandra
- Reliability of replication3
- Size1
- Updates1
Cons of Redis
- Cannot query objects directly15
- No secondary indexes for non-numeric data types3
- No WAL1