Cassandra 00:00:01 Find a temperature reading A greenhouse records a new temperature under sensor seven. Any node can receive the request, but the partition key determines which replicas should hold that sensor's data. Six ranges, with small numbers so that we can follow. Each node owns one here. sensor-7 hashes to token 41. That is in the range of node 3. In this small ring the next two eligible nodes also keep copies. A production topology-aware strategy accounts for data centers and racks when choosing replicas. Node 7 takes half of one range here. With virtual nodes it takes a little from many. An actual cluster uses its configured partitioner, token ownership and replication strategy. A routing map distributes keys; it cannot split one unusually large logical partition for free. 00:00:52 Two replicas can answer Keep three replicas for the example and request a quorum write. One replica is temporarily unavailable. Does the thermometer have to wait for that machine to return? The app sends the reading to node 1, which becomes the coordinator. Nodes 3, 4 and 5 keep this key. Node 4 is down. The coordinator can retain a hint for the missed replica when hinted handoff is enabled. Two actual replicas acknowledge. That meets the illustrated write-consistency level while the third replica is still behind. The example requires two replica acknowledgements. A local hint can help a recovering replica catch up, but a stored hint does not count as a quorum acknowledgement. 00:01:37 Build immutable files Follow one replica underneath the quorum response. An append-oriented recovery log and an in-memory table meet two different needs: recovering recent writes and organizing data for reads. The row goes to the commit log and the memtable. Rows 2, 5 and 9 came in another order but stand sorted. Flushing a memtable creates an immutable sorted table. Commit-log space becomes reclaimable once the data that still needs that segment has been flushed. A newer row 5 ends in a second file. The first file still has the old one. A later version can coexist with an older immutable file. Background compaction eventually reconciles overlapping files, spending disk bandwidth to reduce later read work. 00:02:24 Minimize the files worth opening A sensor's newest value might be in memory or in multiple on-disk tables. File summaries and Bloom filters reduce the amount a replica must inspect. Row 5 is not in the memtable. Files 1 and 3 are certainly without it. Files 2 and 4 may have it. File 2 has row 5 of 9:00 and file 4 has row 5 of 10:00. For the simple updates shown here, compare timestamps and return the newer value. Deletions and expired cells must also participate in a real reconciliation. A negative membership test saves a lookup. A possible match still needs verification. Returning the requested row can require reconciling cells and deletion markers across the remaining candidates. 00:03:13 Put a date on the partition One reading per second seems small. Leave the same sensor key open all year and the size accumulates on the same replica set day after day. At one hundred bytes of payload per reading, a day contributes about eight point six four decimal megabytes before overhead, and a year about three point two gigabytes. Include the day in the partition key. Late readings may still reach an older day, but new days no longer extend one unbounded partition. A seven-day chart reads seven day buckets. Limit parallelism so a wide query does not flood the cluster. A time bucket bounds the work inside a partition while increasing the number of partitions a long-range query must visit. Choose a bucket using expected rate, retention, and the range people actually read.