SQL DB's implement ACID
SQL gets too expensive
usually Hardware costs
Internet changed the scale of applications & introduced the need, previous corporate apps didn't have such scale
high RW
frequent schema changes
growth is usually non-linear
no need for same level ACID, e.g., Twitter feed not always consistent
Facebook still has sharded MySQL for main storage, but also Cassandra
Twitter too, but also Cassandra
Google's main storage is BigTable, but also some sharded MySQL
Master & slaeves, scales Reads
problem in consistency, due to replica's synchronization, similar problem in caching
scales also Writes
makes you "sharding slaves", all the time resharding, causes pain - lot's of maintenance
you loose some of SQL's features, joins, sorting, grouping &c
consistency
availability
partition tolerance, toelrating disconnection between nodes
you can only choose 2
mid-time between failures is large
Master server, MySQL
not available, unavailable some time
tolerate inconsistencies
e.g., BigTable, Dynamo, Cassandra
levels, Casual, Read your writes, Monotonic
eventually the data will be in all replica's properly
to some extent not A
scaling is awfull, but nice features
similar to Cassandra
much more difficult to manage
Eventual Consistency
moved to FaceBook
beautiful implementation
tens to thousands of nodes
useful for lots of nodes, not few
N, number of replicas, for any data item
W, nomber of nodes a write operation blocks on
R, nomber of nodes a read operation blocks on
Untitled, W=1, block until 1st node written successfully, W=N, blocks until all nodes written succesfully, W=0, async writes
Untitled, R=1, blocks until the 1st node returns an answer, R=N, block until all nodes return an answer, R=0, doesn't make sense
Quorum, R=N/2+1, W=N/2+1, you write to all but await just for W acks, Fully consistent
or any query language, you can integrate with text search, Lucandra, you search by text, get an id & then continue, in BigTable, they added indices, as secondary key, will be supported in Cassandra soon
or any grouping/aggregation
modelled after BigTable
difference from Key-Value, you can get/set just some columns
client responsibility to write all, not transactional
works well with their disk usage
Keyspace, like namespaces for unique keys, schema
Column Family, very much like a Table.., rows & columns, but not quite, sparse array
Key, a key that represents a row (of columns), search is always by key, you must model your data according to predicted usage, if use-cases change, you're stuck, but there are some solutions
Column, represents a value with, Column name, Value, Timestamp
Super Column, column that holds list of columns inside
get
get_slice, some columns
multi_get, saves round-trip
multi_get_slice
get_count
get_range_slice, slice over rows & columns
get_range_slices
insert
remove
batch_insert
batch_mutate
e.g., describe ring peers
to say the least
language/compiler developed in Facebook
takes .idl & generates implementation in different languages, even Erlang
using Hadoop
which takes the data from Cassandra
Hive
e.g.,, Sybase IQ, more
to enable scale-out
to enable better features