SlideShare a Scribd company logo
1 of 38
Download to read offline
Cassandra
Scalable Distributed Data Store       Sylvain Lebresne
                                  (sylvain@yakaz.com)
A few dates

• Created by Facebook (around 2007)


• Open-sourced in 2008


• Becomes a ASF incubator project in January 2009


• Graduated as a top-level ASF project in February 2010


• 3 major releases (current is 0.6)


• In production in multiple companies (Facebook, Digg, Twitter, Reddit,
  Rackspace, etc.) with largest cluster of over 150 machines
Dynamo                         Big Table

                                   data model and
distribution model
                                 storage architecture



                     Cassandra
Why Cassandra ?

• Fully distributed (client can connect to any node)

   • No single point of failure

   • Incremental scalability

• Richer data model than simple key-value

• Data center aware

• Fast reads, faster writes (“optimize for reads, writes are cheap”)

• Always writable

• Eventually consistent
Eventual Consistency


• Isn’t consistency important ?


• Yes, eventual consistency:


   • Not : “Let’s not be consistent”


   • But more: “Instead of designing (costly) measure to prevent inconsistency,
     we acknowledge that the cluster may be in an inconsistent state for a brief
     period of time, and we deal with it”


• Moreover, Cassandra allows the client to choose a trade-off between
  consistency and latency
Data Model
Data model

• A distributed multi-level hash map:
                                              (millions is ok but
                                               limited by node
                                                    capacity)
                                                column key           value
Keyspace       Column Family     row key
  (one by                      (as many as
                   (a few)
application)                    you want)
                                             super column key          column key           value
                                               (millions is ok but
                                                                     (in current implementation,
                                                limited by node
                                                                            not too many)
                                                     capacity)
Columns


                 Column

          name     value   ts
Columns


                    Column

          “fname”     “John”
Rows

            Row
           ident42
       “fname”      “John”

       “lname”      “Doe”

       “phone”     0612346789


        “age”         35

       “picture”    0x0FC3...
Column Family

  Column Family
       ident42                 ident123                        ident24
   “fname”      “John”      “fname” “Chuck”                 “fname” “Sylvain”

   “lname”      “Doe”       “lname”      “Norris”           “lname” “Lebresne”

   “phone”     0612346789    “age”           70             “phone”   0698765432


    “age”         35        “email”     “chuck@gmail.com”    “age”       29

   “picture”    0x0FC3...   “picture”     0x159A...
SuperColumns

(Super) Column Family
             ident42                   ident123
   ident24          ident123           ident42
 1983483   msg11   1990310   msg21   1847820   msg31

 1983490   msg12   1991321   msg22   1848923   msg32

 1983512   msg13   2015672   msg23   1848924   msg33

 1983618   msg14                     1983618   msg34
Comparison

• Columns and super columns are sorted.


• This sorting is customizable and defined by column family.


• Predefined sorts are:

  • BytesType
  • LongType
  • AsciiType
  • UTF8Type
  • LexicalUUIDType
  • TimeUUIDType
API

• Writes:

   • insert() : insert/update a single column

   • remove() : remove a column/super column/row

   • batch_mutate() : update/remove multiple columns

• Reads:

   • get() : retrieve a single column

   • get_slice() : retrieve a group of columns (by names or range)

   • get_range_slices() : retrieve a set of slices for a range of (row) keys

   • count() : count the number of columns in a row
Cassandra Cluster: Replication & Consistency
Ring (Consistent Hashing)

• Data distribution:
                                               RF = 3
   • take a hash function (md5) and place
     node on the domain of this hash
   • each node is “responsible” of the key
     that falls between its position and the
     preceding node
   • to know where to store a column, use
     node responsible of md5(row key)

• Data replication:
   • cluster have a replication factor (RF).
   • place replicas on preceding nodes
Writing - Cluster side


                         24




                                   24




                              24
Writing - Cluster side


                         24




      insert( 42 )




                                   24




                              24
Writing - Cluster side


                         24




      insert( 42 )




                                   24




                              24
