Database Reference
In-Depth Information
Leveled compaction strategy
Size-Tiered Compaction Strategy (STCS)
Size-tiered compaction strategy (STCS) is the default compaction strategy. Based on
configuring min_compaction_threshold (by default 4), sstables of similar size
would be merged and compacted in a single table. Clearly for heavy writes with not
many reads/updates, this is the preferred strategy. Although all the data for one particu-
lar row key will reside on the same data node, it still may be scattered across multiple
sstables. With such a compaction strategy it is highly possible that redundant compac-
tion for the same columns may happen until the process is complete. With frequent up-
dates for the same row key, STCS could be problematic as a compaction strategy.
Leveled Compaction Strategy (LCS)
Leveled compaction strategy's (LCS) implementation is heavily inspired by Google's
LevelDB ( http://code.google.com/p/leveldb ). The purpose of LCS is to
avoid redundant compaction for columns of a row key. With LCS, each level of
sstables would never overlap and guarantees data loss on read. With every level up, the
compaction process will take place and keep adding the sstables from previous ones.
Here it would require enough space to keep the largest level within memory. LCS per-
forms more I/Os than STCS.
You can define a leveled compaction strategy while creating a table like this:
create table tweets(tweet_id text primary key,body text)
with caching='rows_only' and compaction
='LeveledCompactionStrategy' and
populate_io_cache_on_flush='true'; // create table
LCS is recommended if the read proportion is somewhat similar to higher write
proportions or frequent updates are expected.
Yahoo Cloud Serving Benchmarking
Search WWH ::




Custom Search