4. What is Cassandra?
-Free, Open Source, Distributed database
-Written by 2 Facebook Engineers
-Hybrid of
-BigTable from Google
-DynamoDB from Amazon
-For Structured, Semi-structured, Unstructured Data
-Designed to scale across commodity servers
-Assures AP out of CAP
-(Consistency, Availability, Partition Tolerance)
4
5. Architectural Overview
•Independent nodes form cluster
•All nodes peers
•Gossip protocol to discover/connect nodes
•Gossip process runs every second
•Nodes exchanges state mesgs with max 3 nodes
•Nodes exchange info about themselves/Others
•Seed Nodes have cluster info in cassandra.yaml file
•All nodes have same seed nodes in their config file
•Nodes remember all gossip info since last restart
5
6. Data Partitioning
•Should be decided when setting up
•Total Data managed by Cassandra like a Ring
•Ring is divided into Ranges
•Each node responsible for one or more
•Before a node joins it is given a token
•Token depends on
•Node’s position
•Range of data it is responsible for
•Column Family partitioned based on row key
•For given row key value, ring is walked clockwise
until token is within range
•2 High Level Partitioning Schemes:
- Random Partitioner
- Ordered Partitioner
•Random Partitioner uses consistent hashing
•Ordered Partitioner ensures sorted order.
6
8. Replication
•Replication – process of storing copies of data
•Replication Strategy
•Number of Replicas
•Distro of replicas over the nodes
•Relies on cluster configured Snitch
•SimpleStrategy - default
•NetworkTopologyStrategy
•Takes rack, data center into consideration
8
9. Snitches…
•The snitch is a configurable component of cluster
•Defines how the nodes are grouped together
•Types of snitches:
•SimpleSnitch
•BriskSimpleSnitch
•RackInferringSnitch
•PropertyFileSnitch
•EC2Snitch
•Dynamic Snitching
9
11. Why Use Cassandra?
•Very High Volume writes/reads
•All writes HAVE to succeed
•Horizontal scalability
•Commodity HW
•Integration with Hadoop/Hbase/HIVE
•SQL Like usage
•No Single point of failure
•Powerful dynamic Schema data model
•Maximum flexibility
•Performance at scale
11
12. Some Well known Current Customers
WebEx Ooyala
Clearspring Openwave
Cloudkick OpenX
Cloudtalk Plaxo
connex.io Rackspace
Constant Contact Reddit
Digg SimpleGeo
Facebook SoundCloud
IBM Twitter
Netflix Walmart Labs
Formspring Yakaz
Mahalo.com
12
13. Limitations
Be aware of these differences when you move
from a relational database to Cassandra.
• No transactions,
• No JOINs
• No foreign keys and keys are immutable
• Keys have to be unique
• Failed operations may leave changes
• Searching is complicated
• Super columns and order preserving partitioners are
discouraged
• Healing from failure is manual
• It remembers deletes (until v0.8, at least)
13