Writing - Cluster side


                                 24




        insert( 42 )


• Consistency Level : how many
  node must respond for                    24
  success ?




                                      24
Writing - Cluster side


                                 24




        insert( 42 )


• Consistency Level : how many
  node must respond for                    24
  success ?
   • CL.ZERO : none



                                      24
Writing - Cluster side


                                 24




        insert( 42 )


• Consistency Level : how many
  node must respond for                    24
  success ?
   • CL.ZERO : none
   • CL.ONE : one


                                      24
Writing - Cluster side


                                 24




        insert( 42 )


• Consistency Level : how many
  node must respond for                    24
  success ?
   • CL.ZERO : none
   • CL.ONE : one
   • CL.QUORUM : one more
     than half the replicas
                                      24
Writing - Cluster side


                                 24




                 ok


• Consistency Level : how many
  node must respond for                    42
  success ?
   • CL.ZERO : none
   • CL.ONE : one
   • CL.QUORUM : one more
     than half the replicas
                                      42
Writing - Cluster side


                                 24




• Consistency Level : how many
  node must respond for                    42
  success ?
   • CL.ZERO : none
   • CL.ONE : one
   • CL.QUORUM : one more
     than half the replicas
                                      42
Writing - Cluster side


                                 42




• Consistency Level : how many
  node must respond for                    42
  success ?
   • CL.ZERO : none
   • CL.ONE : one
   • CL.QUORUM : one more
     than half the replicas
                                      42
Reading - Cluster side


                         42




       get(   )




                                   42




                              42
Reading - Cluster side


                         42




       get(   )




                                   42




                              42
Reading - Cluster side


                                 42




          get(    )


• Consistency Level : how many
  node must respond for                    42
  success ?




                                      42
Reading - Cluster side


                                 42




          get(    )


• Consistency Level : how many
  node must respond for                    42
  success ?
   • CL.ONE : one



                                      42
Reading - Cluster side


                                 42




          get(    )


• Consistency Level : how many
  node must respond for                    42
  success ?
   • CL.ONE : one
   • CL.QUORUM : one more
     than half the replicas

                                      42
Reading - Cluster side


                                 42




          get( 42 )


• Consistency Level : how many
  node must respond for                    42
  success ?
   • CL.ONE : one
   • CL.QUORUM : one more
     than half the replicas

                                      42
Reading - Cluster side


                                       42




            get( 42 )


• Consistency Level : how many
  node must respond for                          42
  success ?
    • CL.ONE : one
    • CL.QUORUM : one more
      than half the replicas
• If values differs, returns the one
  with greater timestamp                    42
Failure and Consistency

To repair inconsistency when they occurs:


  1. Hinted Handoff: when a node is down, insertions are send to another
    machine. Those insertions are sent to the node come back alive.


  2. Read Repair: on reads, if values differ, the out of sync nodes are repaired
    by inserting the newer value.


  3. Anti Entropy: compare versions in two nodes using merkle tree (manual
    operation).
A Cassandra node
Write Path

1. write commit log (for persistency)


2. write memtable (write is
  acknowledged to client)


3. if memtable reach treshold, flush to
  disk as SSTable.


4. Remark: deletion amounts to the
  insertion of a “tombstone”.
Read Path

• Versions of the same column can be at
 the same time:
   • in the memtable
   • in the memtables being flushed
   • in one or multiple SSTable
• We need to read all version and
 resolve using timestamp
• But:
   • bloom filters allow to skip reading
    unnecessary files
   • SSTable are indexed
   • Compaction keep things
    reasonnable
Compaction

• Runs regularly as a background operation


• Merge SSTables together


• Get rid of old and deleted values


But...


• Requires disk space temporarily


• As of today, needs to deserialize each row entirely

More Related Content

What's hot

CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...DataStax
 
Cassandra Tutorial
Cassandra TutorialCassandra Tutorial
Cassandra Tutorialmubarakss
 
Apache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis PriceApache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis PriceDataStax Academy
 
