Cassandra Prophecy

62
Cassandra Prophecy E-mail: [email protected] Igor Khotin

description

introduction to Apache Cassandra distributed database

Transcript of Cassandra Prophecy

Page 1: Cassandra Prophecy

CassandraProphecy

E-mail: [email protected] Khotin

Page 2: Cassandra Prophecy

Background● 11+ years in the IT industry● 6+ years with Java● Flexible design promoter● Agile-junkie

Page 3: Cassandra Prophecy
Page 4: Cassandra Prophecy

highly scalable, eventually consistent, distributed, structured key-value store

Page 5: Cassandra Prophecy

Decentralized

● P2P● No SPOF● No network bottlenecks

Page 6: Cassandra Prophecy

Fault Tolerant

● High Availability● Replication and redundancy● Node replacement & no downtime● Multiple racks & datacenters

Page 7: Cassandra Prophecy

Elastic Scalability

● Scales up and down● Just add or remove nodes● Linear scalability● Low maintenance cost

Page 8: Cassandra Prophecy

Tunable consistency

● Different consistency levels● Consistency vs. latency

Page 9: Cassandra Prophecy

Rich Data Model

● Goes beyond simple key-value● Values could be indexed● Flexible schema

Page 10: Cassandra Prophecy

Scale up problem

Page 11: Cassandra Prophecy

Sharding doesn't solve it

Page 12: Cassandra Prophecy
Page 13: Cassandra Prophecy

Google File System & Google BigTable

Page 14: Cassandra Prophecy
Page 15: Cassandra Prophecy

Amazon Dynamo

Page 16: Cassandra Prophecy
Page 17: Cassandra Prophecy

Cassandraby Avinash Lakshman and Prashant Malik

Page 18: Cassandra Prophecy

Cassandraused in Inbox Search

Page 19: Cassandra Prophecy

Open sourced in July 2008

Page 20: Cassandra Prophecy

March 2009Accepted to Apache Incubator

Page 21: Cassandra Prophecy

February 2010Top-Level Apache Project

Page 22: Cassandra Prophecy

late 2010...Cassandra abandoned

Messaging moved to HBase

Page 23: Cassandra Prophecy

October 2011Release 1.0

Page 24: Cassandra Prophecy

November 30, 2011Release 1.0.5

(current stable)

Page 25: Cassandra Prophecy

Moving forward fast...

Page 26: Cassandra Prophecy
Page 27: Cassandra Prophecy

Brewer's CAP Theorem

Page 28: Cassandra Prophecy

Data Model

Page 29: Cassandra Prophecy

Column Family

Page 30: Cassandra Prophecy

Column sorting● ASCII● UTF8● Bytes● Long● LexicalUUID● TimeUUID● Custom

Design decision

Page 31: Cassandra Prophecy

Denormalization

Page 32: Cassandra Prophecy

Denormalization

Page 33: Cassandra Prophecy

Design for queries

Page 34: Cassandra Prophecy

Keyring

Page 35: Cassandra Prophecy

Keyring

Page 36: Cassandra Prophecy

Keyring

Page 37: Cassandra Prophecy

Keyring

Page 38: Cassandra Prophecy

Keyring

Page 39: Cassandra Prophecy

Keyring

Page 40: Cassandra Prophecy

Keyring

Page 41: Cassandra Prophecy

Keyring

Page 42: Cassandra Prophecy

Gossip

Page 43: Cassandra Prophecy

Optimized for writes

Page 44: Cassandra Prophecy

Optimized for writes● No reads● No seeks● No b-trees● Fast● Row - atomic

Page 45: Cassandra Prophecy
Page 46: Cassandra Prophecy

Tunable Consistency

Page 47: Cassandra Prophecy

Tombstone

Page 48: Cassandra Prophecy

Low Level Clients● Thrift

● IDL and binary communication protocol● Multiple languages support● Really sucks

● Avro● Better than Thrift, but sucks anyway

Page 49: Cassandra Prophecy

High Level Clients● Feature-rich

● Connection pool● Load-balancing● Fail-over

● Hector, Pelops... (Java)● Pycassa... (Python)● Fauna (Ruby)● ...

Page 50: Cassandra Prophecy

CQL● SQL for NoSQL

● CREATE KEYSPACE, CREATE COLUMNFAMILY, CREATE INDEX

● USE, SELECT, UPDATE, DELETE...

SELECT population FROM cityWHERE KEY = 'Paris'USING CONSISTENCY QUORUM

Page 51: Cassandra Prophecy
Page 52: Cassandra Prophecy
Page 53: Cassandra Prophecy

Understand your problem

Page 54: Cassandra Prophecy

Understand your problem

Find appropriate solution

Page 55: Cassandra Prophecy
Page 56: Cassandra Prophecy

Don't let default solutions to be imposed on you

Page 57: Cassandra Prophecy

Hard to choose?

Page 58: Cassandra Prophecy

Leaders will emerge

Page 59: Cassandra Prophecy
Page 60: Cassandra Prophecy

Resources● http://cassandra.apache.org● Dynamo: Amazon’s Highly Available Key-value Store

● Cassandra - A Decentralized Structured Storage System

● Bigtable: A Distributed Storage System for Structured Data

Page 61: Cassandra Prophecy

Contacts

E-mail: [email protected]: www.ikhotin.comTwitter: chaostarter

Page 62: Cassandra Prophecy

Questions?