2024-01-19 12:00:36 +08:00
# Simple Compaction Strategy

2024-01-20 11:55:10 +08:00
In this chapter, you will:
* Implement a simple leveled compaction strategy and simulate it on the compaction simulator.
* Start compaction as a background task and implement a compaction trigger in the system.
2024-01-20 12:05:57 +08:00
2024-01-22 01:10:50 +08:00
## Task 1: Simple Level Compaction
## Task 2: Compaction Simulation
## Task 3: Integrate with the Read Path
2024-01-20 23:38:09 +08:00
## Test Your Understanding
2024-01-21 00:45:10 +08:00
* Is it correct that a key will only be purged from the LSM tree if the user requests to delete it and it has been compacted in the bottom-most level?
* Is it a good strategy to periodically do a full compaction on the LSM tree? Why or why not?
2024-01-23 13:44:48 +08:00
* Actively choosing some old files/levels to compact even if they do not violate the level amplifier would be a good choice, is it true? (Look at the [Lethe ](https://disc-projects.bu.edu/lethe/ ) paper!)
2024-01-21 00:45:10 +08:00
* If the storage device can achieve a sustainable 1GB/s write throughput and the write amplification of the LSM tree is 10x, how much throughput can the user get from the LSM key-value interfaces?
2024-01-23 13:44:48 +08:00
* Can you merge L1 and L3 directly if there are SST files in L2? Does it still produce correct result?
2024-01-20 23:38:09 +08:00
* What is your favorite boba shop in your city? (If you answered yes in week 1 day 3...)
2024-01-21 00:45:10 +08:00
We do not provide reference answers to the questions, and feel free to discuss about them in the Discord community.
2024-01-20 12:05:57 +08:00
{{#include copyright.md}}