IP Library › Granted Patent US 12,536,141
Granted Patent B2
US 12,536,141 · App. 18/648,989 · Granted Jan 27, 2026

Defragmentation for log structured merge tree to improve read and write amplification

Inventors: Anil Paul Thoppil (Pleasanton, CA); Wei Sun (Boulder, CO); Meera Odugoudar (Milpitas, CA); Szu-Wen Kuo (Taipei, TW); Santhosh Selvaraj (San Jose, CA)
Assignee: NetApp, Inc.
G06F16/1748G06F16/182
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,536,141
App. No.
18/648,989
Granted
Jan 27, 2026
Kind
B2
Abstract

Techniques are provided for implementing a defragmentation process during a merge operation performed by a re-compaction process upon a log structured merge tree. The log structured merge tree is used to store keys of key-value pairs within a key-value store. As the log structured merge tree fills with keys over time, the re-compaction process is performed to merge keys down to lower levels of the log structured merge tree to re-compact the keys. Re-compaction can result in fragmentation because there is a lack of spatial locality of where the re-compaction operations re-writes the keys within storage. Fragmentation increases read and write amplification when accessing the keys stored in different locations within the storage. Accordingly, the defragmentation process is performed during a last merge operation of the re-compaction process in order to store keys together within the storage, thus reducing read and write amplification when accessing the keys.

Claims (56)

1 . A method, comprising:

storing keys of key-value pairs within a log structured merge tree associated with a key-value store, wherein the keys of the key-value pairs are assigned to bins within distributed storage based upon prefixes of the keys;

merging keys down to lower levels of the log structured merge tree to re-compact the keys; and

during a rebalancing process that rebalances the keys across the bins based upon the prefixes, defragmenting a set of keys within a level of the log structured merge tree to store the set of keys together within a region of the distributed storage.

2 . The method of claim 1 , comprising:

creating a key-value pair comprising a value and a key used to reference the value, wherein the key corresponds to a content hash of the value;

storing the value within the distributed storage and the key into the log structured merge tree separate from the value; and

defragmenting the key during a last merge operation of a re-compaction process that merges the keys to re-compact the keys.

3 . The method of claim 1 , comprising:

modifying, during a defragmentation process that defragments the set of keys, physical volume block numbers pointing to blocks within the distributed storage storing the set of keys and refraining from modifying virtual volume block numbers representing locations of the blocks within the distribute storage.

4 . The method of claim 1 , comprising:

utilizing multiple bytes of prefixes of the keys to rebalance the keys across the bins by the rebalancing process.

5 . The method of claim 1 , comprising:

determining that an amount of fragmentation of the keys within the log structured merge tree exceeds a threshold; and

triggering a defragmentation process to defragment the level of the log structured merge tree based upon the threshold being exceeded.

6 . The method of claim 1 , comprising:

triggering the defragmentation of the set of keys based upon execution of a first prefixed based movement operation by the rebalancing process to rebalance keys across bins of nodes to store the set of keys together within a region of the distributed storage; and

implementing a second prefixed based movement operation of the rebalancing process to read the set of keys from the region.

7 . The method of claim 1 , comprising:

during the defragmentation of the set of keys, executing I/O operations against user blocks within the distributed storage, wherein a defragmentation process modifies physical volume block numbers within a redirection layer to point to defragmented locations of the set of keys in the distributed storage.

8 . The method of claim 1 , comprising:

implement a defragmentation process upon a container file implemented as a redirection layer for accessing the keys within the distributed storage, wherein the defragmentation process modifies physical volume block numbers within the redirection layer to point to defragmented locations of the set of keys in the distributed storage.

9 . A non-transitory machine readable medium comprising instructions, which when executed by a machine, causes the machine to:

store keys of key-value pairs within a log structured merge tree associated with a key-value store, wherein the keys of the key-value pairs are assigned to bins within distributed storage based upon prefixes of the keys;

merge keys down to lower levels of the log structured merge tree to re-compact the keys; and

during a rebalancing process that rebalances the keys across the bins based upon the prefixes, defragment a set of keys within a level of the log structured merge tree to store the set of keys together within a region of the distributed storage.

10 . The non-transitory machine readable medium of claim 9 , wherein the instructions cause the machine to:

trigger the defragmentation of the set of keys based upon an amount of fragmentation of keys within the log structured merge tree exceeding a threshold, otherwise, the defragmentation of the set of keys is skipped during a last merge operation of a re-compaction process.

11 . The non-transitory machine readable medium of claim 9 , wherein the instructions cause the machine to:

evaluate levels of logs within the log structured merge tree to identify a level as storing the set of keys having longer lifespans than keys within other levels of the log structured merge tree; and

defragment the set of keys within the level, but not upon the keys within the other levels, based upon the level being identified as storing the set of keys having longer lifespans than the keys within other the levels of the log structured merge tree.

12 . The non-transitory machine readable medium of claim 9 , wherein the instructions cause the machine to:

store keys within a sorted log of the log structured merge tree; and

implement a defragmentation process to defragment the set of keys within the level of the log structured merge tree without modifying the sorted log.

13 . The non-transitory machine readable medium of claim 9 , wherein the instructions cause the machine to:

skip defragmenting one or more levels of the log structured merge tree based upon a determination that keys within the one or more levels of the log structured merge tree have shorter lifespans than the set of keys within the level of the log structured merge tree.

14 . The non-transitory machine readable medium of claim 9 , wherein the instructions cause the machine to:

selectively defragment keys within a lowest level of the log structured merge tree based upon a determination that the set of keys within the lowest level of the log structured merge tree have longer lifespans within the distributed storage than keys within other levels of the log structured merge tree.

15 . A system, comprising:

a memory comprising machine executable code; and

