SlideShare a Scribd company logo
1 of 49
Download to read offline
Storing Data the Cassandra Way
Freek van Polen
“Simplicity is the ultimate sophistication.”
-Leonardo Da Vinci
About Me
● Cognitive Artificial Intelligence @ UU
● Almende:
– Researcher, self-organization, wireless sensor
networks
● Sense:
– First employee, developer, backend, team leader
Goal of this Talk
● Not to tell you to use Cassandra for everything
Goal of this Talk
● Not to tell you to use Cassandra for everything
● Not to go into all gory details of Cassandra
Goal of this Talk
● Not to tell you to use Cassandra for everything
● Not to go into all gory details of Cassandra
● Not to show off my drawing skills
Goal of this Talk
● Introduce some database theory
Goal of this Talk
● Introduce some database theory
● Make you enthusiastic about Cassandra
Goal of this Talk
● Introduce some database theory
● Make you enthusiastic about Cassandra
Use the right tool for the job!
SQL vs NoSQL
Non relational data
● documents
● graphs
● key-value
● wide-row
{
“meetup”: “DomCode”,
“name”: “Monthly Meetup March”,
“date”: “31­03­2015”,
“organizers”: [
“Ross”,
“Lucas”
],
“location”: “Infi”,
“talks”: [
{
“speaker”: “Arian”,
“topic”: “functional js”
},
{
“speaker”: “Freek”,
“topic”: “cassandra”,
“length”: 45
}
]
}
Non relational data
● documents
● graphs
● key-value
● wide-row
Non relational data
● documents
● graphs
● key-value
● wide-row
“6573672017456”: “tom”
“9810919283853”: “mary”
“1129823948673”: “jane”
“9827712003003”: “dani”
Non relational data
● documents
● graphs
● key-value
● wide-row
Stock 1: [+3.23, +5.02, ­2.45, ­34.12, ­12.65, +0.43]
Stock 2: [+5.34, +6.34, +9.12, +0.53]
Stock 3: [­3.21, ­5.32, ­8.12, ­0.53, ­0.12, +0.43, +0.76, +2.55] 
Scalability
Database [A-Z]
Scalability
Database [A-Z]
Scalability: replication
Database [A-Z]
Copy of Database [A-Z]
Scalability: sharding
Database [A-M]
Database [N-Z]
Scalability: combined
(oh the horror)
Database [A-M] Copy of Database [A-M]
Database [N-Z] Copy of Database [N-Z]
Coordinator
Scalability: combined
(oh the horror)
Database [A-M] Copy of Database [A-M]
Database [N-Z] Copy of Database [N-Z]
CAP theorem
CAP theorem
RDBMS
ACID & BASE
● Atomicity
● Consistency
● Isolation
● Durability
● Basically
● Available
● Soft-state
● Eventual consistency
Cassandra o/
Cassandra Cluster
● All nodes are equal
● All nodes can process any request
● Throughput and storage space scales linearly
● Graceful degradation
Cassandra: Gossip
5
37
1
8 2
46
Cassandra: Gossip
5
37
1
8 2
46
Cassandra: Replication
5
37
1
8 2
46
Token Ring
Cassandra: Replication
5
37
1
8 2
46
[A - D]
[E - H]
[I - K]
[L - N][O - Q]
[R - T]
[U - W]
[X - Z]
Cassandra: Replication
5
37
1
8 2
46
[A - D]
[E - H]
[I - K]
[L - N][O - Q]
[R - T]
[U - W]
[X - Z] replication = 3
Cassandra: Request Processing
5
37
1
8 2
46
K: 12-24?
Cassandra: Request Processing
5
37
1
8 2
46
K: 12-24? K: 12-24?
Cassandra: Request Processing
5
37
1
8 2
46
K: 12-24!
K: 12-24!
Cassandra: Request Processing
5
37
1
8 2
46
K: 12-24!
Cassandra: Request Processing
5
37
1
8 2
46
K:22 = “tom”
Cassandra: Request Processing
5
37
1
8 2
46
K:22 = “tom” K:22 = “tom”
Cassandra: Request Processing
5
37
1
8 2
46
Got it!
Great success!
Cassandra: Request Processing
5
37
1
8 2
46
K:22 = “tom”
K:22 = “tom”
K:22 = “jerry”
Cassandra: Request Processing
5
37
1
8 2
46
K:22 = “tom”
K:22 = “tom”
K:22 = “jerry”
K:22 = “tom”
Cassandra: Request Processing
5
37
1
8 2
46
K:22 = “tom”
K:22 = “tom”
K:22 = “tom”
Cassandra: Tunable Consistency
● Consistency.ANY
● Consistency.ONE
● Consistency.QOURUM
● Consistency.ALL
Cassandra: Data Model
CREATE TABLE transactions (
account_id  string,
date  timestamp,
amount  float,
other_account  string,
PRIMARY KEY (account_id, date)
);
Cassandra: Data Model
CREATE TABLE transactions (
account_id  string,
date  timestamp,
amount  float,
other_account string,
PRIMARY KEY (account_id, date)
);
29-03-2015
15:23:45
29-03-2015
16:56:21
30-03-2015
04:00:00
NLRABOxxx amount: -143.90
other: NLINGxxx
amount: -29.30
other: NLABNxxx
amount: +2000.00
other: NLASNxxx
Cassandra Data Model
● Primary Key #1:
– Row key
– Unit of partitioning
● Primary Key #2:
– Column key
– Order within row
– Order is preserved on disk!
Distributed Concurrent Writes
from: https://aphyr.com/posts/294-call-me-maybe-cassandra
Distributed Concurrent Writes
● Last write wins
● Paxos
● Treat data as
immutable
from: https://aphyr.com/posts/294-call-me-maybe-cassandra
Distributed Concurrent Writes
● Cassandra trades
consistency for
availability, partition
tolerance, and super
easy administration...
● This is not for all use
cases
from: https://aphyr.com/posts/294-call-me-maybe-cassandra
THE use case: time series data
CREATE TABLE sensor_data (
  sensor_id  text,
  time  timestamp,
  value  text,
  PRIMARY KEY (sensor_id, time)
);
Thanks!
Cassandra?