MariaDB and Cassandra Interoperability
MariaDB and Cassandra InteroperabilityMariaDB and Cassandra Interoperability
MariaDB and Cassandra InteroperabilityColin Charles
 
Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015StampedeCon
 
Cassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL MeetupCassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL MeetupMichael Wynholds
 
Cassandra Materialized Views
Cassandra Materialized ViewsCassandra Materialized Views
Cassandra Materialized ViewsCarl Yeksigian
 
Apache Cassandra Developer Training Slide Deck
Apache Cassandra Developer Training Slide DeckApache Cassandra Developer Training Slide Deck
Apache Cassandra Developer Training Slide DeckDataStax Academy
 
NoSQL - Cassandra & MongoDB.pptx
NoSQL -  Cassandra & MongoDB.pptxNoSQL -  Cassandra & MongoDB.pptx
NoSQL - Cassandra & MongoDB.pptxNaveen Kumar
 
Cassandra presentation at NoSQL
Cassandra presentation at NoSQLCassandra presentation at NoSQL
Cassandra presentation at NoSQLEvan Weaver
 
C*ollege Credit: Data Modeling for Apache Cassandra
C*ollege Credit: Data Modeling for Apache CassandraC*ollege Credit: Data Modeling for Apache Cassandra
C*ollege Credit: Data Modeling for Apache CassandraDataStax
 
Bulk Loading into Cassandra
Bulk Loading into CassandraBulk Loading into Cassandra
Bulk Loading into CassandraBrian Hess
 
Real data models of silicon valley
Real data models of silicon valleyReal data models of silicon valley
Real data models of silicon valleyPatrick McFadin
 
Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into CassandraBrent Theisen
 
Add Powerful Full Text Search to Your Web App with Solr
Add Powerful Full Text Search to Your Web App with SolrAdd Powerful Full Text Search to Your Web App with Solr
Add Powerful Full Text Search to Your Web App with Solradunne
 
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabCloudxLab
 
Go Programming Patterns
Go Programming PatternsGo Programming Patterns
Go Programming PatternsHao Chen
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache CassandraLuke Tillman
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introductionJason Vance
 

What's hot (19)

CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
 
Cassandra Tutorial
Cassandra TutorialCassandra Tutorial
Cassandra Tutorial
 
Apache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis PriceApache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis Price
 
MariaDB and Cassandra Interoperability
MariaDB and Cassandra InteroperabilityMariaDB and Cassandra Interoperability
MariaDB and Cassandra Interoperability
 
Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015
 
Cassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL MeetupCassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL Meetup
 
Cassandra Materialized Views
Cassandra Materialized ViewsCassandra Materialized Views
Cassandra Materialized Views
 
Apache Cassandra Developer Training Slide Deck
Apache Cassandra Developer Training Slide DeckApache Cassandra Developer Training Slide Deck
Apache Cassandra Developer Training Slide Deck
 
NoSQL - Cassandra & MongoDB.pptx
NoSQL -  Cassandra & MongoDB.pptxNoSQL -  Cassandra & MongoDB.pptx
NoSQL - Cassandra & MongoDB.pptx
 
Cassandra presentation at NoSQL
Cassandra presentation at NoSQLCassandra presentation at NoSQL
Cassandra presentation at NoSQL
 
C*ollege Credit: Data Modeling for Apache Cassandra
C*ollege Credit: Data Modeling for Apache CassandraC*ollege Credit: Data Modeling for Apache Cassandra
C*ollege Credit: Data Modeling for Apache Cassandra
 
Bulk Loading into Cassandra
Bulk Loading into CassandraBulk Loading into Cassandra
Bulk Loading into Cassandra
 
Real data models of silicon valley
Real data models of silicon valleyReal data models of silicon valley
Real data models of silicon valley
 
Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into Cassandra
 
Add Powerful Full Text Search to Your Web App with Solr
Add Powerful Full Text Search to Your Web App with SolrAdd Powerful Full Text Search to Your Web App with Solr
Add Powerful Full Text Search to Your Web App with Solr
 
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
 
Go Programming Patterns
Go Programming PatternsGo Programming Patterns
Go Programming Patterns
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache Cassandra
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introduction
 

