The CAP theorem: Consistency and Availability except when Partitioned

Some NoSQL databases present their implementations of eventual consistency (or other weak consistency variants) as an inevitable consequence of Brewer's CAP Theorem. The reasoning justifying such design choices goes more or less like this:


  • My NoSQL database is distributed, possibly across continental distances (with the ensuing network latency), for scalability and for availability. Because it is a distributed system, I will get network partitions / partial failures. (I can't avoid Brewer's P).

  • My NoSQL database cannot be completely unavailable every time there is a partition (I need Brewer's A).

  • The CAP theorem says* that in a distributed system I can have only 2 of C, A, and P.

  • I can't avoid P and want A, therefore I can't have C -- my NoSQL database will support only eventual or other weak consistency. 

  • This reasoning, however, is flawed, because it relies on a simplistic interpretation (* above) of the CAP theorem. This phrasing is simplistic because the three properties of the CAP theorem are not fully orthogonal, nor is each a binary quantity, and each may have different values at different levels of a system. For example, the question of whether a system is currently partitioned, may not admit a single system-wide consistent answer. A better phrasing of CAP is:


    In a distributed system, you can have both Consistency and Availability, except when there is a Partition. 


    Relaxing the consistency requirements usually makes it easier to maintain availability, but the CAP theorem is not an excuse to give up strong consistency across the board. A well-designed system can balance both availability and consistency while tolerating partitions over a range of tradeoffs, where eventual consistency is just one possibility. The next post discusses these points in more detail.




    Comments:

    Post a Comment:
    Comments are closed for this entry.
    About

    Musings on Oracle's Maximum Availability Architecture (MAA), by members of Oracle Development team. Note that we may not have the bandwidth to answer generic questions on MAA.

    Search

    Categories
    Archives
    « April 2014
    SunMonTueWedThuFriSat
      
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
       
           
    Today