SlideShare a Scribd company logo
1 of 43
HELLO @WORLD #CASSANDRA
   APACHE CASSANDRA IN ACTION

               WDCNZ 2012
    Aaron Morton, Apache Cassandra Committer
                 @aaronmorton
             www.thelastpickle.com




      Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License
The Code is at...
github.com/amorton/wdcnz-2012-site
Cassandra?
Cassandra?

         Started at
         Facebook.
Cassandra?

  Top Level Apache
 project since 2010.
Used by...

   Netflix, Twitter,
 Reddit, Rackspace...
Commercial support by...

   Data Stax, Acunu,
    PalominoDB,
      Impetus...
Why Cassandra?

             Scale
Why Cassandra?

       Operations
Why Cassandra?

       Data Model
Cluster
Store ‘foo’ key with Replication Factor 3.
                              Node 1 - 'foo'




                     Node 4                    Node 2 - 'foo'




                              Node 3 - 'foo'
Consistent Hashing...	


 Evenly map keys to
       nodes.
Consistent Hashing...	

    Minimise key
movements when nodes
    join or leave.
Partitioner...
     RandomPartitioner
   transforms Keys to Tokens
           using MD5.
         (Default Partitioner, there are others.)
Keys and Tokens?
    key     'fop'   'foo'




  token 0    10     90      99
Token Ring.
                          99   0
                  'foo'            'fop'
              token: 90            token: 10
Token Ranges.
                                   Node 1
                                   token: 0

                            76-0               1-25




                  Node 4                              Node 2
                token: 75                             token: 25




                                   Node 3
                                   token: 50
Locate Token Range.
                                              Node 1
                                              token: 0


                      'foo'
                      token: 90


                                    Node 4                Node 2
                                  token: 75               token: 25




                                              Node 3
                                              token: 50
Replication Strategy selects
Replication Factor number of
      nodes for a row.
SimpleStrategy with RF 3.
                                          Node 1
                                          token: 0


                  'foo'
                  token: 90


                                Node 4                Node 2
                              token: 75               token: 25




                                          Node 3
                                          token: 50
Clients connect to
 any node in the
      cluster.
The Client and the Coordinator.
                                            Node 1
                                            token: 0


                    'foo'
                    token: 90


                                  Node 4                Node 2
                                token: 75               token: 25




                                            Node 3
                    Client
                                            token: 50
Client specified
Consistency Level.
Consistency Level...

   Any*, One, Two,
       Three,
Consistency Level...
          QUORUM,
       LOCAL_QUORUM,
       EACH_QUOURM*
QUOURM at Replication Factor...
   Replication
                 2 or 3   4 or 5   6 or 7
     Factor




   QUOURM          2        3        4
Node Down.
                                     Node 1
                                     token: 0


             'foo'
             token: 90


                           Node 4                Node 2
                         token: 75               token: 25




                                     Node 3
             Client
                                     token: 50
Write ‘foo’ at QUOURM with Hinted Handoff.
                                             Node 1
                                             'foo'


                     'foo'
                     token: 90


                                  Node 4              Node 2
                              'foo' for #3            'foo'




                                             Node 3
                     Client
Read ‘foo’ at QUOURM.
                                       Node 1
                                       'foo'


                  'foo'
                  token: 90


                              Node 4            Node 2
                                                'foo'




                                       Node 3
                  Client
Consistency Level
nodes must agree.
Column Timestamps
 used to resolve
    differences.
Consistent read for ‘foo’ at QUOURM.
                    Node 1                                         Node 1



                   cromulent


                           cromulent
          Node 4                       Node 2            Node 4               Node 2

                   embiggins                                      cromulent
                                                    cromulent




 Client                                         Client
                    Node 3                                         Node 3