Viewers also liked

Webinar Big Data Paris
Webinar Big Data ParisWebinar Big Data Paris
Webinar Big Data Parispcmanus
 
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and GraphiteAutomated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and GraphitePratima Singh
 
6 Dean Google
6 Dean Google6 Dean Google
6 Dean GoogleFrank Cai
 
CCS for the Magnesium industry (mineralization)
CCS for the Magnesium industry (mineralization)CCS for the Magnesium industry (mineralization)
CCS for the Magnesium industry (mineralization)Green Minerals B.V.
 
Matriz de valoración del portafolio digital gmd3
Matriz de valoración del portafolio digital gmd3Matriz de valoración del portafolio digital gmd3
Matriz de valoración del portafolio digital gmd3Giselle Mejia Diaz
 
Passive mobile measurement: The next big thing in market research? - TNS
Passive mobile measurement: The next big thing in market research? - TNSPassive mobile measurement: The next big thing in market research? - TNS
Passive mobile measurement: The next big thing in market research? - TNSMerlien Institute
 
MANUAL DE CARGOS Y FUNCIONES
MANUAL DE CARGOS Y FUNCIONESMANUAL DE CARGOS Y FUNCIONES
MANUAL DE CARGOS Y FUNCIONESPanchoover
 
Ejercicios de fisica 2 undécimo
Ejercicios de fisica 2 undécimoEjercicios de fisica 2 undécimo
Ejercicios de fisica 2 undécimoIván Baena
 
Ecobike- publicidad original-Creado evelyn Ponce
Ecobike- publicidad original-Creado evelyn PonceEcobike- publicidad original-Creado evelyn Ponce
Ecobike- publicidad original-Creado evelyn PonceLyn Ponce
 
Bulletin municipal de Menthonnex-en-Bornes - Mars 2015
Bulletin municipal de Menthonnex-en-Bornes - Mars 2015Bulletin municipal de Menthonnex-en-Bornes - Mars 2015
Bulletin municipal de Menthonnex-en-Bornes - Mars 2015Sandrine Bochet
 
Solicitud
SolicitudSolicitud
SolicitudMILA185
 
103650287 test-de-habilidades-verbales-completo
103650287 test-de-habilidades-verbales-completo103650287 test-de-habilidades-verbales-completo
103650287 test-de-habilidades-verbales-completoEduardo Chacana
 
Vivo en una casa bonita
Vivo en una casa bonitaVivo en una casa bonita
Vivo en una casa bonitaEdward Acuna
 

Viewers also liked (20)

Webinar Big Data Paris
Webinar Big Data ParisWebinar Big Data Paris
Webinar Big Data Paris
 
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and GraphiteAutomated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite
 
6 Dean Google
6 Dean Google6 Dean Google
6 Dean Google
 
CCS for the Magnesium industry (mineralization)
CCS for the Magnesium industry (mineralization)CCS for the Magnesium industry (mineralization)
CCS for the Magnesium industry (mineralization)
 
Tenis
TenisTenis
Tenis
 
Matriz de valoración del portafolio digital gmd3
Matriz de valoración del portafolio digital gmd3Matriz de valoración del portafolio digital gmd3
Matriz de valoración del portafolio digital gmd3
 
Doc12222
Doc12222Doc12222
Doc12222
 
valores mcp
valores mcpvalores mcp
valores mcp
 
Passive mobile measurement: The next big thing in market research? - TNS
Passive mobile measurement: The next big thing in market research? - TNSPassive mobile measurement: The next big thing in market research? - TNS
Passive mobile measurement: The next big thing in market research? - TNS
 
MANUAL DE CARGOS Y FUNCIONES
MANUAL DE CARGOS Y FUNCIONESMANUAL DE CARGOS Y FUNCIONES
MANUAL DE CARGOS Y FUNCIONES
 
20100930 Tachi Comunidad
20100930 Tachi Comunidad20100930 Tachi Comunidad
20100930 Tachi Comunidad
 
