Dynamic Key Allocation in B+ Tree Nodes
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional B+ tree implementations allocate a fixed amount of memory space for each key based on the maximum possible key space, leading to wasted memory space when the actual key space is smaller, especially in scenarios like virtual disk snapshots where the maximum size is not consistently utilized.
Innovation Solution
The system dynamically allocates memory for keys based on the expected key space during tree instantiation and leverages the hierarchical organization of B+ trees to allocate different sized keys on a per-node basis, reducing memory consumption by adapting to the actual key space needs.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If a fixed amount of memory space is allocated for each key based on the maximum possible key space, then the tree can support the full key space range, but memory space is wasted when the actual key space is smaller
Solution Approach 1:
The patent applies dynamics by transitioning from static fixed-size key allocation to dynamic variable-size key allocation. Each node dynamically determines the appropriate key size based on the actual key space it needs to cover, allowing the tree structure to adapt its memory usage to the actual data requirements rather than being constrained by maximum theoretical limits
Solution Approach 2:
The patent implements local quality by allowing different nodes in the tree to have different key sizes based on their local requirements. Each node calculates its own key size based on the minimum and maximum key values it needs to represent, so that nodes dealing with smaller key ranges use fewer bits while nodes handling larger ranges use more bits, optimizing memory usage locally across the entire tree structure
2Adaptability or versatility
If larger key space is allocated to support maximum virtual disk size, then future expansion is possible, but current memory usage is inefficient
Solution Approach 1:
The dynamic key size allocation allows the tree to start with efficient small key sizes and expand to larger key sizes as needed. When the virtual disk size grows and requires more address space, the tree can dynamically increase key sizes in affected nodes without having been forced to use large key sizes from the beginning, thus supporting future expansion while minimizing current memory consumption
3Measurement precision
If fixed 64-bit keys are used to address 256 TB key space, then full addressing capability is available, but memory overhead becomes significant when actual size is much smaller
Solution Approach 1:
The patent changes the parameter of key size from a fixed 64 bits to a variable number of bits (e.g., 8 bits, 16 bits, 32 bits, or 64 bits) depending on the actual key space requirements. This parameter change allows the system to use only the necessary number of bits for addressing, reducing memory overhead significantly when the virtual disk size is much smaller than the maximum 256 TB capacity while maintaining full addressing capability when needed
Data Source
AI summary
Techniques for dynamically allocating keys in an instance of a tree data structure are provided. In one embodiment, a computer system can, at a time of instantiating each non-root node in the instance, determine a key space to be addressed by the non-root node, where the key space is based on a key subinterval in a parent node of the non-root node that is associated with a pointer to the non-root node. The computer system can further calculate a number of bits to allocate to each key of the non-root node in view of the determined key space. The computer system can then allocate the keys of the non-root node in accordance with the calculated number of bits.


