SlideShare uma empresa Scribd logo
1 de 43
Baixar para ler offline
Apache Cassandra:

   Distributed DB for Massive Scale

                  Austin JUG
Stu Hood (@stuhood) – Technical Lead, Rackspace
               January 26th 2010
My, what a large/volatile dataset you
               have...
●   Large
    ●   Larger than 1 node can handle
●   Volatile
    ●   More than 25% (ish) writes
●   Expensive
    ●   More than you can afford with a commercial
        solution
My, what a large/volatile dataset you
               have...
●   For example
    ●   Event/log data
    ●   Output of batch processing or log analytics jobs
        –   In Hadoop, particularly
    ●   Social network relationships/updates
What about sharding?
●   shard n. - A horizontal partition in a database
    ●   Example: Sharding by userid
●   Limitations (for the partitioned dimension)
    ●   No more joins
    ●   No more indexes
What about sharding?
●   Options
    ●   Provided by ORM?
        –   Fixed partitions: manual rebalancing
    ●   Developing from scratch?
        –   Adding/removing nodes
        –   Handling failover
        –   As a library? As a middle tier?
What about sharding?



    Pain in the ass.
Case Study: Digg
1.Vertical partitioning and master/slave trees
2.Developed sharding solution
  ●   IDDB
  ●   Awkward replication, fragile scaling
3.Began populating Cassandra in parallel
  ●   Initial dataset for 'green badges'
      –   3 TB
      –   76 billion kv pairs
  ●   Most applications being ported to Cassandra
Relationship trouble: The NoSQL
           Movement
Lessons from the NoSQL Movement
●   Not Only SQL: Specialization!
    ●   Relational is not always the answer
    ●   Need highly specialized systems to distribute:
        –   Transactions
        –   Joins
    ●   Normalization strives to remove duplication
        –   But duplication is an interesting alternative to joins
Lessons from the NoSQL Movement
●   Understanding your data, finding the most efficient
    model
    ●   Key-value / Document
        –   Hint: already denormalized? fits in memcache?
        –   Cassandra, Riak, Voldemort, CouchDB, MongoDB
    ●   Graph/RDF
        –   Hint: frequent schema changes or deeply nested joins?
        –   Neo4j, Sesame
    ●   Column store
        –   Hint: all writes go to the end of a few tables?
        –   Cassandra, SDB, Hbase, Hypertable
Lessons from the NoSQL Movement
●   Replication is not one-size-fits-all
    ●   Facebook multi datacenter caching
        –   Writes occurring in one DC need to expire caches
            elsewhere
        –   Label events as requiring cache expiration
    ●   Google semi-synchronous replication patches
        –   Selective synchronous replication
    ●   Fragile write master
        –   DRBD for high availability
Lessons from the NoSQL Movement
●   Partition tolerance vs. consistency
    ●   Brewer's CAP Theorem
        –   Consistency, Availability, Partition tolerance
        –   Choose 2:
             ●   CA – Corruption possible if live nodes can’t communicate
                 (network partition)
             ●   CP – Completely inaccessible if any nodes are dead
             ●   AP – Always available, but may not always read most recent
    ●   Tunables!
        –   Cassandra chooses AP, but makes consistency
            configurable
Cassandra's Elders
Standing on the shoulders of:
             Amazon Dynamo
●   No node in the cluster is special
    ●   No special roles
    ●   No scaling bottlenecks
    ●   No single point of failure
●   Techniques
    ●   Gossip
    ●   Eventual consistency
Standing on the shoulders of:
              Google Bigtable
●   Column family data model
●   Range queries for rows:
    ●   Scan rows in order
●   Memtable/SSTable structure
    ●   Always writes sequentially to disk
    ●   Bloom filters to minimize random reads
    ●   Trounces B-Trees for big data
        –   Linear insert performance
        –   Log growth for reads
Enter Cassandra
●   Hybrid of ancestors
    ●   Adopts listed features
●   And adds:
    ●   A sweet logo!
    ●   Pluggable partitioning
    ●   Multi datacenter support
        –   Pluggable locality
            awareness
    ●   Datamodel
        improvements
Enter Cassandra
●   Project status
    ●   Open sourced by Facebook (no longer active)
    ●   Apache License
    ●   Incubating with Apache: graduation in progress
    ●   Major releases: 0.3, 0.4, 0.5 (this past weekend!)
Enter Cassandra
●   The code base
    ●   Java, Apache Ant, Git/SVN
    ●   5+ committers from 3+ companies
