SlideShare a Scribd company logo
©2013 DataStax Confidential. Do not distribute without consent.
Jon Haddad, Luke Tillman
Technical Evangelists, DataStax
@rustyrazorblade, @LukeTillman
Cassandra Core Concepts
1
Small Data
• 100's of MB to low GB, single user
• sed, awk, grep are great
• sqlite
• Limitations:
• bad for multiple concurrent users (file sharing!)
Medium Data
• Fits on 1 machine
• RDBMS is fine
• postgres
• mysql
• Supports hundreds of concurrent
users
• ACID makes us feel good
• Scales vertically
Can RDBMS work for big data?
Replication: ACID is a lie
Client
Master Slave
replication lag
Consistent results? Nope!
Third Normal Form Doesn't Scale
• Queries are unpredictable
• Users are impatient
• Data must be denormalized
• If data > memory, you = history
• Disk seeks are the worst
(SELECT
CONCAT(city_name,', ',region) value,
latitude,
longitude,
id,
population,
( 3959 * acos( cos( radians($latitude) ) *
cos( radians( latitude ) ) * cos( radians( longitude )
- radians($longitude) ) + sin( radians($latitude) ) *
sin( radians( latitude ) ) ) )
AS distance,
CASE region
WHEN '$region' THEN 1
ELSE 0
END AS region_match
FROM `cities`
$where and foo_count > 5
ORDER BY region_match desc, foo_count desc
limit 0, 11)
UNION
(SELECT
CONCAT(city_name,', ',region) value,
latitude,
longitude,
id,
population,
( 3959 * acos( cos( radians($latitude) ) *
cos( radians( latitude ) ) * cos( radians( longitude )
- radians($longitude) ) + sin( radians($latitude) ) *
sin( radians( latitude ) ) ) )
Sharding is a Nightmare
• Data is all over the place
• No more joins
• No more aggregations
• Denormalize all the things
• Querying secondary indexes
requires hitting every shard
• Adding shards requires manually
moving data
• Schema changes
High Availability.. not really
• Master failover… who's responsible?
• Another moving part…
• Bolted on hack
• Multi-DC is a mess
• Downtime is frequent
• Change database settings (innodb buffer
pool, etc)
• Drive, power supply failures
• OS updates
Summary of Failure
• Scaling is a pain
• ACID is naive at best
• You aren't consistent
• Re-sharding is a manual process
• We're going to denormalize for
performance
• High availability is complicated,
requires additional operational
overhead
Lessons Learned
• Consistency is not practical
• So we give it up
• Manual sharding & rebalancing is hard
• So let's build in
• Every moving part makes systems more complex
• So let's simplify our architecture - no more master / slave
• Scaling up is expensive
• We want commodity hardware
• Scatter / gather no good
• We denormalize for real time query performance
• Goal is to always hit 1 machine
What is Apache Cassandra?
• Fast Distributed Database
• High Availability
• Linear Scalability
• Predictable Performance
• No SPOF
• Multi-DC
• Commodity Hardware
• Easy to manage operationally
• Not a drop in replacement for
RDBMS
Hash Ring
• No master / slave / replica sets
• No config servers, zookeeper
• Data is partitioned around the ring
• Data is replicated to RF=N servers
• All nodes hold data and can answer
queries (both reads & writes)
• Location of data on ring is
determined by partition key
CAP Tradeoffs
• Impossible to be both consistent and
highly available during a network
partition
• Latency between data centers also
makes consistency impractical
• Cassandra chooses Availability &
Partition Tolerance over Consistency
Replication
• Data is replicated automatically
• You pick number of servers
• Called “replication factor” or RF
• Data is ALWAYS replicated to each
replica
• If a machine is down, missing data
is replayed via hinted handoff
Consistency Levels
• Per query consistency
• ALL, QUORUM, ONE
• How many replicas for query to respond OK
Multi DC
• Typical usage: clients write to local
DC, replicates async to other DCs
• Replication factor per keyspace per
datacenter
• Datacenters can be physical or logical
Reads & Writes
The Write Path
• Writes are written to any node in the cluster
(coordinator)
• Writes are written to commit log, then to
memtable
• Every write includes a timestamp
• Memtable flushed to disk periodically
(sstable)
• New memtable is created in memory
• Deletes are a special write case, called a
“tombstone”
Compaction
• sstables are immutable
• updates are written to new sstables
• eventually we have too many files on disk
• Merged through compaction, only latest
data is kept based on timestamp
sstable sstable sstable
sstable
The Read Path
• Any server may be queried, it acts as the
coordinator
• Contacts nodes with the requested key
• On each node, data is pulled from
SSTables and merged
• Consistency< ALL performs read repair
in background (read_repair_chance)
What are your options?
Open Source
• Latest, bleeding edge features
• Monthly releases (tick tock)
• File JIRAs
• Support via mailing list & IRC
• Fix bugs
• cassandra.apache.org
• Perfect for hacking
DataStax Enterprise
• Integrated Multi-DC Search
• Integrated Spark for Analytics
• Free Startup Program
• <3MM rev & <$30M funding
• Extended support
• Additional QA
• Focused on stable releases for enterprise
Cassandra Core Concepts
©2013 DataStax Confidential. Do not distribute without consent. 25

More Related Content

PPTX
Cassandra @ Sony: The good, the bad, and the ugly part 1
PDF
Standing Up Your First Cluster
PPTX
Cassandra @ Sony: The good, the bad, and the ugly part 2
PDF
Cassandra Community Webinar: Apache Spark Analytics at The Weather Channel - ...
PPTX
Cassandra Adoption on Cisco UCS & Open stack
PPTX
mParticle's Journey to Scylla from Cassandra
PDF
Real Time Analytics with Dse
PDF
Cassandra Summit 2014: Apache Cassandra Best Practices at Ebay
Cassandra @ Sony: The good, the bad, and the ugly part 1
Standing Up Your First Cluster
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra Community Webinar: Apache Spark Analytics at The Weather Channel - ...
Cassandra Adoption on Cisco UCS & Open stack
mParticle's Journey to Scylla from Cassandra
Real Time Analytics with Dse
Cassandra Summit 2014: Apache Cassandra Best Practices at Ebay

What's hot (20)

PDF
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
PPTX
Introducing DataStax Enterprise 4.7
PDF
Real-time Cassandra
PPTX
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
PPTX
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
PDF
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
PPTX
Scylla Summit 2018: Scalable Stream Processing with KSQL, Kafka and ScyllaDB
PDF
Azure + DataStax Enterprise Powers Office 365 Per User Store
PDF
The True Cost of NoSQL DBaaS Options
PDF
Diagnosing Problems in Production (Nov 2015)
PPTX
Scylla Summit 2018: Joining Billions of Rows in Seconds with One Database Ins...
PPTX
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
PDF
Cassandra at eBay - Cassandra Summit 2013
PDF
Cassandra in e-commerce
PDF
Scylla Summit 2016: Why Kenshoo is about to displace Cassandra with Scylla
PDF
The Last Pickle: Distributed Tracing from Application to Database
PDF
Pythian: My First 100 days with a Cassandra Cluster
PDF
ScyllaDB: What could you do with Cassandra compatibility at 1.8 million reque...
PPTX
Webinar: DataStax Training - Everything you need to become a Cassandra Rockstar
PDF
Cisco: Cassandra adoption on Cisco UCS & OpenStack
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
Introducing DataStax Enterprise 4.7
Real-time Cassandra
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Scylla Summit 2018: Scalable Stream Processing with KSQL, Kafka and ScyllaDB
Azure + DataStax Enterprise Powers Office 365 Per User Store
The True Cost of NoSQL DBaaS Options
Diagnosing Problems in Production (Nov 2015)
Scylla Summit 2018: Joining Billions of Rows in Seconds with One Database Ins...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Cassandra at eBay - Cassandra Summit 2013
Cassandra in e-commerce
Scylla Summit 2016: Why Kenshoo is about to displace Cassandra with Scylla
The Last Pickle: Distributed Tracing from Application to Database
Pythian: My First 100 days with a Cassandra Cluster
ScyllaDB: What could you do with Cassandra compatibility at 1.8 million reque...
Webinar: DataStax Training - Everything you need to become a Cassandra Rockstar
Cisco: Cassandra adoption on Cisco UCS & OpenStack
Ad

Viewers also liked (20)

PDF
Advanced Cassandra
PPTX
Bad Habits Die Hard
PDF
Introduction to Data Modeling with Apache Cassandra
PDF
Advanced Data Modeling with Apache Cassandra
PDF
Data Modeling for Apache Cassandra
PPTX
Introduction to DataStax Enterprise Graph Database
PDF
Apache Cassandra and Drivers
PDF
Production Ready Cassandra
PDF
Coursera Cassandra Driver
PPTX
Enabling Search in your Cassandra Application with DataStax Enterprise
PDF
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
PDF
Cassandra 3.0 Data Modeling
PPTX
Cassandra on Docker @ Walmart Labs
PDF
Getting Started with Graph Databases
PDF
Analytics with Spark and Cassandra
PDF
Cassandra Data Maintenance with Spark
PDF
Cassandra Core Concepts - Cassandra Day Toronto
PDF
Cassandra: One (is the loneliest number)
PDF
Successful Software Development with Apache Cassandra
PDF
Client Drivers and Cassandra, the Right Way
Advanced Cassandra
Bad Habits Die Hard
Introduction to Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
Data Modeling for Apache Cassandra
Introduction to DataStax Enterprise Graph Database
Apache Cassandra and Drivers
Production Ready Cassandra
Coursera Cassandra Driver
Enabling Search in your Cassandra Application with DataStax Enterprise
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra 3.0 Data Modeling
Cassandra on Docker @ Walmart Labs
Getting Started with Graph Databases
Analytics with Spark and Cassandra
Cassandra Data Maintenance with Spark
Cassandra Core Concepts - Cassandra Day Toronto
Cassandra: One (is the loneliest number)
Successful Software Development with Apache Cassandra
Client Drivers and Cassandra, the Right Way
Ad

Similar to Cassandra Core Concepts (20)

PDF
Cassandra Core Concepts
PDF
Intro to Cassandra
PDF
Getting started with Spark & Cassandra by Jon Haddad of Datastax
PPTX
BigData Developers MeetUp
PPTX
Cassandra & Python - Springfield MO User Group
PDF
Spark and cassandra (Hulu Talk)
PDF
LJC: Fault tolerance with Apache Cassandra
PDF
An Introduction to Apache Cassandra
PPTX
Cassandra training
PPT
No sql
PPTX
L6.sp17.pptx
PPTX
Using Cassandra with your Web Application
PDF
BigData as a Platform: Cassandra and Current Trends
PPT
NOSQL Database: Apache Cassandra
PPTX
Exploring NoSQL and implementing through Cassandra
PPTX
How to size up an Apache Cassandra cluster (Training)
PPTX
Cassandra Architecture FTW
PDF
Highly available, scalable and secure data with Cassandra and DataStax Enterp...
PDF
Cassandra
PPTX
Cassandra via-docker
Cassandra Core Concepts
Intro to Cassandra
Getting started with Spark & Cassandra by Jon Haddad of Datastax
BigData Developers MeetUp
Cassandra & Python - Springfield MO User Group
Spark and cassandra (Hulu Talk)
LJC: Fault tolerance with Apache Cassandra
An Introduction to Apache Cassandra
Cassandra training
No sql
L6.sp17.pptx
Using Cassandra with your Web Application
BigData as a Platform: Cassandra and Current Trends
NOSQL Database: Apache Cassandra
Exploring NoSQL and implementing through Cassandra
How to size up an Apache Cassandra cluster (Training)
Cassandra Architecture FTW
Highly available, scalable and secure data with Cassandra and DataStax Enterp...
Cassandra
Cassandra via-docker

More from DataStax Academy (6)

PDF
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
PDF
Make 2016 your year of SMACK talk
PPTX
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
PDF
Traveler's Guide to Cassandra
PPTX
Spark Cassandra Connector: Past, Present and Furure
PDF
New features in 3.0
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
Make 2016 your year of SMACK talk
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
Traveler's Guide to Cassandra
Spark Cassandra Connector: Past, Present and Furure
New features in 3.0

Recently uploaded (20)

PDF
DevOps & Developer Experience Summer BBQ
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
How Much Does It Cost to Build a Train Ticket App like Trenitalia in Italy.pptx
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Dell Pro 14 Plus: Be better prepared for what’s coming
PDF
CIFDAQ's Token Spotlight: SKY - A Forgotten Giant's Comeback?
PDF
Reimagining Insurance: Connected Data for Confident Decisions.pdf
PDF
REPORT: Heating appliances market in Poland 2024
PDF
CIFDAQ's Teaching Thursday: Moving Averages Made Simple
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Google’s NotebookLM Unveils Video Overviews
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
PDF
Chapter 2 Digital Image Fundamentals.pdf
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PDF
Why Endpoint Security Is Critical in a Remote Work Era?
PDF
Top Generative AI Tools for Patent Drafting in 2025.pdf
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
DevOps & Developer Experience Summer BBQ
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
How Much Does It Cost to Build a Train Ticket App like Trenitalia in Italy.pptx
madgavkar20181017ppt McKinsey Presentation.pdf
Dell Pro 14 Plus: Be better prepared for what’s coming
CIFDAQ's Token Spotlight: SKY - A Forgotten Giant's Comeback?
Reimagining Insurance: Connected Data for Confident Decisions.pdf
REPORT: Heating appliances market in Poland 2024
CIFDAQ's Teaching Thursday: Moving Averages Made Simple
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Google’s NotebookLM Unveils Video Overviews
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
A Day in the Life of Location Data - Turning Where into How.pdf
Chapter 2 Digital Image Fundamentals.pdf
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
Why Endpoint Security Is Critical in a Remote Work Era?
Top Generative AI Tools for Patent Drafting in 2025.pdf
NewMind AI Weekly Chronicles - July'25 - Week IV

Cassandra Core Concepts

  • 1. ©2013 DataStax Confidential. Do not distribute without consent. Jon Haddad, Luke Tillman Technical Evangelists, DataStax @rustyrazorblade, @LukeTillman Cassandra Core Concepts 1
  • 2. Small Data • 100's of MB to low GB, single user • sed, awk, grep are great • sqlite • Limitations: • bad for multiple concurrent users (file sharing!)
  • 3. Medium Data • Fits on 1 machine • RDBMS is fine • postgres • mysql • Supports hundreds of concurrent users • ACID makes us feel good • Scales vertically
  • 4. Can RDBMS work for big data?
  • 5. Replication: ACID is a lie Client Master Slave replication lag Consistent results? Nope!
  • 6. Third Normal Form Doesn't Scale • Queries are unpredictable • Users are impatient • Data must be denormalized • If data > memory, you = history • Disk seeks are the worst (SELECT CONCAT(city_name,', ',region) value, latitude, longitude, id, population, ( 3959 * acos( cos( radians($latitude) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($longitude) ) + sin( radians($latitude) ) * sin( radians( latitude ) ) ) ) AS distance, CASE region WHEN '$region' THEN 1 ELSE 0 END AS region_match FROM `cities` $where and foo_count > 5 ORDER BY region_match desc, foo_count desc limit 0, 11) UNION (SELECT CONCAT(city_name,', ',region) value, latitude, longitude, id, population, ( 3959 * acos( cos( radians($latitude) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($longitude) ) + sin( radians($latitude) ) * sin( radians( latitude ) ) ) )
  • 7. Sharding is a Nightmare • Data is all over the place • No more joins • No more aggregations • Denormalize all the things • Querying secondary indexes requires hitting every shard • Adding shards requires manually moving data • Schema changes
  • 8. High Availability.. not really • Master failover… who's responsible? • Another moving part… • Bolted on hack • Multi-DC is a mess • Downtime is frequent • Change database settings (innodb buffer pool, etc) • Drive, power supply failures • OS updates
  • 9. Summary of Failure • Scaling is a pain • ACID is naive at best • You aren't consistent • Re-sharding is a manual process • We're going to denormalize for performance • High availability is complicated, requires additional operational overhead
  • 10. Lessons Learned • Consistency is not practical • So we give it up • Manual sharding & rebalancing is hard • So let's build in • Every moving part makes systems more complex • So let's simplify our architecture - no more master / slave • Scaling up is expensive • We want commodity hardware • Scatter / gather no good • We denormalize for real time query performance • Goal is to always hit 1 machine
  • 11. What is Apache Cassandra? • Fast Distributed Database • High Availability • Linear Scalability • Predictable Performance • No SPOF • Multi-DC • Commodity Hardware • Easy to manage operationally • Not a drop in replacement for RDBMS
  • 12. Hash Ring • No master / slave / replica sets • No config servers, zookeeper • Data is partitioned around the ring • Data is replicated to RF=N servers • All nodes hold data and can answer queries (both reads & writes) • Location of data on ring is determined by partition key
  • 13. CAP Tradeoffs • Impossible to be both consistent and highly available during a network partition • Latency between data centers also makes consistency impractical • Cassandra chooses Availability & Partition Tolerance over Consistency
  • 14. Replication • Data is replicated automatically • You pick number of servers • Called “replication factor” or RF • Data is ALWAYS replicated to each replica • If a machine is down, missing data is replayed via hinted handoff
  • 15. Consistency Levels • Per query consistency • ALL, QUORUM, ONE • How many replicas for query to respond OK
  • 16. Multi DC • Typical usage: clients write to local DC, replicates async to other DCs • Replication factor per keyspace per datacenter • Datacenters can be physical or logical
  • 18. The Write Path • Writes are written to any node in the cluster (coordinator) • Writes are written to commit log, then to memtable • Every write includes a timestamp • Memtable flushed to disk periodically (sstable) • New memtable is created in memory • Deletes are a special write case, called a “tombstone”
  • 19. Compaction • sstables are immutable • updates are written to new sstables • eventually we have too many files on disk • Merged through compaction, only latest data is kept based on timestamp sstable sstable sstable sstable
  • 20. The Read Path • Any server may be queried, it acts as the coordinator • Contacts nodes with the requested key • On each node, data is pulled from SSTables and merged • Consistency< ALL performs read repair in background (read_repair_chance)
  • 21. What are your options?
  • 22. Open Source • Latest, bleeding edge features • Monthly releases (tick tock) • File JIRAs • Support via mailing list & IRC • Fix bugs • cassandra.apache.org • Perfect for hacking
  • 23. DataStax Enterprise • Integrated Multi-DC Search • Integrated Spark for Analytics • Free Startup Program • <3MM rev & <$30M funding • Extended support • Additional QA • Focused on stable releases for enterprise
  • 25. ©2013 DataStax Confidential. Do not distribute without consent. 25