CSE Roadmap

Specialist tier · about 2 hours · 5 parts

Part 5 of 5 · 4 min read

Exercises

Easy

Easy 1: Name the layout (15 minutes)

Name the column layout where each row can hold a different, sparse set of columns.

Done when: the wide-column layout is correctly named.

Hint

The wide-column layout.

Easy 2: Name the storage structure underneath (15 minutes)

Name the write-optimized storage structure from Level 5 that column-family stores are typically built on.

Done when: the LSM-tree is correctly named.

Hint

The LSM-tree.

Easy 3: Name the two parts of a compound key (15 minutes)

Name the two parts of a compound key, and what each one decides.

Done when: the partition key (deciding which node stores a row) and the clustering column (deciding sort order within a partition) are both correctly named.

Hint

The partition key (decides which node stores a row) and the clustering column (decides sort order within that partition).

Medium

Medium 1: Design a wide-column row for a scenario (25 minutes)

The bookstore wants to log page views per book, with a new column added every time a book's page is viewed, named by the timestamp of the view. Describe the row and family layout.

Done when: a reasonable layout is described, such as one row per book, with a "views" column family holding one column per view, named by its timestamp.

Hint

One row per book, with a "views" column family holding one column per view, named by the view's timestamp.

Medium 2: Explain why this suits write-heavy ingestion (25 minutes)

Explain why a column-family store is a better fit than a traditional relational table for ingesting a continuous, high-volume stream of page-view events.

Done when: the explanation correctly connects the column-family store's LSM-tree write path, appending quickly through sequential writes, to sustaining a high write rate, in contrast with a workload that would require frequent random-position writes on a traditional index.

Hint

The LSM-tree write path appends writes quickly and sequentially, sustaining a high write rate, unlike an approach requiring frequent random-position writes.

Medium 3: Choose a compound key for a scenario (30 minutes)

The bookstore wants to efficiently fetch all page views for one specific book within a given time range. Propose a compound key that supports this.

Done when: a compound key of (book_id, view_timestamp) is proposed, with book_id as the partition key and view_timestamp as the clustering column, correctly supporting an efficient range scan within one book's partition.

Hint

A compound key of (book_id, view_timestamp), with book_id as the partition key and view_timestamp as the clustering column.

Hard

Hard 1: Diagnose a poor compound-key choice (30 minutes)

A column-family store keys its order-events rows by (event_timestamp, order_id), with event_timestamp as the partition key. Explain what problem this causes for writes arriving continuously in real time.

Done when: the explanation correctly notes that partitioning by a continuously increasing timestamp directs all current writes to whichever partition covers the current time, creating a write hot spot, the same problem covered for key-range partitioning in the previous module.

Hint

Partitioning by a continuously increasing timestamp sends all current writes to the partition covering the current time, creating a write hot spot, the same problem covered for key-range partitioning in the previous module.

Hard 2: Decide column-family versus relational for a scenario (35 minutes)

The bookstore needs a system to log every API request it receives, at a sustained rate of tens of thousands of writes per second, with reads being rare and always scoped to one specific API key's recent history. Decide which model fits better, and justify it.

Done when: a column-family store is chosen, justified by the write-heavy, append-mostly nature of the workload matching the LSM-tree write path, and the always-scoped-by-API-key read pattern matching a compound key with API key as the partition key and timestamp as the clustering column.

Hint

A column-family store, since the write-heavy, append-mostly pattern matches the LSM-tree write path, and the always-by-API-key read pattern matches a compound key with API key as partition key and timestamp as clustering column.

Hard 3: Explain the trade-off against joins (40 minutes)

The bookstore wants to log order events, then later join that event log against the orders table to find the customer for each event. Explain what this requires in a column-family store, compared to a relational schema.

Done when: the explanation correctly notes that a column-family store has no native join, so finding each event's customer would require a separate lookup against the orders data in application code, whereas a relational schema could express this directly as a single JOIN.

Hint

A column-family store has no native join, so finding each event's customer needs a separate application-level lookup, while a relational schema could express the same thing as one JOIN.