A Quick Look At Cassandra

30
A Quick Look At Bryan Williams

description

This from a presentation I did at the Phoenix Java User Group on 11/10/2010.

Transcript of A Quick Look At Cassandra

Page 1: A Quick Look At Cassandra

A Quick Look At

Bryan Williams

Page 2: A Quick Look At Cassandra

No SQL

Page 3: A Quick Look At Cassandra

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

CAP Theorem

Consistency

Availability

Partition Tolerance

Page 5: A Quick Look At Cassandra
Page 6: A Quick Look At Cassandra
Page 7: A Quick Look At Cassandra

Scaling

Vertical

More RAM

Faster CPU

Faster HD

Horizontal

More Servers

Shared Load

Page 8: A Quick Look At Cassandra

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

Influences

BigTable

column family data model

High Throughput Writes

Dynamo

Hight availabilty

Scalability

Eventual Consistency (Tuneable)

Page 10: A Quick Look At Cassandra

Data Model

Cluster

Keyspace

Column Families

Super Columns

Columns

Page 11: A Quick Look At Cassandra
Page 12: A Quick Look At Cassandra
Page 13: A Quick Look At Cassandra
Page 14: A Quick Look At Cassandra

Cassandra’s CLI(Command Line Interface)

Page 15: A Quick Look At Cassandra

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

Writes

Commit Logs

Memtable

SSTable

Hinted Handoff

Bloom Filter

Tombstone

Page 17: A Quick Look At Cassandra

Partitioning

Random Partitioner

Order Preserving Partitioner

Collating Order Preserving Partitioner

Byte Order Partitioner

Page 18: A Quick Look At Cassandra

Snitches

Simple Snitch

Property File Snitch

Page 19: A Quick Look At Cassandra

Column Sorting

AsciiType

BytesType

LexicalUUIDType

LongType

IntegerType

TimeUUIDType

UTF8Type

Custom

Page 20: A Quick Look At Cassandra

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

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

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

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

Gossiper

Protocol used for intra-ring communication

Runs every second on a timer

Used by hinted-handoff

Page 25: A Quick Look At Cassandra

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

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

Replication Strategies

Simple Strategy

Old Network Topology Strategy

Network Topology Strategy

Page 28: A Quick Look At Cassandra

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

Cassandra: The Definitive Guide

 Author:  Eben  Hewitt

 Publisher:  Oreilly

 Release:  Late  November

Page 30: A Quick Look At Cassandra

Thanks For Coming

Bryan Williams

Email : [email protected]

Twitter : @BryWilliams

LINKS

http://cassandra.apache.org

http://wiki.apache.org

https://github.com/ericflo/twissandra