1/71
Week
What is a column family DB?
A NoSQL DB that organizes data into column families instead of relational rows
What’s another name for it?
No. The terms are similar but the construction is very different
What is the smallest unit of storage?
A column, similar to an RDBMS cell
What are a column’s 3 elements?
1. Name (e.g. LastName),
2. Value/datum (e.g. Able),
3. Timestamp recording when the value was stored
What is a super column?
A set of grouped columns
What is a column family?
A group of columns arranged in rows.
Similar to a relational table
What identifies each row?
A Row, Key, similar to a primary key
Must every row have the same number of columns?
No. Rows can have different columns
What is a keyspace?
Contains all column families and provides the set of valid row key values
What is a super column family?
Like a column family, but built from super columns instead of columns
How many hierarchy levels can a super column family have?
Only one extra level of grouping, no deeper
How many hierarchy levels can a super column family have?
Only one extra level of grouping, no deeper
Can rows skip supercolumns?
Yes. Rows can include or omit any supercolumn
What is a keyspace?
The top-level data structure. One per application. Contains column families and row keys. Analogous to the database/schema
What does a row key do?
Uniquely identifies a row. Also partitions and orders the data
Why does the row key matter for distribution?
The DB is distributed, so the row key decides which storage server holds the data
What does a column store?
A single data value: name, value, timestamp
What is a column family, component-wise?
A collection of related columns, analogous to a table
How do column families differ from tables?
Columns vary by row, are kept in a predefined order, and are versioned by timestamp
Why are timestamps needed?
Column family DBs are BASE, not ACID, so timestamps help achieve eventual consistency
Column family ≈ what in key-value DBs?
The namespace
Column family ≈ what in an RDBMS?
A table
What’s similar to document DBs?
Queries can select subsets of row’s data, and columns (fields) can be added as needed
What similar to relational DBs?
Unique row identifiers, tabular data, and keyspace ≈ database
What do column family DBs NOT support?
Typed columns, transactions, joins, subqueries
What do they use instead of joins?
Denormalization
No JOINs or subqueries: what’s the solution?
Denormalize and use query-driven modeling
What is query-driven modeling?
One table per type of query. Duplicate data so each query is answered from one table
What’s the read/write tradeoff?
Writes are expensive. Reads are very fast
What’s the core philosophy?
Trade storage space and write-time work for blazing fast reads
No transactions: what’s the solution?
Lightweight transactions, batches, idempotency
What is idempotency?
Running the same operation multiple times doesn’t corrupt the DB. Lets you retry safely after a network failure
What level of atomicity is supported?
Changes to a single row in a single table are atomic. No multi-table transactions (e.g. bank transfers across tables)
What is a lightweight transaction?
Check before writing, like Cassandra’s CompareAndSwap
What is a logged batch?
An entire batch that’s atomic: all or nothing
What’s the transaction philosophy?
Prioritize high availability and speed over instant global consistency, per CAP
No typed columns: what’s the solution?
Flexible metadata and modern CQL
How are new columns added?
Just add them. No type checking, so it’s fast
Do unused columns take up space?
No
What are the 2 architecture types?
Multiple node types (HBase) and peer-to-peer (Cassandra)
What node types does HBase use?
Name nodes, data nodes, region servers, master, and Zookeeper (coordination)
What’s the weakness of HBase’s architecture?
Zookeeper can be a single point of failure, and it needs more administration
What’s the upside of multiple node types?
Servers can be specialized for tasks. Built on the Hadoop framework
How does Cassandra’s peer-to-peer work?
All nodes run the same software. No master node
Benefits of peer-to-peer?
Simplicity, no single point of failure (SPF), scalability
What is gossiping?
A node sends messages containing info about other nodes
What is anti-entropy?
Keeps replicas up to date using hashes of the data, for data integrity
What is a hinted handoff?
The proxy node holds a write while the target node is unavailable, then delivers it later
What is HBase?
An open-sourced, distributed, scalable, versioned, non-relational big data store
What is HBase modeled after?
Google’s Bigtable
What does HBase run on?
Hadoop and HDFS
HBase consistency?
Strictly consistent read and writes
HBase sharding?
Automatic and configurable
Failover?
Automatic failover between RegionServers
What speeds up real-time queries?
Block cache and Bloom filters
What other HBase features should I know?
Supports MapReduce jobs, Java API, server-side filters (predicate push-down), Thrift and REST gateways, JRuby shell, metrics export
What is Cassandra?
A free, open-source, distributed wide-column store for large data across many commodity servers
Can it span datacenters?
Yes, clusters can span multiple datacenters
What query language does it use?
CQL (Cassandra Query Language)
What are Cassandra’s key features?
High availability, eventual consistency, asynchronous masterless replication, fault tolerance, scalability
What’s Cassandra’s main claim?
No single point of failure
What are hosted versions?
AstraDB, Amazon Keyspaces
Keyspace ≈ ?
Database/schema. Also defines the replication strategy and factor across datacenters
Column family ≈ ?
Table, but columns are dynamic and rows can vary
What’s in a Cassandra column?
A typed key-value pair: name, value, internal timestamp
How is data placed on nodes?
Each node gets a token, Data is hashed to the matching node
What is the replication factor (RF)?
The number of distinct nodes each piece of data is stored on
Why is placement topology-aware?
For fault tolerance
How are nodes connected within a datacenter?
A Clos network, specifically a 2-tier Fat Tree (Spine-Leaf)
What is a CQL?
A simple interface for accessing Cassandra
Which language drivers exist?
Java (JDBC), Python (DBAPI2), Node.js (DataStax), Go (gocql), C++
Where is replication defined?
At the keyspace level