Todo
todo
Memtables are in-memory structures where Cassandra buffers writes. In general, there is one active memtable per table. Eventually, memtables are flushed onto disk and become immutable SSTables. This can be triggered in several ways:
memtable_cleanup_threshold
)Memtables may be stored entirely on-heap or partially off-heap, depending on memtable_allocation_type
.
SSTables are the immutable data files that Cassandra uses for persisting data on disk.
As SSTables are flushed to disk from Memtables or are streamed from other nodes, Cassandra triggers compactions which combine multiple SSTables into one. Once the new SSTable has been written, the old SSTables can be removed.
Each SSTable is comprised of multiple components stored in separate files:
Data.db
Index.db
Data.db
file. For wide partitions, this may also include an
index to rows within a partition.Summary.db
Index.db
file.Filter.db
CompressionInfo.db
Data.db
file.Statistics.db
Digest.crc32
Data.db
file.TOC.txt
Within the Data.db
file, rows are organized by partition. These partitions are sorted in token order (i.e. by a
hash of the partition key when the default partitioner, Murmur3Partition
, is used). Within a partition, rows are
stored in the order of their clustering keys.
SSTables can be optionally compressed using block-based compression.