More Related Content

What's hot

What's hot (9)

Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
 
Databases Have Forgotten About Single Node Performance, A Wrongheaded Trade Off
Databases Have Forgotten About Single Node Performance, A Wrongheaded Trade OffDatabases Have Forgotten About Single Node Performance, A Wrongheaded Trade Off
Databases Have Forgotten About Single Node Performance, A Wrongheaded Trade Off
 
Aggregated queries with Druid on terrabytes and petabytes of data
Aggregated queries with Druid on terrabytes and petabytes of dataAggregated queries with Druid on terrabytes and petabytes of data
Aggregated queries with Druid on terrabytes and petabytes of data
 
Spark Introduction
Spark IntroductionSpark Introduction
Spark Introduction
 
20140614 introduction to spark-ben white
20140614 introduction to spark-ben white20140614 introduction to spark-ben white
20140614 introduction to spark-ben white
 
Thorny path to the Large-Scale Graph Processing (Highload++, 2014)
Thorny path to the Large-Scale Graph Processing (Highload++, 2014)Thorny path to the Large-Scale Graph Processing (Highload++, 2014)
Thorny path to the Large-Scale Graph Processing (Highload++, 2014)
 
Joker'14 Java as a fundamental working tool of the Data Scientist
Joker'14 Java as a fundamental working tool of the Data ScientistJoker'14 Java as a fundamental working tool of the Data Scientist
Joker'14 Java as a fundamental working tool of the Data Scientist
 
Geo data analytics
Geo data analyticsGeo data analytics
Geo data analytics
 
Cassandra vs. ScyllaDB: Evolutionary Differences
Cassandra vs. ScyllaDB: Evolutionary DifferencesCassandra vs. ScyllaDB: Evolutionary Differences
Cassandra vs. ScyllaDB: Evolutionary Differences
 

Viewers also liked (9)

InStyle
InStyleInStyle
InStyle
 
NYC Office Worker Posed As Dentist, Pulled Teeth: Prosecutors
NYC Office Worker Posed As Dentist, Pulled Teeth: ProsecutorsNYC Office Worker Posed As Dentist, Pulled Teeth: Prosecutors
NYC Office Worker Posed As Dentist, Pulled Teeth: Prosecutors
 
World News | International Breaking News, Headlines & Video
World News | International Breaking News, Headlines & VideoWorld News | International Breaking News, Headlines & Video
World News | International Breaking News, Headlines & Video
 
Infina - Corporate Profile
Infina - Corporate ProfileInfina - Corporate Profile
Infina - Corporate Profile
 
Company profile nanjing feitian glass
Company profile  nanjing feitian glassCompany profile  nanjing feitian glass
Company profile nanjing feitian glass
 
Charleston church shooting suspect arrested in N.C.
Charleston church shooting suspect arrested in N.C.Charleston church shooting suspect arrested in N.C.
Charleston church shooting suspect arrested in N.C.
 
Infina Management Team
Infina Management TeamInfina Management Team
Infina Management Team
 
Bug zillatestopiajenkins
Bug zillatestopiajenkinsBug zillatestopiajenkins
Bug zillatestopiajenkins
 
Cswip 3.1 question & Answers
Cswip 3.1 question & AnswersCswip 3.1 question & Answers
Cswip 3.1 question & Answers
 