R +W > N
(#Read Nodes + #Write Nodes > Replication Factor)
Data Model
Data Model so far.


     Row Key:   Column        Column   Column


                  (Incomplete.)
Data Model.
                           Keyspace

               Column Family   Column Family   Column Family
                  Column          Column          Column
    Row Key:      Column          Column          Column
                  Column          Column          Column


                (Excludes Super Columns.)
Data Model...
                            Keyspace

                                Column Family
                Column: name, value, timestamp
     Row Key:   Column: name, value, timestamp
                Column: name, value, timestamp



          (Also TTL and Tombstone Columns.)
Code
Tweet Storage...
     CF /                     User      User      User      Global
              User   Tweet
   Row Key                   Tweets   Timeline   Metrics   Timeline



  user_name   ✓               ✓         ✓          ✓


   tweet_id           ✓
Followers Storage...
       CF /                        Ordered
                  Relationships                   TweetDelivery
     Row Key                      Relationships


    (user_name,
      rel_type)        ✓               ✓


     tweet_id                                          ✓
Data Driven
Wellington
(It’s a meet-up on MeetUp.Com)
Aaron Morton
                     @aaronmorton
                   www.thelastpickle.com




Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License

More Related Content

More from aaronmorton

More from aaronmorton (18)

Cassandra South Bay Meetup - Backup And Restore For Apache Cassandra
Cassandra South Bay Meetup - Backup And Restore For Apache CassandraCassandra South Bay Meetup - Backup And Restore For Apache Cassandra
Cassandra South Bay Meetup - Backup And Restore For Apache Cassandra
 
Cassandra SF Meetup - CQL Performance With Apache Cassandra 3.X
Cassandra SF Meetup - CQL Performance With Apache Cassandra 3.XCassandra SF Meetup - CQL Performance With Apache Cassandra 3.X
Cassandra SF Meetup - CQL Performance With Apache Cassandra 3.X
 
Cassandra Day Atlanta 2016 - Monitoring Cassandra
Cassandra Day Atlanta 2016  - Monitoring CassandraCassandra Day Atlanta 2016  - Monitoring Cassandra
Cassandra Day Atlanta 2016 - Monitoring Cassandra
 
Cassandra London March 2016 - Lightening talk - introduction to incremental ...
Cassandra London March 2016  - Lightening talk - introduction to incremental ...Cassandra London March 2016  - Lightening talk - introduction to incremental ...
Cassandra London March 2016 - Lightening talk - introduction to incremental ...
 
Cassandra SF 2015 - Repeatable, Scalable, Reliable, Observable Cassandra
Cassandra SF 2015 - Repeatable, Scalable, Reliable, Observable CassandraCassandra SF 2015 - Repeatable, Scalable, Reliable, Observable Cassandra
Cassandra SF 2015 - Repeatable, Scalable, Reliable, Observable Cassandra
 
Cassandra sf 2015 - Steady State Data Size With Compaction, Tombstones, and TTL
Cassandra sf 2015 - Steady State Data Size With Compaction, Tombstones, and TTL Cassandra sf 2015 - Steady State Data Size With Compaction, Tombstones, and TTL
Cassandra sf 2015 - Steady State Data Size With Compaction, Tombstones, and TTL
 
Cassandra TK 2014 - Large Nodes
Cassandra TK 2014 - Large NodesCassandra TK 2014 - Large Nodes
Cassandra TK 2014 - Large Nodes
 
Cassandra Community Webinar August 29th 2013 - In Case Of Emergency, Break Glass
Cassandra Community Webinar August 29th 2013 - In Case Of Emergency, Break GlassCassandra Community Webinar August 29th 2013 - In Case Of Emergency, Break Glass
Cassandra Community Webinar August 29th 2013 - In Case Of Emergency, Break Glass
 
Cassandra Community Webinar - August 22 2013 - Cassandra Internals
Cassandra Community Webinar - August 22 2013 - Cassandra InternalsCassandra Community Webinar - August 22 2013 - Cassandra Internals
Cassandra Community Webinar - August 22 2013 - Cassandra Internals
 
Cassandra SF 2013 - In Case Of Emergency Break Glass
Cassandra SF 2013 - In Case Of Emergency Break GlassCassandra SF 2013 - In Case Of Emergency Break Glass
Cassandra SF 2013 - In Case Of Emergency Break Glass
 
Cassandra SF 2013 - Cassandra Internals
Cassandra SF 2013 - Cassandra InternalsCassandra SF 2013 - Cassandra Internals
Cassandra SF 2013 - Cassandra Internals
 
Cassandra Community Webinar - Introduction To Apache Cassandra 1.2
Cassandra Community Webinar  - Introduction To Apache Cassandra 1.2Cassandra Community Webinar  - Introduction To Apache Cassandra 1.2
Cassandra Community Webinar - Introduction To Apache Cassandra 1.2
 
Apache Cassandra in Bangalore - Cassandra Internals and Performance
Apache Cassandra in Bangalore - Cassandra Internals and PerformanceApache Cassandra in Bangalore - Cassandra Internals and Performance
Apache Cassandra in Bangalore - Cassandra Internals and Performance
 
Apache Con NA 2013 - Cassandra Internals
Apache Con NA 2013 - Cassandra InternalsApache Con NA 2013 - Cassandra Internals
Apache Con NA 2013 - Cassandra Internals
 
Cassandra SF 2012 - Technical Deep Dive: query performance
Cassandra SF 2012 - Technical Deep Dive: query performance Cassandra SF 2012 - Technical Deep Dive: query performance
Cassandra SF 2012 - Technical Deep Dive: query performance
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
Building a distributed Key-Value store with Cassandra
Building a distributed Key-Value store with CassandraBuilding a distributed Key-Value store with Cassandra
Building a distributed Key-Value store with Cassandra
 
Cassandra - Wellington No Sql
Cassandra - Wellington No SqlCassandra - Wellington No Sql
Cassandra - Wellington No Sql
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Hello @world #cassandra

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n