Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Redis considered to be CP? [closed]

Tags:

database

redis

In short the brewer's CAP theorem states that any database is either CA,CP or AP

Why do people consider Redis as a CP database?

like image 588
ciochPep Avatar asked Aug 02 '11 05:08

ciochPep


People also ask

Is Redis a CP system?

The Replication chapter states that “Redis is not a CP system with strong consistency” and that “acknowledged writes can still be lost during a failover”.

Why is Redis CP system?

That's why from CAP perspective, Redis is CP because it becomes unavailable in minority partitions. Please note it will still be available in majority partition. You can read more about Redis High Availability here. Refer para titled "Consistency under partitions" for details around Partitioning.

Is Redis consistent or available?

Redis Cluster does not guarantee strong consistency. In practical terms this means that under certain conditions it is possible that Redis Cluster will lose writes that were acknowledged by the system to the client. The first reason why Redis Cluster can lose writes is because it uses asynchronous replication.

How does Redis clustering work?

How does Redis Cluster work? Redis Cluster works by sharding the data in a database. Sharding is a database partitioning scheme in which different rows in a database (or, in the case of Redis, key-value pairs) are distributed across multiple nodes, so that each node contains a portion of the data.


2 Answers

The CAP Theorem refers to distributed computer systems.

Since Redis is not per se distributed (clustering is under development) being CP/CA/PA depends on the clustering implementation.

like image 180
seppo0010 Avatar answered Oct 14 '22 12:10

seppo0010


@seppoo0010 is correct. It is more meaningful to speak of a Redis node in terms of Atomicity, Durability, etc.

Also note that CAP is a somewhat problematic paradigm. I second Dr. Brewer's recommendation of Coda Hale's informative rant. (See also comments by Daniel Abdi). Also note Jeff Darcy and Dan Weinreb's comments.

Stonebraker disagrees.

[Edit: Dan Weinreb's deep digging of CAP really is quite excellent. Highly recommended]

Finally, here is "the proof" of CAP.

like image 29
alphazero Avatar answered Oct 14 '22 13:10

alphazero