You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: mini-lsm-book/src/week2-03-tiered.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -48,15 +48,15 @@ The first trigger of universal compaction is by space amplification ratio. As we
48
48
49
49
The reason why we compute the space amplification ratio like this is because we model the engine in a way that it stores a fixed amount of user data (i.e., assume it's 100GB), and the user keeps updating the values by writing to the engine. Therefore, eventually, all keys get pushed down to the bottom-most tier, the bottom-most tier size should be equivalent to the amount of data (100GB), the upper tiers contain updates to the data that are not yet compacted to the bottom-most tier.
50
50
51
-
When `all levels except last level size / last level size` >= `max_size_amplification_percent * 100%`, we will need to trigger a full compaction. For example, if we have a LSM state like:
51
+
When `all levels except last level size / last level size` >= `max_size_amplification_percent * 1%`, we will need to trigger a full compaction. For example, if we have a LSM state like:
52
52
53
53
```
54
54
Tier 3: 1
55
55
Tier 2: 1 ; all levels except last level size = 2
56
56
Tier 1: 1 ; last level size = 1, 2/1=2
57
57
```
58
58
59
-
Assume `max_size_amplification_percent` = 200%, we should trigger a full compaction now.
59
+
Assume `max_size_amplification_percent` = 200, we should trigger a full compaction now.
60
60
61
61
After you implement this trigger, you can run the compaction simulator. You will see:
62
62
@@ -151,7 +151,7 @@ The current trigger only reduces space amplification. We will need to add new tr
151
151
152
152
### Task 1.2: Triggered by Size Ratio
153
153
154
-
The next trigger is the size ratio trigger. The trigger maintains the size ratio between the tiers. From the first tier, we compute the size of `this tier / sum of all previous tiers`. For the first encountered tier where this value `> (100 + size_ratio) * 100%`, we will compact all previous tiers excluding the current tier. We only do this compaction with there are more than `min_merge_width` tiers to be merged.
154
+
The next trigger is the size ratio trigger. The trigger maintains the size ratio between the tiers. From the first tier, we compute the size of `this tier / sum of all previous tiers`. For the first encountered tier where this value `> (100 + size_ratio) * 1%`, we will compact all previous tiers excluding the current tier. We only do this compaction with there are more than `min_merge_width` tiers to be merged.
155
155
156
156
For example, given the following LSM state, and assume size_ratio = 1, we should compact when the ratio value > 101%:
0 commit comments