KV Cache Hot-Cold Data Placement Using LFU and LRU

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The existing key-value (KV) cache system faces instability due to inaccurate determination of hot and cold data states, leading to increased disk read probability and poor system stability, as it relies on superficial criteria like LFU, which results in inefficient data storage and retrieval.

Innovation Solution

A data storage method that determines the state of data using both LFU and LRU metrics, along with length information, to accurately classify data as hot or cold, and stores it in corresponding mediums like memory or disk, optimizing storage ratios and reducing disk read probability.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If only LFU (least frequently used) algorithm is used to determine data state, then the storage cost is reduced, but the accuracy of hot/cold data state determination deteriorates

Engineering Contradiction:
Improvestorage costVSAvoidaccuracy of data state determination
Core Design Contradiction:
Quantity of substanceVSMeasurement precision

Solution Approach 1:

The patent combines LFU (least frequently used) and LRU (least recently used) algorithms to determine data state. Instead of relying on a single algorithm, the system integrates both frequency-based and recency-based metrics to comprehensively assess whether data is hot or cold, thereby improving determination accuracy while maintaining storage cost efficiency.

Inventive Principle:
Principle #5Merging (Combining)

2Quantity of substance

If only LFU algorithm is used to determine data state, then the storage cost is reduced, but the system stability deteriorates

Engineering Contradiction:
Improvestorage costVSAvoidsystem stability
Core Design Contradiction:
Quantity of substanceVSReliability

Solution Approach 1:

The patent merges LFU and LRU algorithms to create a more robust data state determination mechanism. This combination reduces the probability of incorrect disk reads by considering both access frequency and recency, thereby improving system stability while maintaining storage cost efficiency.

Inventive Principle:
Principle #5Merging (Combining)

3Speed

If data is stored in memory to improve access speed, then the access speed is improved, but the storage cost increases

Engineering Contradiction:
Improvedata access speedVSAvoidstorage cost
Core Design Contradiction:
SpeedVSQuantity of substance

Solution Approach 1:

The patent applies local quality by differentiating storage locations based on data characteristics. Hot data (frequently accessed) is stored in memory for fast access, while cold data (infrequently accessed) is stored in disk to reduce cost. The system dynamically determines which data qualifies as hot or cold using combined LFU and LRU metrics, optimizing the local storage quality for each data item.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS11307769B2Data storage method, apparatus and storage medium
Publication Date: 2022.04.19 BEIJING BAIDU NETCOM SCI & TECH CO LTD
  • US11307769B2 patent drawing
  • US11307769B2 patent drawing
  • US11307769B2 patent drawing

AI summary

The present disclosure provides a data storage method, an apparatus, and a storage medium, the method comprising: receiving a data storage request from a client, wherein the data storage request comprises data to be stored; determining a state of the data to be stored according to a least frequently used (LFU) and a least recently used (LRU) of the data to be stored, wherein the state is a cold data state or a hot data state; and determining a corresponding storage medium for the data to be stored according to the state of the data to be stored, and storing the data to be stored in the storage medium. The data storage method, the apparatus, and the storage medium provided in the present disclosure allow for reducing the probability of reading a disk and improving the stability of a system.