MemStore-Local Allocation Buffers for Heap Fragmentation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

As heap sizes in databases like HBase increase, the existing garbage collection methods in production-quality Java Development Kits (JDKs) lead to lengthy stop-the-world pauses, causing user-visible latency and timeouts due to heap fragmentation and inefficient memory allocation.

Innovation Solution

Implementing MemStore-Local Allocation Buffers (MSLABs) to allocate data from memory arenas dedicated to specific regions, reducing fragmentation by ensuring data for different MemStores are not intermingled and allowing for contiguous chunk allocation, thereby minimizing garbage collection pauses.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If heap sizes for databases are increased to improve cache capacity and reduce disk seeks, then more data can fit in memory and performance improves, but garbage collection pauses become longer and latency increases

Engineering Contradiction:
Improveheap sizeVSAvoidgarbage collection pause duration
Core Design Contradiction:
Quantity of substanceVSLoss of time

Solution Approach 1:

The patent divides the heap into multiple memory arenas, each dedicated to specific regions or MemStores. This segmentation prevents fragmentation across the entire heap by confining allocations to smaller, isolated arenas, thereby reducing garbage collection pause durations while supporting larger effective heap sizes.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Each memory arena is designed with specific local characteristics - dedicated to particular regions or MemStores with controlled allocation policies. This local quality approach optimizes garbage collection within each arena independently, reducing overall GC pause impact while enabling larger total heap capacity.

Inventive Principle:
Principle #3Local quality

2Reliability

If traditional garbage collection methods are used in production-quality JDKs, then system stability is maintained, but garbage collection pauses become lengthy causing user-visible latency and timeouts

Engineering Contradiction:
Improvesystem stabilityVSAvoidgarbage collection pause duration
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

By segmenting the heap into multiple isolated memory arenas, the patent enables more frequent and less intrusive garbage collection cycles within each arena. This maintains system stability through controlled GC operations while significantly reducing pause durations compared to monolithic GC approaches.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent implements preliminary memory arena setup and allocation buffer management before peak load periods. Memory arenas are pre-configured with appropriate sizes and allocation strategies, allowing garbage collection to operate more efficiently during operation without causing lengthy pauses.

Inventive Principle:
Principle #10Preliminary action

3Device complexity

If memory allocation is done without dedicated buffers per region, then device complexity is reduced, but heap fragmentation increases leading to worse garbage collection performance

Engineering Contradiction:
Improvememory allocation structureVSAvoidgarbage collection pause duration
Core Design Contradiction:
Device complexityVSLoss of time

Solution Approach 1:

The patent introduces memory arenas as segmented allocation buffers, each dedicated to specific regions. This segmentation reduces heap fragmentation by isolating allocations to smaller units, thereby reducing garbage collection pause durations. The added structural complexity is justified by the significant performance improvement in GC efficiency.

Inventive Principle:
Principle #1Segmentation

4Ease of operation

If data for different MemStores are allocated from the same heap space, then allocation simplicity is maintained, but fragmentation occurs causing contiguous chunk allocation to become difficult

Engineering Contradiction:
Improveallocation simplicityVSAvoidmemory contiguity
Core Design Contradiction:
Ease of operationVSStability of the object's composition

Solution Approach 1:

The patent segments the heap into separate memory arenas, each dedicated to specific regions or MemStores. This ensures that data for different MemStores are allocated from separate contiguous spaces, maintaining allocation simplicity within each arena while ensuring overall memory contiguity and reducing fragmentation.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Each memory arena has local quality characteristics - dedicated to specific regions with controlled allocation policies. This local dedication ensures that allocations within each arena remain contiguous and organized, preventing the fragmentation that would occur with unified heap allocation.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS11899937B2Memory allocation buffer for reduction of heap fragmentation
Publication Date: 2024.02.13 CLOUDERA INC
  • US11899937B2 patent drawing
  • US11899937B2 patent drawing
  • US11899937B2 patent drawing

AI summary

Systems and methods of a memory allocation buffer to reduce heap fragmentation. In one embodiment, the memory allocation buffer structures a memory arena dedicated to a target region that is one of a plurality of regions in a server in a database cluster such as an HBase cluster. The memory area has a chunk size (e.g., 2 MB) and an offset pointer. Data objects in write requests targeted to the region are received and inserted to the memory arena at a location specified by the offset pointer. When the memory arena is filled, a new one is allocated. When a MemStore of the target region is flushed, the entire memory arenas for the target region are freed up. This reduces heap fragmentation that is responsible for long and/or frequent garbage collection pauses.