Organigrama
OrganigramaOrganigrama
Organigrama
 
Ejercicios de fisica 2 undécimo
Ejercicios de fisica 2 undécimoEjercicios de fisica 2 undécimo
Ejercicios de fisica 2 undécimo
 
Mouse de pie
Mouse de pieMouse de pie
Mouse de pie
 
Ecobike- publicidad original-Creado evelyn Ponce
Ecobike- publicidad original-Creado evelyn PonceEcobike- publicidad original-Creado evelyn Ponce
Ecobike- publicidad original-Creado evelyn Ponce
 
Bulletin municipal de Menthonnex-en-Bornes - Mars 2015
Bulletin municipal de Menthonnex-en-Bornes - Mars 2015Bulletin municipal de Menthonnex-en-Bornes - Mars 2015
Bulletin municipal de Menthonnex-en-Bornes - Mars 2015
 
Clase sida 2011
Clase sida 2011Clase sida 2011
Clase sida 2011
 
Solicitud
SolicitudSolicitud
Solicitud
 
103650287 test-de-habilidades-verbales-completo
103650287 test-de-habilidades-verbales-completo103650287 test-de-habilidades-verbales-completo
103650287 test-de-habilidades-verbales-completo
 
Vivo en una casa bonita
Vivo en una casa bonitaVivo en una casa bonita
Vivo en una casa bonita
 

Similar to Cassandra

Cassandra talk @JUG Lausanne, 2012.06.14
Cassandra talk @JUG Lausanne, 2012.06.14Cassandra talk @JUG Lausanne, 2012.06.14
Cassandra talk @JUG Lausanne, 2012.06.14Benoit Perroud
 
Apache Cassandra @Geneva JUG 2013.02.26
Apache Cassandra @Geneva JUG 2013.02.26Apache Cassandra @Geneva JUG 2013.02.26
Apache Cassandra @Geneva JUG 2013.02.26Benoit Perroud
 
Redis memcached pdf
Redis memcached pdfRedis memcached pdf
Redis memcached pdfErin O'Neill
 
Compilers Are Databases
Compilers Are DatabasesCompilers Are Databases
Compilers Are DatabasesMartin Odersky
 
PHP Forum Paris 2012: Magic behind the numbers. Software metrics in practice
PHP Forum Paris 2012: Magic behind the numbers. Software metrics in practicePHP Forum Paris 2012: Magic behind the numbers. Software metrics in practice
PHP Forum Paris 2012: Magic behind the numbers. Software metrics in practiceSebastian Marek
 
Clustering of graphs and search of assemblages
Clustering of graphs and search of assemblagesClustering of graphs and search of assemblages
Clustering of graphs and search of assemblagesData-Centric_Alliance
 
Oxford 05-oct-2012
Oxford 05-oct-2012Oxford 05-oct-2012
Oxford 05-oct-2012Ted Dunning
 
Cassandra under the hood
Cassandra under the hoodCassandra under the hood
Cassandra under the hoodAndriy Rymar
 
Intro to Cassandra
Intro to CassandraIntro to Cassandra
Intro to CassandraTyler Hobbs
 
Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford MapR Technologies
 
Deep Learning for Personalized Search and Recommender Systems
Deep Learning for Personalized Search and Recommender SystemsDeep Learning for Personalized Search and Recommender Systems
Deep Learning for Personalized Search and Recommender SystemsBenjamin Le
 

Similar to Cassandra (12)

Cassandra talk @JUG Lausanne, 2012.06.14
Cassandra talk @JUG Lausanne, 2012.06.14Cassandra talk @JUG Lausanne, 2012.06.14
Cassandra talk @JUG Lausanne, 2012.06.14
 
Apache Cassandra @Geneva JUG 2013.02.26
Apache Cassandra @Geneva JUG 2013.02.26Apache Cassandra @Geneva JUG 2013.02.26
Apache Cassandra @Geneva JUG 2013.02.26
 
Redis memcached pdf
Redis memcached pdfRedis memcached pdf
Redis memcached pdf
 