Similar to 2015 03-31 dom-code_cassandra

Cassandra and Spark, closing the gap between no sql and analytics codemotio...
Cassandra and Spark, closing the gap between no sql and analytics   codemotio...Cassandra and Spark, closing the gap between no sql and analytics   codemotio...
Cassandra and Spark, closing the gap between no sql and analytics codemotio...
Duyhai Doan
 
principle component analysis pca - machine learning - unsupervised learning
principle component analysis pca - machine learning - unsupervised learningprinciple component analysis pca - machine learning - unsupervised learning
principle component analysis pca - machine learning - unsupervised learning
EmanAsem4
 

Similar to 2015 03-31 dom-code_cassandra (20)

Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandra
 
Cassandra data structures and algorithms
Cassandra data structures and algorithmsCassandra data structures and algorithms
Cassandra data structures and algorithms
 
Fast track to getting started with DSE Max @ ING
Fast track to getting started with DSE Max @ INGFast track to getting started with DSE Max @ ING
Fast track to getting started with DSE Max @ ING
 
Text Mining Applied to SQL Queries: a Case Study for SDSS SkyServer
Text Mining Applied to SQL Queries: a Case Study for SDSS SkyServerText Mining Applied to SQL Queries: a Case Study for SDSS SkyServer
Text Mining Applied to SQL Queries: a Case Study for SDSS SkyServer
 
Elastic{ON} 2017 Recap
Elastic{ON} 2017 RecapElastic{ON} 2017 Recap
Elastic{ON} 2017 Recap
 
Cassandra and Spark, closing the gap between no sql and analytics codemotio...
Cassandra and Spark, closing the gap between no sql and analytics   codemotio...Cassandra and Spark, closing the gap between no sql and analytics   codemotio...
Cassandra and Spark, closing the gap between no sql and analytics codemotio...
 
Artmosphere Demo
Artmosphere DemoArtmosphere Demo
Artmosphere Demo
 
Spark cassandra connector.API, Best Practices and Use-Cases
Spark cassandra connector.API, Best Practices and Use-CasesSpark cassandra connector.API, Best Practices and Use-Cases
Spark cassandra connector.API, Best Practices and Use-Cases
 
Avoiding Pitfalls for Cassandra.pdf
Avoiding Pitfalls for Cassandra.pdfAvoiding Pitfalls for Cassandra.pdf
Avoiding Pitfalls for Cassandra.pdf
 
Cassandra introduction mars jug
Cassandra introduction mars jugCassandra introduction mars jug
Cassandra introduction mars jug
 
Spark cassandra integration, theory and practice
Spark cassandra integration, theory and practiceSpark cassandra integration, theory and practice
Spark cassandra integration, theory and practice
 
Java one2011 brisk-and_high_order_bits_from_cassandra_and_hadoop
Java one2011 brisk-and_high_order_bits_from_cassandra_and_hadoopJava one2011 brisk-and_high_order_bits_from_cassandra_and_hadoop
Java one2011 brisk-and_high_order_bits_from_cassandra_and_hadoop
 
Web-Scale Graph Analytics with Apache Spark with Tim Hunter
Web-Scale Graph Analytics with Apache Spark with Tim HunterWeb-Scale Graph Analytics with Apache Spark with Tim Hunter
Web-Scale Graph Analytics with Apache Spark with Tim Hunter
 
PCA_csep546.pptx
PCA_csep546.pptxPCA_csep546.pptx
PCA_csep546.pptx
 
principle component analysis pca - machine learning - unsupervised learning
principle component analysis pca - machine learning - unsupervised learningprinciple component analysis pca - machine learning - unsupervised learning
principle component analysis pca - machine learning - unsupervised learning
 
PCA_csep546.pptx
PCA_csep546.pptxPCA_csep546.pptx
PCA_csep546.pptx
 
Cassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestCassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapest
 
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
 
Cassandra for the ops dos and donts
Cassandra for the ops   dos and dontsCassandra for the ops   dos and donts
Cassandra for the ops dos and donts
 
Apache cassandra an introduction
Apache cassandra  an introductionApache cassandra  an introduction
Apache cassandra an introduction
 

Recently uploaded

Jax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined DeckJax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined Deck
Marc Lester
 
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Lisi Hocke
 

Recently uploaded (20)

Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit MilanWorkshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
 
architecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfarchitecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdf
 
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
 
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
 
Jax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined DeckJax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined Deck
 
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
 
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 
From Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptxFrom Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptx
 
Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...
Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...
Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...
 
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
Auto Affiliate  AI Earns First Commission in 3 Hours..pdfAuto Affiliate  AI Earns First Commission in 3 Hours..pdf
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeCon
 
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AI
 
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 

2015 03-31 dom-code_cassandra