cassandra read/write paths
TRANSCRIPT
Cassandra Read / Write
John Sumsion from FamilySearch Utah Cassandra Meetup
13 Aug. 2015
Agenda
• Rows vs ParGGons/Cells • Kinds of OperaGons • Datafile View • Machine View • New in Cassandra 3.0.0-‐alpha1
• OLTP on 500M+ enGGes • Course grain data model -‐ persons in pedigree
Agenda
• Rows vs ParGGons/Cells • Kinds of OperaGons • Datafile View • Machine View • New in Cassandra 3.0.0-‐alpha1
Rows vs ParGGons/Cells
Rows vs ParGGons/Cells
• Example -‐ User / Movie raGngs – U1: M423: 4 stars, “I liked it”, 8/20/2011 – U1: M205: 1 stars, “Won’t go again”, 7/29/2011 – U2: M423: 3 stars, “Movie was ok”, 7/1/2013 – U3: M423: 5 stars, “My favorite”, 6/23/2014
• The user id (U1) is the parGGon key • The movie id (M423) is the clustering key • All other values are not part of any key
Agenda
• Rows vs ParGGons/Cells • Kinds of OperaGons • Datafile View • Machine View • New in Cassandra 3.0.0-‐alpha1
Kinds of OperaGons
Rows vs ParGGons/Cells
• Example -‐ User / Movie raGngs – U1 | M423; 8/20/2011 | 4 stars, “I liked it” – U1 | M205; 7/29/2011 | 1 stars, “Won’t go again” – U2 | M423; 7/1/2013 | 3 stars, “Movie was ok” – U3 | M423; 6/23/2014 | 5 stars, “My favorite”
• ParGGon read (all values for U1) • Range scan read (raGng from U1 for M243) • Update cell (change raGng for U2, M423)
Agenda
• Rows vs ParGGons/Cells • Kinds of OperaGons • Datafile View • Machine View • New in Cassandra 3.0.0-‐alpha1
Datafile View -‐ RDBMS
Datafile View -‐ Cassandra
Datafile View -‐ Cassandra
Datafile View -‐ Cassandra
Datafile View -‐ Cassandra
Datafile View -‐ Cassandra
Datafile View -‐ Cassandra
Datafile View -‐ Cassandra
Datafile View -‐ Cassandra
Datafile View -‐ Cassandra
Agenda
• Rows vs ParGGons/Cells • Kinds of OperaGons • Datafile View -‐ Cassandra Writes • Machine View • New in Cassandra 3.0.0-‐alpha1
Datafile View -‐ Cassandra Writes
Datafile View -‐ Cassandra Writes
Datafile View -‐ Cassandra Writes
Datafile View -‐ Cassandra Writes
Datafile View -‐ Cassandra Writes
Datafile View -‐ Cassandra Writes
Datafile View -‐ Cassandra Writes
• Three supported compacGon strategies: 1. Size-‐Gered 2. Fixed-‐size (leveled) 3. Date-‐Gme
Datafile View -‐ Cassandra Writes Size-‐Tiered (STCS) Fixed-‐Size (or Leveled, LCS)
Datafile View -‐ Cassandra Writes Size-‐Tiered (STCS) Fixed-‐Size (or Leveled, LCS)
Date-‐Time
Datafile View -‐ Cassandra Writes
Date-‐Time
Fixed-‐Size (or Leveled, LCS) Size-‐Tiered (STCS)
Agenda
• Rows vs ParGGons/Cells • Kinds of OperaGons • Datafile View -‐ Cassandra Writes • Machine View • New in Cassandra 3.0.0-‐alpha1
Machine View -‐ RDBMS
Many styles, someGmes combined: • High verGcal scale, many-‐core, R/W • Master serving R/W, slaves serving R • Hot standby for machine failure
Each opGon is costly to engineer and build.
Machine View -‐ Cassandra
Agenda
• Rows vs ParGGons/Cells • Kinds of OperaGons • Datafile View -‐ Cassandra Writes • Machine View • New in Cassandra 3.0.0-‐alpha1
New in Cassandra 3.0.0-‐alpha1
CASSANDRA-‐8099 • New file format
opGmizaGons • Like run-‐length
encoding for redundant data
• More efficient to scan / read
Takeaways
• Think parGGons / cells not rows • Think scaier / gather, not direct read • Think scale out & opGmize, not scale up
• Core Cassandra read/write paths are gekng some serious aienGon and opGmizaGon
Data Model Ideas
• Data model ideas for consistency? search “John Sumsion CassandraSummit 2014”
Wrap-‐up
• Rows vs ParGGons/Cells • Kinds of OperaGons • Datafile View -‐ Cassandra Writes • Machine View • New in Cassandra 3.0.0-‐alpha1
• John Sumsion • Email: [email protected]