24
Dan Sullivan, Principal DS Applied Technologies NoSQL Now! 2015 August 18-20, 2015 San Jose, California ACID vs BASE: Yet Another False Dichotomy

ACID vs BASE in NoSQL: Another False Dichotomy

Embed Size (px)

Citation preview

Page 1: ACID vs BASE in NoSQL: Another False Dichotomy

Dan Sullivan, PrincipalDS Applied Technologies

NoSQL Now! 2015August 18-20, 2015San Jose, California

ACID vs BASE:Yet Another False

Dichotomy

Page 2: ACID vs BASE in NoSQL: Another False Dichotomy

My Background◆ Data Architect / Engineer

◆ NoSQL and relational data modeler◆ Big data◆ Analytics, machine learning and text

mining◆ Cloud computing

◆ Author◆ No SQL for Mere Mortals◆ Contributor to TechTarget

◆ SearchDataManagement◆ SearchCloudComputing◆ SearchAWS

Page 3: ACID vs BASE in NoSQL: Another False Dichotomy

Overview◆ Quick Intro to ACID and BASE

◆ CAP Theorem

◆ Tradeoffs

◆ Finding a Sweet Spot on the Spectrum

◆ Questions

Page 4: ACID vs BASE in NoSQL: Another False Dichotomy

*Quick Intro to ACID and BASE

Page 5: ACID vs BASE in NoSQL: Another False Dichotomy

Image: blog.mark-taylor.com/Arizona/borrego/2014/08/08/what-is-your-bodys-ph-level/

Page 6: ACID vs BASE in NoSQL: Another False Dichotomy

*ACID

◆ Atomicity - All operations in a transaction succeed or fail together. No partial sets of operations.

◆ Consistency - The database is never in an inconsistent state.

◆ Isolation - Transactions do not interfere with one another

◆ Durability - Transactions are persistent over time and database restarts.

Image: http://www.mhhe.com/physsci/chemistry/chang7/esp/folder_structure/cr/m3/s3/

Page 7: ACID vs BASE in NoSQL: Another False Dichotomy

*BASE

◆ Basic Availability - Tolerate partial failure

◆ Soft State - state of database may change

◆ Eventual Consistency - may be inconsistent in short term, consistent in long term

Image: http://www.mhhe.com/physsci/chemistry/chang7/esp/folder_structure/cr/m3/s3/

Page 8: ACID vs BASE in NoSQL: Another False Dichotomy

*Just Say No To Food Fights

Image: www.zephoria.org/lakoff/2004/10/jon-stewart-on-crossfire.html

Page 9: ACID vs BASE in NoSQL: Another False Dichotomy

*CAP Theorem

Page 10: ACID vs BASE in NoSQL: Another False Dichotomy

Consistency Availability

Partition Tolerance

*You Can’t Have It All

Page 11: ACID vs BASE in NoSQL: Another False Dichotomy

*Actually, you can but … vertical scaling will cost you

Page 12: ACID vs BASE in NoSQL: Another False Dichotomy

*What are You Willing to Sacrifice?

Image: 9gagofthrones.com/tag/ned-stark-dead/

Page 13: ACID vs BASE in NoSQL: Another False Dichotomy

*Consistency? Which One?

◆ Causal

◆ Read-Your-Writes Consistency

◆ Session Consistency

◆ Monotonic Read Consistency

◆ Monotonic Write Consistency

Image: www.pitara.com

Page 14: ACID vs BASE in NoSQL: Another False Dichotomy

*Tradeoffs

Page 15: ACID vs BASE in NoSQL: Another False Dichotomy

*Write Consistency: How Low Can You Go?

◆ Consistency level of NoSQL DB specifies number of successful writes needed

◆ Lower consistency level can yield lower latency operations

◆ Higher consistency yields potentially higher availability

Image: www.bigtrends.com

Page 16: ACID vs BASE in NoSQL: Another False Dichotomy

*Read Consistency: Do You See What I

See?

◆ Network Partitions Fail

◆ Writes are not replicated immediately

◆ Possibly,same query different result

Image: www.pitara.com

Page 17: ACID vs BASE in NoSQL: Another False Dichotomy

*What is Your Tolerance?

Image: www.rosstraining.com (modified)

Inconsistency

Page 18: ACID vs BASE in NoSQL: Another False Dichotomy

*Finding a Sweet Spot on the ACID-

BASE Spectrum

Page 19: ACID vs BASE in NoSQL: Another False Dichotomy

*Partitioning

◆ Functional Partitioning◆ Decompose data by function◆ Use constraints to ensure integrity◆ Isolate constraints to a functional group◆ Vertically scale by functional group

◆ When Functional Partitioning is Not Enough Shard◆ Split functional groups of data across database servers◆ Benefits fo scalability and availability ◆ Introduces CAP Theorem Constraints

Page 20: ACID vs BASE in NoSQL: Another False Dichotomy

*Out of the Database and Into the Application

◆ Without ACID transactions in database, application handles more data management

◆ Balance low latency with high availability

◆ Application code becomes complex when need strong consistency and wide-area replication

Image: http://www.learnamericanenglishonline.com/

Page 21: ACID vs BASE in NoSQL: Another False Dichotomy

*Questions to Ask

◆ Can you tolerate inconsistency across functional groups?

◆ Which type of consistency is needed?

◆ Is short term inconsistency acceptable?

◆ Can an end user ever see the effect of an inconsistent state?

Image: http://www.learnamericanenglishonline.com/

Page 22: ACID vs BASE in NoSQL: Another False Dichotomy

*Where is this Leading?Image: http://www.learnamericanenglishonline.com/

“Google is living a few years in the future and sending the rest of us messages.”Doug Cutting

Hadoop Co-creator

◆ Increasing Support for ACID in NoSQL

◆ Fine-grained Management of CAP Constraints◆ Paxos state machines◆ Replication controlled at application level◆ Synchronous replication (Google Megastore), longer latency

◆ Point in time Consistency

◆ Better methods to deal with clock uncertainty

Page 23: ACID vs BASE in NoSQL: Another False Dichotomy

*From the Makers of BigTable

Image: http://static.googleusercontent.com/media/research.google.com/en//archive/spanner-osdi2012.pdf

Inconsistency

Page 24: ACID vs BASE in NoSQL: Another False Dichotomy

Questions?