Compilers Are Databases
Compilers Are DatabasesCompilers Are Databases
Compilers Are Databases
 
PHP Forum Paris 2012: Magic behind the numbers. Software metrics in practice
PHP Forum Paris 2012: Magic behind the numbers. Software metrics in practicePHP Forum Paris 2012: Magic behind the numbers. Software metrics in practice
PHP Forum Paris 2012: Magic behind the numbers. Software metrics in practice
 
NoSQL Smackdown!
NoSQL Smackdown!NoSQL Smackdown!
NoSQL Smackdown!
 
Clustering of graphs and search of assemblages
Clustering of graphs and search of assemblagesClustering of graphs and search of assemblages
Clustering of graphs and search of assemblages
 
Oxford 05-oct-2012
Oxford 05-oct-2012Oxford 05-oct-2012
Oxford 05-oct-2012
 
Cassandra under the hood
Cassandra under the hoodCassandra under the hood
Cassandra under the hood
 
Intro to Cassandra
Intro to CassandraIntro to Cassandra
Intro to Cassandra
 
Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford
 
Deep Learning for Personalized Search and Recommender Systems
Deep Learning for Personalized Search and Recommender SystemsDeep Learning for Personalized Search and Recommender Systems
Deep Learning for Personalized Search and Recommender Systems
 

Recently uploaded

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

