a quick look at cassandra
DESCRIPTION
This from a presentation I did at the Phoenix Java User Group on 11/10/2010.TRANSCRIPT
![Page 1: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/1.jpg)
A Quick Look At
Bryan Williams
![Page 2: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/2.jpg)
No SQL
![Page 3: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/3.jpg)
History
Created at Facebook in 2007
Open Sourced in 2008
Currently version 0.6.6
Version 0.7 in Beta 3
![Page 4: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/4.jpg)
CAP Theorem
Consistency
Availability
Partition Tolerance
![Page 5: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/5.jpg)
![Page 6: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/6.jpg)
![Page 7: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/7.jpg)
Scaling
Vertical
More RAM
Faster CPU
Faster HD
Horizontal
More Servers
Shared Load
![Page 8: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/8.jpg)
Features
Decentralized (peer to peer)
Elastic
Shared Nothing Architecture
Tuneable Consistency
Always Writeable
Optimized for excellent throughput on writes
![Page 9: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/9.jpg)
Influences
BigTable
column family data model
High Throughput Writes
Dynamo
Hight availabilty
Scalability
Eventual Consistency (Tuneable)
![Page 10: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/10.jpg)
Data Model
Cluster
Keyspace
Column Families
Super Columns
Columns
![Page 11: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/11.jpg)
![Page 12: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/12.jpg)
![Page 13: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/13.jpg)
![Page 14: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/14.jpg)
Cassandra’s CLI(Command Line Interface)
![Page 15: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/15.jpg)
Secondary Indexes
Use another column family with reverse lookup
Specify Metadata on the Column Family and set the index name and type
Support coming in 0.7
![Page 16: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/16.jpg)
Writes
Commit Logs
Memtable
SSTable
Hinted Handoff
Bloom Filter
Tombstone
![Page 17: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/17.jpg)
Partitioning
Random Partitioner
Order Preserving Partitioner
Collating Order Preserving Partitioner
Byte Order Partitioner
![Page 18: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/18.jpg)
Snitches
Simple Snitch
Property File Snitch
![Page 19: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/19.jpg)
Column Sorting
AsciiType
BytesType
LexicalUUIDType
LongType
IntegerType
TimeUUIDType
UTF8Type
Custom
![Page 20: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/20.jpg)
Replication Factor
Set per keyspace
Specified in servers config file
Indicates how many nodes you want to store a value in on every write
![Page 21: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/21.jpg)
Consistency Level
Set per query
Specified by the client
Indicates how many nodes the client has decided must respond for a successful read/write
Based on replication factor, not on the number of nodes in the system
![Page 22: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/22.jpg)
Write Consistency Levels
Zero: No response required
Any: 1st response from any node
One: 1st response (counting Hints)
quorum: n/2 + 1
All: All replicas must respond
![Page 23: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/23.jpg)
Read Consistency Levels
One: The first response is taken
Quorum: N/2 + 1 replicas are required to respond
All: All replicas are required to respond
![Page 24: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/24.jpg)
Gossiper
Protocol used for intra-ring communication
Runs every second on a timer
Used by hinted-handoff
![Page 25: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/25.jpg)
Anti-Entropy
Replica synchronization mechanism
Ensures data on different nodes are up to date
merkle trees
Happens after each update
![Page 26: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/26.jpg)
Read Repair
When a read operation found inconsistent data in different nodes
Timestamp for all replicas are checked
all replicas are updated based on most recent value
Weak vs Strong consistency entails whether Read Repair happens before or after returning results
![Page 27: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/27.jpg)
Replication Strategies
Simple Strategy
Old Network Topology Strategy
Network Topology Strategy
![Page 28: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/28.jpg)
Java Client Options
Thrift : http://incubator.apache.org/thrift
Avro : http://avro.apache.org
Hector : https://github.com/rantav/hector
Pelops : http://code.google.com/p/pelops
Kundera : http://code.google.com/p/kundera
More : http://wiki.apache.org/cassandra/ClientOptions
![Page 29: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/29.jpg)
Cassandra: The Definitive Guide
Author: Eben Hewitt
Publisher: Oreilly
Release: Late November
![Page 30: A Quick Look At Cassandra](https://reader033.vdocuments.mx/reader033/viewer/2022052522/54b7a20c4a79592d048b45ea/html5/thumbnails/30.jpg)
Thanks For Coming
Bryan Williams
Email : [email protected]
Twitter : @BryWilliams
LINKS
http://cassandra.apache.org
http://wiki.apache.org
https://github.com/ericflo/twissandra