a processor coupled to the memory, the processor configured to execute the machine executable code to cause the machine to:

store keys of key-value pairs within a log structured merge tree associated with a key-value store, wherein the keys of the key-value pairs are assigned to bins within distributed storage based upon prefixes of the keys;

merge keys down to lower levels of the log structured merge tree to re-compact the keys; and

during a rebalancing process that rebalances the keys across the bins based upon the prefixes, defragment a set of keys within a level of the log structured merge tree to store the set of keys together within a region of the distributed storage.

16 . The system of claim 15 , wherein the machine executable code causes the machine to:

modify, during a defragmentation process that defragments the set of keys, physical volume block numbers pointing to blocks within the distributed storage storing the set of keys and refraining from modifying virtual volume block numbers representing locations of the blocks within the distribute storage.

17 . The system of claim 15 , wherein the machine executable code causes the machine to:

utilize multiple bytes of prefixes of the keys to rebalance the keys across the bins by the rebalancing process.

18 . The system of claim 15 , wherein the machine executable code causes the machine to:

determine that an amount of fragmentation of the keys within the log structured merge tree exceeds a threshold; and

trigger a defragmentation process to defragment the level of the log structured merge tree based upon the threshold being exceeded.

19 . The system of claim 15 , wherein the machine executable code causes the machine to:

trigger the defragmentation of the set of keys based upon execution of a first prefixed based movement operation by the rebalancing process to rebalance keys across bins of nodes to store the set of keys together within a region of the distributed storage; and

implement a second prefixed based movement operation of the rebalancing process to read the set of keys from the region.

20 . The system of claim 15 , wherein the machine executable code causes the machine to:

during the defragmentation of the set of keys, execute I/O operations against user blocks within the distributed storage, wherein a defragmentation process modifies physical volume block numbers within a redirection layer to point to defragmented locations of the set of keys in the distributed storage.

Continuity (2)
Continuation 17732046 · Apr 28, 2022
Related Publication 20240281411A1 · Aug 22, 2024
References Cited (34)
US 10706106B2 · Boles · 2020 [cited by examiner]
US 11023318B1 · Volkov · 2021 [cited by examiner]
US 11048423B2 · Bortnikov · 2021 [cited by examiner]
US 11971859B2 · Thoppil et al. · 2024 [cited by applicant]
US 12204800B2 · Thoppil et al. · 2025 [cited by applicant]
US 12265473B2 · Thoppil et al. · 2025 [cited by applicant]
US 20200192940A1 · Tomlinson · 2020 [cited by applicant]
US 20200201821A1 · Wang · 2020 [cited by examiner]
US 20200320081A1 · Fanghaenel · 2020 [cited by examiner]
US 20210067332A1 · Roy · 2021 [cited by examiner]
US 20210182202A1 · Jin · 2021 [cited by examiner]
US 20210342259A1 · Idreos · 2021 [cited by examiner]
US 20210397345A1 · Jawahar et al. · 2021 [cited by applicant]
US 20220156087A1 · Karr et al. · 2022 [cited by applicant]
US 20220156231A1 · Wang · 2022 [cited by examiner]
US 20220382760A1 · Pang · 2022 [cited by examiner]
US 20230350610A1 · Thoppil et al. · 2023 [cited by applicant]
US 20230350810A1 · Thoppil et al. · 2023 [cited by applicant]
US 20230350850A1 · Thoppil et al. · 2023 [cited by applicant]
US 20250165195A1 · Thoppil et al. · 2025 [cited by applicant]
US 20250225080A1 · Thoppil et al. · 2025 [cited by applicant]
Non Final Office Action mailed Jun. 11, 2024 for U.S. Appl. No. 17/732,098, filed Apr. 28, 2022, 39 pages. [cited by applicant]
Notice of Allowance mailed on Sep. 23, 2024 for U.S. Appl. No. 17/732,065, filed Apr. 28, 2022, 08 pages. [cited by applicant]
Notice of Allowance mailed on Dec. 4, 2024 for U.S. Appl. No. 17/732,098, filed Apr. 28, 2022, 11 pages. [cited by applicant]
Notice of Allowance mailed on Dec. 18, 2024 for U.S. Appl. No. 17/732,065, filed Apr. 28, 2022, 02 pages. [cited by applicant]
Final Office Action mailed on Sep. 17, 2024 for U.S. Appl. No. 17/732,098, filed Apr. 28, 2022, 37 pages. [cited by applicant]
Conway A., “Understanding Dictionaries at the Intersection of Theory and Practice,” Oct. 2020, 145 pages. [cited by applicant]
Final Office Action mailed on Feb. 16, 2024 for U.S. Appl. No. 17/732,098, filed Apr. 28, 2022, 32 pages. [cited by applicant]
Mei F., et al., “LSM-Tree Managed Storage for Large-Scale Key-Value Store,” 15 pages. [cited by applicant]
Non-Final Office Action mailed on Aug. 3, 2023 for U.S. Appl. No. 17/732,046, filed Apr. 28, 2022, 13 pages. [cited by applicant]
Non-Final Office Action mailed on Sep. 28, 2023 for U.S. Appl. No. 17/732,098, filed Apr. 28, 2022, 28 pages. [cited by applicant]
Notice of Allowance mailed on Mar. 28, 2024 for U.S. Appl. No. 17/732,046, filed Apr. 28, 2022, 04 pages. [cited by applicant]
Notice of Allowance mailed on Nov. 28, 2023 for U.S. Appl. No. 17/732,046, filed Apr. 28, 2022, 7 pages. [cited by applicant]
Notice of Allowance mailed on Oct. 9, 2024 for U.S. Appl. No. 17/732,065, filed Apr. 28, 2022, 02 pages. [cited by applicant]