Cassandra

  • 1. Cassandra Scalable Distributed Data Store Sylvain Lebresne (sylvain@yakaz.com)
  • 2. A few dates • Created by Facebook (around 2007) • Open-sourced in 2008 • Becomes a ASF incubator project in January 2009 • Graduated as a top-level ASF project in February 2010 • 3 major releases (current is 0.6) • In production in multiple companies (Facebook, Digg, Twitter, Reddit, Rackspace, etc.) with largest cluster of over 150 machines
  • 3. Dynamo Big Table data model and distribution model storage architecture Cassandra
  • 4. Why Cassandra ? • Fully distributed (client can connect to any node) • No single point of failure • Incremental scalability • Richer data model than simple key-value • Data center aware • Fast reads, faster writes (“optimize for reads, writes are cheap”) • Always writable • Eventually consistent
  • 5. Eventual Consistency • Isn’t consistency important ? • Yes, eventual consistency: • Not : “Let’s not be consistent” • But more: “Instead of designing (costly) measure to prevent inconsistency, we acknowledge that the cluster may be in an inconsistent state for a brief period of time, and we deal with it” • Moreover, Cassandra allows the client to choose a trade-off between consistency and latency
  • 7. Data model • A distributed multi-level hash map: (millions is ok but limited by node capacity) column key value Keyspace Column Family row key (one by (as many as (a few) application) you want) super column key column key value (millions is ok but (in current implementation, limited by node not too many) capacity)
  • 8. Columns Column name value ts
  • 9. Columns Column “fname” “John”
  • 10. Rows Row ident42 “fname” “John” “lname” “Doe” “phone” 0612346789 “age” 35 “picture” 0x0FC3...
  • 11. Column Family Column Family ident42 ident123 ident24 “fname” “John” “fname” “Chuck” “fname” “Sylvain” “lname” “Doe” “lname” “Norris” “lname” “Lebresne” “phone” 0612346789 “age” 70 “phone” 0698765432 “age” 35 “email” “chuck@gmail.com” “age” 29 “picture” 0x0FC3... “picture” 0x159A...
  • 12. SuperColumns (Super) Column Family ident42 ident123 ident24 ident123 ident42 1983483 msg11 1990310 msg21 1847820 msg31 1983490 msg12 1991321 msg22 1848923 msg32 1983512 msg13 2015672 msg23 1848924 msg33 1983618 msg14 1983618 msg34
  • 13. Comparison • Columns and super columns are sorted. • This sorting is customizable and defined by column family. • Predefined sorts are: • BytesType • LongType • AsciiType • UTF8Type • LexicalUUIDType • TimeUUIDType
  • 14. API • Writes: • insert() : insert/update a single column • remove() : remove a column/super column/row • batch_mutate() : update/remove multiple columns • Reads: • get() : retrieve a single column • get_slice() : retrieve a group of columns (by names or range) • get_range_slices() : retrieve a set of slices for a range of (row) keys • count() : count the number of columns in a row
  • 16. Ring (Consistent Hashing) • Data distribution: RF = 3 • take a hash function (md5) and place node on the domain of this hash • each node is “responsible” of the key that falls between its position and the preceding node • to know where to store a column, use node responsible of md5(row key) • Data replication: • cluster have a replication factor (RF). • place replicas on preceding nodes
  • 17. Writing - Cluster side 24 24 24
  • 18. Writing - Cluster side 24 insert( 42 ) 24 24
  • 19. Writing - Cluster side 24 insert( 42 ) 24 24
  • 20. Writing - Cluster side 24 insert( 42 ) • Consistency Level : how many node must respond for 24 success ? 24
  • 21. Writing - Cluster side 24 insert( 42 ) • Consistency Level : how many node must respond for 24 success ? • CL.ZERO : none 24
  • 22. Writing - Cluster side 24 insert( 42 ) • Consistency Level : how many node must respond for 24 success ? • CL.ZERO : none • CL.ONE : one 24
  • 23. Writing - Cluster side 24 insert( 42 ) • Consistency Level : how many node must respond for 24 success ? • CL.ZERO : none • CL.ONE : one • CL.QUORUM : one more than half the replicas 24
  • 24. Writing - Cluster side 24 ok • Consistency Level : how many node must respond for 42 success ? • CL.ZERO : none • CL.ONE : one • CL.QUORUM : one more than half the replicas 42
  • 25. Writing - Cluster side 24 • Consistency Level : how many node must respond for 42 success ? • CL.ZERO : none • CL.ONE : one • CL.QUORUM : one more than half the replicas 42
  • 26. Writing - Cluster side 42 • Consistency Level : how many node must respond for 42 success ? • CL.ZERO : none • CL.ONE : one • CL.QUORUM : one more than half the replicas 42
  • 27. Reading - Cluster side 42 get( ) 42 42
  • 28. Reading - Cluster side 42 get( ) 42 42
  • 29. Reading - Cluster side 42 get( ) • Consistency Level : how many node must respond for 42 success ? 42
  • 30. Reading - Cluster side 42 get( ) • Consistency Level : how many node must respond for 42 success ? • CL.ONE : one 42
  • 31. Reading - Cluster side 42 get( ) • Consistency Level : how many node must respond for 42 success ? • CL.ONE : one • CL.QUORUM : one more than half the replicas 42
  • 32. Reading - Cluster side 42 get( 42 ) • Consistency Level : how many node must respond for 42 success ? • CL.ONE : one • CL.QUORUM : one more than half the replicas 42
  • 33. Reading - Cluster side 42 get( 42 ) • Consistency Level : how many node must respond for 42 success ? • CL.ONE : one • CL.QUORUM : one more than half the replicas • If values differs, returns the one with greater timestamp 42
  • 34. Failure and Consistency To repair inconsistency when they occurs: 1. Hinted Handoff: when a node is down, insertions are send to another machine. Those insertions are sent to the node come back alive. 2. Read Repair: on reads, if values differ, the out of sync nodes are repaired by inserting the newer value. 3. Anti Entropy: compare versions in two nodes using merkle tree (manual operation).
  • 36. Write Path 1. write commit log (for persistency) 2. write memtable (write is acknowledged to client) 3. if memtable reach treshold, flush to disk as SSTable. 4. Remark: deletion amounts to the insertion of a “tombstone”.
  • 37. Read Path • Versions of the same column can be at the same time: • in the memtable • in the memtables being flushed • in one or multiple SSTable • We need to read all version and resolve using timestamp • But: • bloom filters allow to skip reading unnecessary files • SSTable are indexed • Compaction keep things reasonnable
  • 38. Compaction • Runs regularly as a background operation • Merge SSTables together • Get rid of old and deleted values But... • Requires disk space temporarily • As of today, needs to deserialize each row entirely