# US 11,307,769 B2 · Data storage method, apparatus and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 11,307,769 B2
- Document ID: US11307769B2
- Status: Granted
- Kind: B2
- Application number: 16/354,067
- Filed: 2019-03-14
- Published: 2019-11-28
- Granted: 2022-04-19
- Earliest claimed: 2018-05-24
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science Technology Co., Ltd.
- Inventors: Jian Zhang
- Web page: https://patentgrep.com/patent/US11307769B2

## CPC

- G06F 3/0608: {Saving storage space on storage systems}
- G06F 3/061: {Improving I/O performance}
- G06F 3/0638: {Organizing or formatting or addressing of data}
- G06F 3/0647: {Migration mechanisms}
- G06F 3/0656: {Data buffering arrangements}
- G06F 3/0683: {Plurality of storage devices}
- G06F 12/0868: Data transfer between cache memory and other subsystems, e.g. storage devices or host systems
- G06F 12/0871: Allocation or management of cache space
- G06F 12/122: of the least frequently used [LFU] type, e.g. with individual count value
- G06F 12/123: with age lists, e.g. queue, most recently used [MRU] list or least recently used [LRU] list
- H03M 7/30: Compression (speech analysis-synthesis for redundancy reduction G10L19/00; for image communication H04N); Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- G06F 2212/154: Networked environment
- G06F 2212/261: Storage comprising a plurality of storage devices
- G06F 2212/312: In storage controller
- G06F 2212/401: Compressed data
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H03M: CODING; DECODING; CODE CONVERSION IN GENERAL (using fluidic means F15C4/00; optical analogue/digital converters G02F7/00; coding, decoding or code conversion, specially adapted for particular applications, see the relevant subclasses, e.g. G01D, G01R, G06F, G06T, G09G, G10L, G11B, G11C, H04B, H04L, H04M, H04N; ciphering or deciphering for cryptography or other purposes involving the need for secrecy G09C)

## Abstract

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.

## Claims

### Claim 1

A data storage 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 to be a hot data state when a least frequently used (LFU) of the data to be stored is greater than a first preset threshold, a least recently used (LRU) of the data to be stored is greater than a second preset threshold, and length information of the data to be stored is smaller than a third preset threshold; otherwise, determining the state of the data to be stored to be a cold data state;
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 corresponding storage medium determined for the data to be stored;
wherein the data to be stored comprises a key and a value, and the storing the data to be stored in the storage medium comprises:
sorting the data to be stored according to the value of the data to be stored, and storing the sorted data to be stored in the storage medium.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising:
determining a state of a key's value of the data to be stored, wherein the state of the key's value of the data to be stored is a cold data state or a hot data state; and
determining a storage medium for the key's value of the data to be stored according to the state of the key's value of the data to be stored, and storing the key's value of the data to be stored in the storage medium determined for the key's value of the data to be stored.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the storing the data to be stored in the storage medium comprises:
compressing the data to be stored, and storing the compressed data to be stored in the storage medium.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the determining the corresponding storage medium for the data to be stored according to the state of the data to be stored comprises:
when the state of the data to be stored is the hot data state, determining a memory as the corresponding storage medium for the data to be stored; and
when the state of the data to be stored is the cold data state, determining a disk as the corresponding storage medium for the data to be stored.

### Claim 5 (depends on 1)

The method according to claim 1, further comprising:
determining a data storage ratio between a memory and a disk according to at least one of: a memory occupation, a ratio between data stored in the memory and data stored in the disk; and
determining the first preset threshold and the second preset threshold according to the data storage ratio.

### Claim 6

A data storage apparatus, comprising a processor, a storage device, and a computer program, wherein the computer program is stored in the storage device and is configured to be executed by the processor, the computer program comprising instructions for executing 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 to be a hot data state when a least frequently used (LFU) of the data to be stored is greater than a first preset threshold, a least recently used (LRU) of the data to be stored is greater than a second preset threshold, and length information of the data to be stored is smaller than a third preset threshold; otherwise, determining the state of the data to be stored to be a cold data state;
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 corresponding storage medium determined for the data to be stored;
wherein the data to be stored comprises a key and a value, and the computer program comprises instructions for executing the method comprising:
sorting the data to be stored according to the value of the data to be stored, and storing the sorted data to be stored in the storage medium.

### Claim 7 (depends on 6)

The apparatus according to claim 6, wherein the computer program comprises instructions for executing the method further comprising:
determining a state of a key's value of the data to be stored, wherein the state of the key's value of the data to be stored is a cold data state or a hot data state; and
determining a storage medium for the key's value of the data to be stored according to the state of the key's value of the data to be stored; and
storing the key's value of the data to be stored in the storage medium determined for the key's value of the data to be stored.

### Claim 8 (depends on 6)

The apparatus according to claim 6, wherein the computer program comprises instructions for executing the method comprising:
compressing the data to be stored, and storing the compressed data to be stored in the storage medium.

### Claim 9 (depends on 6)

The apparatus according to claim 6, wherein the computer program comprises instructions for executing the method comprising:
when the state of the data to be stored is the hot data state, determining a memory as the corresponding storage medium for the data to be stored; and
when the state of the data to be stored is the cold data state, determining a disk as the corresponding storage medium for the data to be stored.

### Claim 10 (depends on 6)

The apparatus according to claim 6, wherein the computer program comprises instructions for executing the method comprising:
determining a data storage ratio between a memory and a disk according to at least one of: a memory occupation, a ratio between data stored in the memory and data stored in the disk; and
determining the first preset threshold and the second preset threshold according to the data storage ratio.

### Claim 11 (depends on 1)

A non-transitory computer readable storage medium storing a computer program which causes a server to execute the method according to claim 1.
