(WORK IN PROGESS!)

This is an overview of Cassandra architecture aimed at Cassandra users.

Developers should probably look at the Developers links on the wiki's front page

Information is mainly based on J Ellis OSCON 09 presentation

Motivation

Scaling reads to a relational database is hard Scaling writes to a relational database is virtually impossible

... and when you do, it usually isn't relational anymore

* The new face of data

Scale out, not up Online load balancing, cluster growth Flexible schema Key-oriented queries CAP-aware

Pick two of Consistency, Availability, Partition tolerance

Two famous papers

Two approaches

10,000 ft summary

Cassandra highlights

Dynamo architecture & Lookup

Architecture details

Architecture layers

Writes

Any node Partitioner Commitlog, memtable SSTable Compaction Wait for W responses

Write model:

There are two write modes:

If node down, then write to another node with a hint saying where it should be written two. Harvester every 15 min goes through and find hints and moves the data to the appropriate node

Write path

At write time,

Write properties

Remove

Deletion marker (tombstone) necessary to suppress data in older SSTables, until compaction Read repair complicates things a little Eventually consistent complicates things more Solution: configurable delay before tombstone GC, after which tombstones are not repaired

Read

Read path

Cassandra read properties

Consistency in a BASE world

Specify W, number of nodes to wait for

Cassandra vs MySQL with 50GB of data

MySQL

Cassandra

~300ms write

~0.12ms write

~350ms read

~15ms read