●   Known deployments at:
    ●   Rackspace, Digg, Twitter, Mahalo, SimpleGeo,
        Cloudkick
The Datamodel
Cluster
The Datamodel
Cluster >   Keyspace



                                           Partitioners:
                             OrderPreservingPartitioner
                                    RandomPartitioner


                              Like an RDBMS schema:
                              Keyspace per application
The Datamodel
Cluster > Keyspace >   Column Family




        SortedMap<String,Row>
              Key → Row                   Like an RDBMS table:
                                       Separates types in an app
The Datamodel
Cluster > Keyspace > Column Family >   Row




                                             SortedMap<Name,Value>
                                                      ...
The Datamodel
Cluster > Keyspace > Column Family > Row >   “Column”

                                                Not like an RDBMS column:
                                          Attribute of the row: each row can
                                        contain millions of different columns


                                                               …
                                                       Name → Value
                                                          byte[] → byte[]

                                                     +version timestamp
StatusApp: another Twitter clone.
StatusApp Example
<ColumnFamily Name=”Users”>
●   Unique id as key: name->value pairs contain
    user attributes.
{key: “strangeloop_stl”, row: {“fullname”: “Dr.
Strange”, “joindate”: “20091023” … }}
StatusApp Example
<ColumnFamily Name=”Statuses”>
●   Unique id as key: name->value pairs contain
    status attributes
{key: “status19”, row: {“userid”: “user19”,
“content”: “Excited to be at #strangeloop!” … }}
StatusApp Example
<ColumnFamily Name=”Timelines”
ColumnType=”Super”>
●   User id as key: row contains lists of timelines
    that the user cares about. Each list contains
    name:value pairs representing ordered statuses
{key: “user19”, row: {“personal”: [<timeuuid>:
“status19”, … ], “following”: [<timeuuid>:
“status21”, … ] }}
Client API
●   Thrift generates client bindings for (almost) any
    language
    ●   RPC framework
●   Most popular:
    ●   Python
    ●   Ruby
    ●   Java
    ●   PHP
Client API
1. Get the full name for a user:
●   get(keyspace, key, [column_family,
    column_name], consistency_level)
●   get(“statusapp”, “userid19”, [“Users”,
    “fullname”], ONE)
> “Dr. Strange”
Client API
2. Get the 50 most recent statuses in a user's
personal timeline:
●   get_slice(keyspace, key, [column_family,
    column_name], predicate, consistency_level)
●   get_slice(“statusapp”, “userid19”, [“Timelines”,
    “personal”], {start: ””, count: 50}, QUORUM)
> [<timeuuid>: “status19”, <timeuuid>: “status24”
…]
Consistency Levels?
●   Eventual consistency
    ●   Synch to Washington, asynch to Hong Kong
●   Client API Tunables
    ●   Synchronously write to W replicas
    ●   Confirm R replicas match at read time
    ●   of N total replicas
●   Allows for almost-strong consistency
    ●   When W + R > N
Caveat consumptor
●   No secondary indexes:
    ●   Querying the content of rows always involves
        iterating over them
    ●   Example: Finding users with a certain last name
●   Solution: Manually maintain indexes
    ●   Implications:
        –   Indexes must by synced with the indexed data manually
        –   New indexes mean new writes, reads
Caveat consumptor
●   No joins:
    ●   No server side method to re-query based on a first
        query
●   Solution: Denormalize some queries, client join
    the rest
The bright side: Ops
●   Need N new nodes?
    ●   Start more nodes with the same config file
    ●   New nodes request load information from the
        cluster and join with a token that balances the
        cluster
The bright side: Ops
●   Dead drive?
    ●   Swap the drive, restart, run 'repair'
    ●   Streams missing data from other replicas
The bright side: Ops
●   Dead node?
    ●   Start a new node with the same IP and token, run
        'repair'
The bright side: Ops
●   Adding a datacenter?
    ●   Extend the 'EndpointSnitch' class to describe the
        location of your nodes
    ●   Add new nodes as before
The bright side: Performance
Getting started
●   http://incubator.apache.org/cassandra/
●   Read "Getting Started"... Roughly:
    ●   Start one node
    ●   Test/develop app, editing node config as necessary
        –   Don't skip: exposes partitioner, data model
            strengths/weaknesses
    ●   Launch cluster by starting more nodes with chosen
        config
Getting started
●   Resources
    ●   http://incubator.apache.org/cassandra/
    ●   Wiki
    ●   Mailing List
    ●   #cassandra on freenode.net
Thanks!
Austin JUG
   UT
Rackspace
Questions?
References
●   Digg Technology Blog
    ●   http://about.digg.com/blog/looking-future-cassandra
    ●   http://about.digg.com/blog/introducing-digg’s-iddb-
        infrastructure
●   Cassandra Wiki
    ●   http://wiki.apache.org/cassandra/
●   Werner Vogels – Eventual Consistency
    ●   http://www.allthingsdistributed.com/2008/12/eventually_consist
        ent.html
●   Jonathan Ellis's Blog
    ●   http://spyced.blogspot.com/2010/01/cassandra-05.html

Mais conteúdo relacionado

Mais procurados

HBaseCon 2012 | HBase and HDFS: Past, Present, Future - Todd Lipcon, Cloudera
HBaseCon 2012 | HBase and HDFS: Past, Present, Future - Todd Lipcon, ClouderaHBaseCon 2012 | HBase and HDFS: Past, Present, Future - Todd Lipcon, Cloudera
HBaseCon 2012 | HBase and HDFS: Past, Present, Future - Todd Lipcon, ClouderaCloudera, Inc.
 
HBaseCon 2013: Apache HBase at Pinterest - Scaling Our Feed Storage
HBaseCon 2013: Apache HBase at Pinterest - Scaling Our Feed StorageHBaseCon 2013: Apache HBase at Pinterest - Scaling Our Feed Storage
HBaseCon 2013: Apache HBase at Pinterest - Scaling Our Feed StorageCloudera, Inc.
 
Apache Cassandra Interview Questions and Answers | Cassandra Tutorial | Cassa...
Apache Cassandra Interview Questions and Answers | Cassandra Tutorial | Cassa...Apache Cassandra Interview Questions and Answers | Cassandra Tutorial | Cassa...
Apache Cassandra Interview Questions and Answers | Cassandra Tutorial | Cassa...Edureka!
 
Intro to HBase - Lars George
Intro to HBase - Lars GeorgeIntro to HBase - Lars George
Intro to HBase - Lars GeorgeJAX London
 
Impala presentation ahad rana
Impala presentation ahad ranaImpala presentation ahad rana
Impala presentation ahad ranaData Con LA
 
Scaling Twitter with Cassandra
Scaling Twitter with CassandraScaling Twitter with Cassandra
Scaling Twitter with CassandraRyan King
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & FeaturesPhil Peace
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache CassandraRobert Stupp
 
Apache Cassandra overview
Apache Cassandra overviewApache Cassandra overview
Apache Cassandra overviewElifTech
 
Apache Drill (ver. 0.1, check ver. 0.2)
Apache Drill (ver. 0.1, check ver. 0.2)Apache Drill (ver. 0.1, check ver. 0.2)
Apache Drill (ver. 0.1, check ver. 0.2)Camuel Gilyadov
 
Hadoop Integration in Cassandra
Hadoop Integration in CassandraHadoop Integration in Cassandra
Hadoop Integration in CassandraJairam Chandar
 
Heuritech: Apache Spark REX
Heuritech: Apache Spark REXHeuritech: Apache Spark REX
Heuritech: Apache Spark REXdidmarin
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to CassandraSoftwareMill
 
Hw09 Sqoop Database Import For Hadoop
Hw09   Sqoop Database Import For HadoopHw09   Sqoop Database Import For Hadoop
Hw09 Sqoop Database Import For HadoopCloudera, Inc.
 
Scalable PHP Applications With Cassandra
Scalable PHP Applications With CassandraScalable PHP Applications With Cassandra
Scalable PHP Applications With CassandraAndrea De Pirro
 

Mais procurados (20)

HBaseCon 2012 | HBase and HDFS: Past, Present, Future - Todd Lipcon, Cloudera
HBaseCon 2012 | HBase and HDFS: Past, Present, Future - Todd Lipcon, ClouderaHBaseCon 2012 | HBase and HDFS: Past, Present, Future - Todd Lipcon, Cloudera
HBaseCon 2012 | HBase and HDFS: Past, Present, Future - Todd Lipcon, Cloudera
 
NoSQL: Cassadra vs. HBase
NoSQL: Cassadra vs. HBaseNoSQL: Cassadra vs. HBase
NoSQL: Cassadra vs. HBase
 
HBaseCon 2013: Apache HBase at Pinterest - Scaling Our Feed Storage
HBaseCon 2013: Apache HBase at Pinterest - Scaling Our Feed StorageHBaseCon 2013: Apache HBase at Pinterest - Scaling Our Feed Storage
HBaseCon 2013: Apache HBase at Pinterest - Scaling Our Feed Storage
 
Apache Cassandra Interview Questions and Answers | Cassandra Tutorial | Cassa...
Apache Cassandra Interview Questions and Answers | Cassandra Tutorial | Cassa...Apache Cassandra Interview Questions and Answers | Cassandra Tutorial | Cassa...
Apache Cassandra Interview Questions and Answers | Cassandra Tutorial | Cassa...
 
Intro to HBase - Lars George
Intro to HBase - Lars GeorgeIntro to HBase - Lars George
Intro to HBase - Lars George
 
Impala presentation ahad rana
Impala presentation ahad ranaImpala presentation ahad rana
Impala presentation ahad rana
 
Scaling Twitter with Cassandra
Scaling Twitter with CassandraScaling Twitter with Cassandra
Scaling Twitter with Cassandra
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache Cassandra
 
Apache Cassandra overview
Apache Cassandra overviewApache Cassandra overview
Apache Cassandra overview
 
Apache Drill (ver. 0.1, check ver. 0.2)
Apache Drill (ver. 0.1, check ver. 0.2)Apache Drill (ver. 0.1, check ver. 0.2)
Apache Drill (ver. 0.1, check ver. 0.2)
 
Hadoop Integration in Cassandra
Hadoop Integration in CassandraHadoop Integration in Cassandra
Hadoop Integration in Cassandra
 
Hbase: an introduction
Hbase: an introductionHbase: an introduction
Hbase: an introduction
 
Heuritech: Apache Spark REX
Heuritech: Apache Spark REXHeuritech: Apache Spark REX
Heuritech: Apache Spark REX
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
Cassandra+Hadoop
Cassandra+HadoopCassandra+Hadoop
Cassandra+Hadoop
 
Cassandra
CassandraCassandra
Cassandra
 
Apache cassandra
Apache cassandraApache cassandra
Apache cassandra
 
Hw09 Sqoop Database Import For Hadoop
Hw09   Sqoop Database Import For HadoopHw09   Sqoop Database Import For Hadoop
Hw09 Sqoop Database Import For Hadoop
 
Scalable PHP Applications With Cassandra
Scalable PHP Applications With CassandraScalable PHP Applications With Cassandra
Scalable PHP Applications With Cassandra
 

Destaque

Science ABC Book
Science ABC BookScience ABC Book
Science ABC Booktjelk1
 
1st step LogicFlow
1st step LogicFlow1st step LogicFlow
1st step LogicFlowTomoyuki Obi
 
How to Collect and Process Data Under GDPR?
How to Collect and Process Data Under GDPR?How to Collect and Process Data Under GDPR?
How to Collect and Process Data Under GDPR?Piwik PRO
 
Revue de presse Telecom Valley - Juin 2016
Revue de presse Telecom Valley - Juin 2016Revue de presse Telecom Valley - Juin 2016
Revue de presse Telecom Valley - Juin 2016TelecomValley
 
(BDT306) Mission-Critical Stream Processing with Amazon EMR and Amazon Kinesi...
(BDT306) Mission-Critical Stream Processing with Amazon EMR and Amazon Kinesi...(BDT306) Mission-Critical Stream Processing with Amazon EMR and Amazon Kinesi...
(BDT306) Mission-Critical Stream Processing with Amazon EMR and Amazon Kinesi...Amazon Web Services
 
Oracle OpenWorld - A quick take on all 22 press releases of Day #1 - #3
Oracle OpenWorld - A quick take on all 22 press releases of Day #1 - #3Oracle OpenWorld - A quick take on all 22 press releases of Day #1 - #3
Oracle OpenWorld - A quick take on all 22 press releases of Day #1 - #3Holger Mueller
 
Big Data Expo 2015 - Hortonworks Common Hadoop Use Cases
Big Data Expo 2015 - Hortonworks Common Hadoop Use CasesBig Data Expo 2015 - Hortonworks Common Hadoop Use Cases
Big Data Expo 2015 - Hortonworks Common Hadoop Use CasesBigDataExpo
 
IBM CEC Big Data 2011 06-11 final
IBM CEC Big Data 2011 06-11 finalIBM CEC Big Data 2011 06-11 final
IBM CEC Big Data 2011 06-11 finalCOMMON Europe
 
Drive faster & better software delivery with performance monitoring & DevOps
Drive faster & better software delivery with performance monitoring & DevOpsDrive faster & better software delivery with performance monitoring & DevOps
Drive faster & better software delivery with performance monitoring & DevOpsVolker Linz
 
Cyberlaw and Cybercrime
Cyberlaw and CybercrimeCyberlaw and Cybercrime
Cyberlaw and CybercrimePravir Karna
 
AWSome Day - Milan, July 24th 2014
AWSome Day - Milan, July 24th 2014AWSome Day - Milan, July 24th 2014
AWSome Day - Milan, July 24th 2014Amazon Web Services
 
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...Lucidworks
 
OC Big Data Monthly Meetup #6 - Session 1 - IBM
OC Big Data Monthly Meetup #6 - Session 1 - IBMOC Big Data Monthly Meetup #6 - Session 1 - IBM
OC Big Data Monthly Meetup #6 - Session 1 - IBMBig Data Joe™ Rossi
 
Things you should know about Scalability!
Things you should know about Scalability!Things you should know about Scalability!
Things you should know about Scalability!Robert Mederer
 

Destaque (20)

Science ABC Book
Science ABC BookScience ABC Book
Science ABC Book
 
1st step LogicFlow
1st step LogicFlow1st step LogicFlow
1st step LogicFlow
 
How to Collect and Process Data Under GDPR?
How to Collect and Process Data Under GDPR?How to Collect and Process Data Under GDPR?
How to Collect and Process Data Under GDPR?
 
Revue de presse Telecom Valley - Juin 2016
Revue de presse Telecom Valley - Juin 2016Revue de presse Telecom Valley - Juin 2016
Revue de presse Telecom Valley - Juin 2016
 
(BDT306) Mission-Critical Stream Processing with Amazon EMR and Amazon Kinesi...
(BDT306) Mission-Critical Stream Processing with Amazon EMR and Amazon Kinesi...(BDT306) Mission-Critical Stream Processing with Amazon EMR and Amazon Kinesi...
(BDT306) Mission-Critical Stream Processing with Amazon EMR and Amazon Kinesi...
 
Oracle OpenWorld - A quick take on all 22 press releases of Day #1 - #3
Oracle OpenWorld - A quick take on all 22 press releases of Day #1 - #3Oracle OpenWorld - A quick take on all 22 press releases of Day #1 - #3
Oracle OpenWorld - A quick take on all 22 press releases of Day #1 - #3
 
stagerapport2.3
stagerapport2.3stagerapport2.3
stagerapport2.3
 
Rb wilmer peres
Rb wilmer peresRb wilmer peres
Rb wilmer peres
 
Big Data Expo 2015 - Hortonworks Common Hadoop Use Cases
Big Data Expo 2015 - Hortonworks Common Hadoop Use CasesBig Data Expo 2015 - Hortonworks Common Hadoop Use Cases
Big Data Expo 2015 - Hortonworks Common Hadoop Use Cases
 
IBM CEC Big Data 2011 06-11 final
IBM CEC Big Data 2011 06-11 finalIBM CEC Big Data 2011 06-11 final
IBM CEC Big Data 2011 06-11 final
 
Waarom ontwikkelt elk kind zich anders - prof. dr. Frank Verhulst
Waarom ontwikkelt elk kind zich anders - prof. dr. Frank VerhulstWaarom ontwikkelt elk kind zich anders - prof. dr. Frank Verhulst
Waarom ontwikkelt elk kind zich anders - prof. dr. Frank Verhulst
 
Unc plus delta
Unc plus deltaUnc plus delta
Unc plus delta
 
Drive faster & better software delivery with performance monitoring & DevOps
Drive faster & better software delivery with performance monitoring & DevOpsDrive faster & better software delivery with performance monitoring & DevOps
Drive faster & better software delivery with performance monitoring & DevOps
 
Cyberlaw and Cybercrime
Cyberlaw and CybercrimeCyberlaw and Cybercrime
Cyberlaw and Cybercrime
 
AWSome Day - Milan, July 24th 2014
AWSome Day - Milan, July 24th 2014AWSome Day - Milan, July 24th 2014
AWSome Day - Milan, July 24th 2014
 
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
Tuning Solr and its Pipeline for Logs: Presented by Rafał Kuć & Radu Gheorghe...
 
Introduction to QC
Introduction to QCIntroduction to QC
Introduction to QC
 
OC Big Data Monthly Meetup #6 - Session 1 - IBM
OC Big Data Monthly Meetup #6 - Session 1 - IBMOC Big Data Monthly Meetup #6 - Session 1 - IBM
OC Big Data Monthly Meetup #6 - Session 1 - IBM
 
Resume Building for Teens
Resume Building for TeensResume Building for Teens
Resume Building for Teens
 
Things you should know about Scalability!
Things you should know about Scalability!Things you should know about Scalability!
Things you should know about Scalability!
 

Semelhante a Cassandra Talk: Austin JUG

Cassandra: Open Source Bigtable + Dynamo
Cassandra: Open Source Bigtable + DynamoCassandra: Open Source Bigtable + Dynamo
Cassandra: Open Source Bigtable + Dynamojbellis
 
Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into CassandraBrent Theisen
 
Storage cassandra
Storage   cassandraStorage   cassandra
Storage cassandraPL dream
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra nehabsairam
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataRoger Xia
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandraAaron Ploetz
 
Scala Days Highlights | BoldRadius
Scala Days Highlights | BoldRadiusScala Days Highlights | BoldRadius
Scala Days Highlights | BoldRadiusBoldRadius Solutions
 
Avoiding Pitfalls for Cassandra.pdf
Avoiding Pitfalls for Cassandra.pdfAvoiding Pitfalls for Cassandra.pdf
Avoiding Pitfalls for Cassandra.pdfCédrick Lunven
 
Introduction to NoSql
Introduction to NoSqlIntroduction to NoSql
Introduction to NoSqlOmid Vahdaty
 
Web-scale data processing: practical approaches for low-latency and batch
Web-scale data processing: practical approaches for low-latency and batchWeb-scale data processing: practical approaches for low-latency and batch
Web-scale data processing: practical approaches for low-latency and batchEdward Capriolo
 
Marcel Kornacker: Impala tech talk Tue Feb 26th 2013
Marcel Kornacker: Impala tech talk Tue Feb 26th 2013Marcel Kornacker: Impala tech talk Tue Feb 26th 2013
Marcel Kornacker: Impala tech talk Tue Feb 26th 2013Modern Data Stack France
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra ExplainedEric Evans
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra ExplainedEric Evans
 
HPTS 2011: The NoSQL Ecosystem
HPTS 2011: The NoSQL EcosystemHPTS 2011: The NoSQL Ecosystem
HPTS 2011: The NoSQL EcosystemAdam Marcus
 
The NoSQL Ecosystem
The NoSQL Ecosystem The NoSQL Ecosystem
The NoSQL Ecosystem yarapavan
 

Semelhante a Cassandra Talk: Austin JUG (20)

Cassandra: Open Source Bigtable + Dynamo
Cassandra: Open Source Bigtable + DynamoCassandra: Open Source Bigtable + Dynamo
Cassandra: Open Source Bigtable + Dynamo
 
Cassandra
CassandraCassandra
Cassandra
 
Cassandra
CassandraCassandra
Cassandra
 
Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into Cassandra
 
Storage cassandra
Storage   cassandraStorage   cassandra
Storage cassandra
 
Cassandra training
Cassandra trainingCassandra training
Cassandra training
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_data
 
Cassandra Database
Cassandra DatabaseCassandra Database
Cassandra Database
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandra
 
NoSql Database
NoSql DatabaseNoSql Database
NoSql Database
 
Scala Days Highlights | BoldRadius
Scala Days Highlights | BoldRadiusScala Days Highlights | BoldRadius
Scala Days Highlights | BoldRadius
 
Avoiding Pitfalls for Cassandra.pdf
Avoiding Pitfalls for Cassandra.pdfAvoiding Pitfalls for Cassandra.pdf
Avoiding Pitfalls for Cassandra.pdf
 
Introduction to NoSql
Introduction to NoSqlIntroduction to NoSql
Introduction to NoSql
 
Web-scale data processing: practical approaches for low-latency and batch
Web-scale data processing: practical approaches for low-latency and batchWeb-scale data processing: practical approaches for low-latency and batch
Web-scale data processing: practical approaches for low-latency and batch
 
Marcel Kornacker: Impala tech talk Tue Feb 26th 2013
Marcel Kornacker: Impala tech talk Tue Feb 26th 2013Marcel Kornacker: Impala tech talk Tue Feb 26th 2013
Marcel Kornacker: Impala tech talk Tue Feb 26th 2013
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra Explained
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra Explained
 
HPTS 2011: The NoSQL Ecosystem
HPTS 2011: The NoSQL EcosystemHPTS 2011: The NoSQL Ecosystem
HPTS 2011: The NoSQL Ecosystem
 
The NoSQL Ecosystem
The NoSQL Ecosystem The NoSQL Ecosystem
The NoSQL Ecosystem
 

Último

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
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 textsMaria Levchenko
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
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 WorkerThousandEyes
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
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
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
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
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Cassandra Talk: Austin JUG

  • 1. Apache Cassandra: Distributed DB for Massive Scale Austin JUG Stu Hood (@stuhood) – Technical Lead, Rackspace January 26th 2010
  • 2. My, what a large/volatile dataset you have... ● Large ● Larger than 1 node can handle ● Volatile ● More than 25% (ish) writes ● Expensive ● More than you can afford with a commercial solution
  • 3. My, what a large/volatile dataset you have... ● For example ● Event/log data ● Output of batch processing or log analytics jobs – In Hadoop, particularly ● Social network relationships/updates
  • 4. What about sharding? ● shard n. - A horizontal partition in a database ● Example: Sharding by userid ● Limitations (for the partitioned dimension) ● No more joins ● No more indexes
  • 5. What about sharding? ● Options ● Provided by ORM? – Fixed partitions: manual rebalancing ● Developing from scratch? – Adding/removing nodes – Handling failover – As a library? As a middle tier?
  • 6. What about sharding? Pain in the ass.
  • 7. Case Study: Digg 1.Vertical partitioning and master/slave trees 2.Developed sharding solution ● IDDB ● Awkward replication, fragile scaling 3.Began populating Cassandra in parallel ● Initial dataset for 'green badges' – 3 TB – 76 billion kv pairs ● Most applications being ported to Cassandra
  • 8. Relationship trouble: The NoSQL Movement
  • 9. Lessons from the NoSQL Movement ● Not Only SQL: Specialization! ● Relational is not always the answer ● Need highly specialized systems to distribute: – Transactions – Joins ● Normalization strives to remove duplication – But duplication is an interesting alternative to joins
  • 10. Lessons from the NoSQL Movement ● Understanding your data, finding the most efficient model ● Key-value / Document – Hint: already denormalized? fits in memcache? – Cassandra, Riak, Voldemort, CouchDB, MongoDB ● Graph/RDF – Hint: frequent schema changes or deeply nested joins? – Neo4j, Sesame ● Column store – Hint: all writes go to the end of a few tables? – Cassandra, SDB, Hbase, Hypertable
  • 11. Lessons from the NoSQL Movement ● Replication is not one-size-fits-all ● Facebook multi datacenter caching – Writes occurring in one DC need to expire caches elsewhere – Label events as requiring cache expiration ● Google semi-synchronous replication patches – Selective synchronous replication ● Fragile write master – DRBD for high availability
  • 12. Lessons from the NoSQL Movement ● Partition tolerance vs. consistency ● Brewer's CAP Theorem – Consistency, Availability, Partition tolerance – Choose 2: ● CA – Corruption possible if live nodes can’t communicate (network partition) ● CP – Completely inaccessible if any nodes are dead ● AP – Always available, but may not always read most recent ● Tunables! – Cassandra chooses AP, but makes consistency configurable
  • 14. Standing on the shoulders of: Amazon Dynamo ● No node in the cluster is special ● No special roles ● No scaling bottlenecks ● No single point of failure ● Techniques ● Gossip ● Eventual consistency
  • 15. Standing on the shoulders of: Google Bigtable ● Column family data model ● Range queries for rows: ● Scan rows in order ● Memtable/SSTable structure ● Always writes sequentially to disk ● Bloom filters to minimize random reads ● Trounces B-Trees for big data – Linear insert performance – Log growth for reads
  • 16. Enter Cassandra ● Hybrid of ancestors ● Adopts listed features ● And adds: ● A sweet logo! ● Pluggable partitioning ● Multi datacenter support – Pluggable locality awareness ● Datamodel improvements
  • 17. Enter Cassandra ● Project status ● Open sourced by Facebook (no longer active) ● Apache License ● Incubating with Apache: graduation in progress ● Major releases: 0.3, 0.4, 0.5 (this past weekend!)
  • 18. Enter Cassandra ● The code base ● Java, Apache Ant, Git/SVN ● 5+ committers from 3+ companies ● Known deployments at: ● Rackspace, Digg, Twitter, Mahalo, SimpleGeo, Cloudkick
  • 20. The Datamodel Cluster > Keyspace Partitioners: OrderPreservingPartitioner RandomPartitioner Like an RDBMS schema: Keyspace per application
  • 21. The Datamodel Cluster > Keyspace > Column Family SortedMap<String,Row> Key → Row Like an RDBMS table: Separates types in an app
  • 22. The Datamodel Cluster > Keyspace > Column Family > Row SortedMap<Name,Value> ...
  • 23. The Datamodel Cluster > Keyspace > Column Family > Row > “Column” Not like an RDBMS column: Attribute of the row: each row can contain millions of different columns … Name → Value byte[] → byte[] +version timestamp
  • 25. StatusApp Example <ColumnFamily Name=”Users”> ● Unique id as key: name->value pairs contain user attributes. {key: “strangeloop_stl”, row: {“fullname”: “Dr. Strange”, “joindate”: “20091023” … }}
  • 26. StatusApp Example <ColumnFamily Name=”Statuses”> ● Unique id as key: name->value pairs contain status attributes {key: “status19”, row: {“userid”: “user19”, “content”: “Excited to be at #strangeloop!” … }}
  • 27. StatusApp Example <ColumnFamily Name=”Timelines” ColumnType=”Super”> ● User id as key: row contains lists of timelines that the user cares about. Each list contains name:value pairs representing ordered statuses {key: “user19”, row: {“personal”: [<timeuuid>: “status19”, … ], “following”: [<timeuuid>: “status21”, … ] }}
  • 28. Client API ● Thrift generates client bindings for (almost) any language ● RPC framework ● Most popular: ● Python ● Ruby ● Java ● PHP
  • 29. Client API 1. Get the full name for a user: ● get(keyspace, key, [column_family, column_name], consistency_level) ● get(“statusapp”, “userid19”, [“Users”, “fullname”], ONE) > “Dr. Strange”
  • 30. Client API 2. Get the 50 most recent statuses in a user's personal timeline: ● get_slice(keyspace, key, [column_family, column_name], predicate, consistency_level) ● get_slice(“statusapp”, “userid19”, [“Timelines”, “personal”], {start: ””, count: 50}, QUORUM) > [<timeuuid>: “status19”, <timeuuid>: “status24” …]
  • 31. Consistency Levels? ● Eventual consistency ● Synch to Washington, asynch to Hong Kong ● Client API Tunables ● Synchronously write to W replicas ● Confirm R replicas match at read time ● of N total replicas ● Allows for almost-strong consistency ● When W + R > N
  • 32. Caveat consumptor ● No secondary indexes: ● Querying the content of rows always involves iterating over them ● Example: Finding users with a certain last name ● Solution: Manually maintain indexes ● Implications: – Indexes must by synced with the indexed data manually – New indexes mean new writes, reads
  • 33. Caveat consumptor ● No joins: ● No server side method to re-query based on a first query ● Solution: Denormalize some queries, client join the rest
  • 34. The bright side: Ops ● Need N new nodes? ● Start more nodes with the same config file ● New nodes request load information from the cluster and join with a token that balances the cluster
  • 35. The bright side: Ops ● Dead drive? ● Swap the drive, restart, run 'repair' ● Streams missing data from other replicas
  • 36. The bright side: Ops ● Dead node? ● Start a new node with the same IP and token, run 'repair'
  • 37. The bright side: Ops ● Adding a datacenter? ● Extend the 'EndpointSnitch' class to describe the location of your nodes ● Add new nodes as before
  • 38. The bright side: Performance
  • 39. Getting started ● http://incubator.apache.org/cassandra/ ● Read "Getting Started"... Roughly: ● Start one node ● Test/develop app, editing node config as necessary – Don't skip: exposes partitioner, data model strengths/weaknesses ● Launch cluster by starting more nodes with chosen config
  • 40. Getting started ● Resources ● http://incubator.apache.org/cassandra/ ● Wiki ● Mailing List ● #cassandra on freenode.net
  • 41. Thanks! Austin JUG UT Rackspace
  • 43. References ● Digg Technology Blog ● http://about.digg.com/blog/looking-future-cassandra ● http://about.digg.com/blog/introducing-digg’s-iddb- infrastructure ● Cassandra Wiki ● http://wiki.apache.org/cassandra/ ● Werner Vogels – Eventual Consistency ● http://www.allthingsdistributed.com/2008/12/eventually_consist ent.html ● Jonathan Ellis's Blog ● http://spyced.blogspot.com/2010/01/cassandra-05.html