Database Memory Allocation for LSM Tree Instances

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing memory allocation methods for database instances based on LSM trees face inefficiencies, leading to reduced memory utilization, data loss, and increased write amplification due to either excessive or insufficient memory allocation.

Innovation Solution

A predictive memory allocation method that determines the memory needs of each database instance based on historical data usage, adjusting memory allocation dynamically to match changing data scales, thereby optimizing memory utilization and reducing write amplification.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Duration of action of moving object

If an excessively large memory is allocated to the database instance, then the data in the MemTable can be stored longer, but memory utilization is reduced

Engineering Contradiction:
Improvedata retention time in MemTableVSAvoidmemory utilization
Core Design Contradiction:
Duration of action of moving objectVSQuantity of substance

Solution Approach 1:

The patent implements dynamic memory allocation by periodically adjusting the memory size of each database instance based on its actual data volume. The memory size is not fixed but changes over time according to the instance's needs, resolving the contradiction between retaining data longer and maintaining high memory utilization.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent changes the memory size parameter of database instances based on their data volume. By adjusting this key parameter dynamically, the system optimizes both data retention time and memory utilization, avoiding the trade-off between these two factors.

Inventive Principle:
Principle #35Parameter changes

2Quantity of substance

If an excessively small memory is allocated to the database instance, then memory utilization is enhanced, but data write amplification increases and write efficiency reduces

Engineering Contradiction:
Improvememory utilizationVSAvoiddata write efficiency
Core Design Contradiction:
Quantity of substanceVSProductivity

Solution Approach 1:

The system dynamically adjusts memory allocation based on actual data volume, ensuring each database instance has sufficient memory to avoid frequent writes to persistent storage. This dynamic approach maintains high write efficiency while preventing excessive memory waste, resolving the contradiction between memory utilization and write efficiency.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

By changing the memory size parameter according to data volume, the system ensures optimal write performance for each database instance. Instances with larger data volumes receive more memory, reducing write amplification, while instances with smaller data volumes use less memory, maintaining overall high utilization.

Inventive Principle:
Principle #35Parameter changes

3Ease of operation

If memory is not adjusted according to data scale, then allocation simplicity is maintained, but memory utilization and write throughput are reduced

Engineering Contradiction:
Improvememory allocation simplicityVSAvoidwrite throughput
Core Design Contradiction:
Ease of operationVSProductivity

Solution Approach 1:

The system automatically adjusts memory allocation based on each database instance's data volume without requiring manual intervention. The memory management subsystem monitors data scales and autonomously optimizes memory distribution, maintaining simplicity for users while achieving high write throughput through automated optimization.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system implements a feedback mechanism where memory allocation is continuously adjusted based on data volume metrics. This closed-loop control ensures memory is allocated according to actual needs, maintaining both operational simplicity and high write throughput through automatic optimization.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS20250208991A1Methods for allocating memory of database, computer-readable media, and storage engines
Publication Date: 2025.06.26 ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
  • US20250208991A1 patent drawing
  • US20250208991A1 patent drawing
  • US20250208991A1 patent drawing

AI summary

Computer-implemented methods, devices and storage media are described for allocating a memory of a database. The database includes a storage engine for data storage based on a log-structured merge (LSM) tree, and at least one database instance. The memory is configured to store data in a MemTable and an immutable MemTable respectively corresponding to the at least one database instance. An example method includes: determining a quantity of data stored in each database instance in the database in a historical period; predicting a memory needed by each database instance in a next period, where the memory needed by the database instance in the next period is positively correlated with the quantity of data stored in the database instance in the historical period; and allocating the memory for each database instance in the next period based on the predicted memory needed by the database instance in the next period.