Storage Engine Write Amplification Tuning via Dynamic Compaction

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current storage engines are inadequate for handling mixed workloads of read and write operations due to high write amplification, space amplification, and poor recovery times, limiting their widespread use in applications like advertisement servers that require fast data access and processing.

Innovation Solution

A storage engine system that includes a compaction unit to determine whether records should be written to another data file based on a compaction value and counter criteria, optimizing the write amplification factor, and utilizing an in-memory table and append-only log files for efficient data management and recovery.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If log-structured merge trees are used to handle heavy write workload, then write throughput is improved, but write amplification factor becomes high

Engineering Contradiction:
Improvewrite throughputVSAvoidwrite amplification factor
Core Design Contradiction:
ProductivityVSLoss of energy

Solution Approach 1:

The patent implements dynamic compaction thresholds that adjust based on workload characteristics and system state. The compaction unit dynamically determines when to trigger compaction operations and adjusts the compaction factor, allowing the system to optimize between write throughput and write amplification based on current conditions rather than using fixed parameters.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system changes key parameters including compaction thresholds, compaction factors, and data file organization strategies. By adjusting these parameters dynamically based on workload type (read-heavy vs. write-heavy), the system can reduce write amplification during mixed workloads while maintaining high throughput during write-intensive operations.

Inventive Principle:
Principle #35Parameter changes

2Speed

If B-tree based storage engines are used for fast reads, then read speed is improved, but read amplification factor becomes high

Engineering Contradiction:
Improveread speedVSAvoidread amplification factor
Core Design Contradiction:
SpeedVSLoss of energy

Solution Approach 1:

The patent performs preliminary compaction actions to consolidate data before read operations occur. By proactively compacting data files and removing duplicates in advance, the system reduces the number of disk accesses required during subsequent read operations, thereby lowering read amplification while maintaining fast read performance.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system implements continuous background compaction processes that run alongside normal read/write operations. This continuous action keeps data files optimized without interrupting service, maintaining low read amplification factors during mixed workloads while preserving the speed benefits of organized data structures.

Inventive Principle:
Principle #20Continuity of useful action

3Ease of operation

If hash table or B-tree structures are used for data organization, then data access is simplified, but random write operations increase

Engineering Contradiction:
Improvedata access simplicityVSAvoidsequential write throughput
Core Design Contradiction:
Ease of operationVSProductivity

Solution Approach 1:

The patent segments the storage system into multiple data files with different organization strategies. Some files use hash table structures for fast key-based access, while others use sequential append-only structures for efficient writes. The compaction unit manages these segments and determines when to migrate data between them, allowing the system to optimize for either simplicity or throughput based on the operation type.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The compaction unit acts as an intermediary layer between the application and the underlying data structures. It receives write operations, determines the appropriate target data file and structure type, and buffers writes to enable sequential output even when applications perform random writes. This intermediary function decouples application access patterns from physical write patterns.

Inventive Principle:
Principle #24Intermediary (Mediator)

4Loss of energy

If compaction operations are performed frequently to reduce write amplification, then write amplification factor is reduced, but system performance degrades

Engineering Contradiction:
Improvewrite amplification factorVSAvoidoverall system throughput
Core Design Contradiction:
Loss of energyVSProductivity

Solution Approach 1:

The patent implements periodic compaction triggered by thresholds rather than continuous compaction. The compaction unit monitors data file characteristics and triggers compaction operations only when specific conditions are met (e.g., when a data file reaches a certain size or contains a certain percentage of duplicate records). This periodic action reduces write amplification while minimizing performance impact by avoiding unnecessary compaction operations.

Inventive Principle:
Principle #19Periodic action

Solution Approach 2:

The system performs partial compaction on only the most problematic data files rather than compacting all files equally. The compaction unit identifies data files with the highest write amplification factors and focuses compaction resources on those specific files, achieving overall system improvement without the performance penalty of full-system compaction.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS11237744B2Method and system for configuring a write amplification factor of a storage engine based on a compaction value associated with a data file
Publication Date: 2022.02.01 YAHOO ASSETS LLC
  • US11237744B2 patent drawing
  • US11237744B2 patent drawing
  • US11237744B2 patent drawing

AI summary

A method, system and non-transitory computer-readable medium for operating a storage engine are disclosed. With respect to a data file, a compaction value is obtained and a counter is retrieved. The compaction value indicates the minimum number of valid records in the data file for a clean-up process to be initiated. In response to the counter satisfying a first criterion, a determination is made, for each record in the data file, as to whether the record is written to another data file based on the record satisfying a second criterion. A write amplification factor of the storage engine is determined based on the compaction value. The counter indicates the number of records in the data file that are invalid. The write amplification factor and a space amplification factor are configurable; the storage engine may be tuned based on workloads, desired write throughput, desired storage utilization, and bandwidth of a storage device.