Data reading and writing method, terminal and computer readable storage medium

文档序号:1543601 发布日期:2020-01-17 浏览:4次 中文

阅读说明:本技术 一种数据读写方法、终端及计算机可读存储介质 (Data reading and writing method, terminal and computer readable storage medium ) 是由 李丙洋 杨洪章 郭斌 韩银俊 丁毅 陈正华 于 2018-07-10 设计创作,主要内容包括:本发明实施例提供一种数据读写方法、终端及计算机可读存储介质,其中,所述方法包括:接收数据读取指令,所述数据读取指令包括待读取数据的特征信息;根据所述特征信息在内存中确定命中的数据索引;根据所述命中的数据索引在缓存中读取数据,其中,所述缓存为固态硬盘SSD。(The embodiment of the invention provides a data reading and writing method, a terminal and a computer readable storage medium, wherein the method comprises the following steps: receiving a data reading instruction, wherein the data reading instruction comprises characteristic information of data to be read; determining a hit data index in a memory according to the characteristic information; and reading data in a cache according to the hit data index, wherein the cache is a Solid State Disk (SSD).)

1. A method for reading and writing data, the method comprising:

receiving a data reading instruction, wherein the data reading instruction comprises characteristic information of data to be read;

determining a hit data index in a memory according to the characteristic information;

and reading data in a cache according to the hit data index, wherein the cache is a Solid State Disk (SSD).

2. The method of claim 1, wherein determining the hit data index in the memory based on the characterization information comprises:

searching a data index in the memory according to the characteristic information;

and when the data index is found in the memory, determining the found data index as the hit data index.

3. The method according to claim 2, wherein the characteristic information of the data to be read includes a location of the data to be read, and the searching the data index in the memory according to the characteristic information includes:

acquiring a data index table from the memory;

and searching a data index in the data index table according to the position of the data to be read.

4. The method of claim 3, wherein reading data in a cache according to the hit data index comprises:

and when the hit data index is determined in the memory, reading the data corresponding to the position of the data to be read.

5. The method according to any one of claims 1 to 4, wherein the data to be read is stored in the SSD in the form of a Log Log, wherein the Log comprises metadata and actual data, and the metadata comprises the characteristic information; the method further comprises the following steps:

when the data to be read is hot data, or the data to be read is not the hot data and the actual data in the data to be read is not changed, not updating the metadata in the Log;

and when the data to be read is not hotspot data and the actual data in the data to be read changes, updating the metadata in the Log.

6. A method for reading and writing data, the method comprising:

receiving a data writing instruction, wherein the data writing instruction comprises characteristic information of data to be written;

determining a hit data index in a memory according to the characteristic information;

and updating the pointed position of the hit data index in a cache according to the characteristic information, wherein the cache is a Solid State Disk (SSD).

7. The method of claim 6, wherein determining the hit data index in the memory based on the characterization information comprises:

searching a data index in the memory according to the characteristic information;

and when the data index is found in the memory, determining the found data index as the hit data index.

8. The method according to claim 7, wherein the characteristic information of the data to be written includes a location of the data to be written, and the searching the data index in the memory according to the characteristic information includes:

acquiring a data index table from the memory;

and searching a data index in the data index table according to the position of the data to be written.

9. The method of claim 8, wherein updating the hit data index according to the characterization information comprises: when the hit data index is determined in the memory, updating the pointed position of the hit data index in the SSD according to the position of the data to be written;

alternatively, the method further comprises: when the hit data index is not determined in the cache according to the characteristic information, the data index is regenerated according to the characteristic information;

or before the determining, according to the feature information, a hit data index in the cache, the method further includes: and when the data to be written is the hot data, persistently writing the data to be written into the SSD.

10. The method according to claims 6 to 9, wherein the data to be written is written in the SSD in the form of Log, wherein the Log comprises metadata and actual data, and the metadata comprises the characteristic information.

11. A terminal, characterized in that the terminal comprises at least: a processor and a storage medium configured to store executable instructions, wherein: the processor is configured to execute stored executable instructions;

the executable instructions are configured to perform the data reading and writing method provided by any one of the above claims 1 to 5 or claims 6 to 10.

12. A computer-readable storage medium having computer-executable instructions stored therein, the computer-executable instructions being configured to perform the method for reading and writing data as provided in any one of claims 1 to 5 or claims 6 to 10.

Technical Field

The present invention relates to the field of data storage technologies, and in particular, to a data reading and writing method, a terminal, and a computer-readable storage medium.

Background

In the fields of distributed storage systems, virtualization, and the like, Input/Output (I/O) speeds of mechanical hard disks often become a bottleneck of the system because of the need to simultaneously handle pressures from different services. The general method for solving the problem is to use a high-performance memory with a high read-write speed between a service system and a disk as an I/O cache, and exchange hot data which is frequently read and written into the cache as much as possible so as to improve the response speed of the system.

However, in a large-scale system, the total amount of hot data easily exceeds the memory capacity, so that the memory cache data needs to be frequently eliminated and reloaded to meet the business requirement, which greatly affects the caching effect. Meanwhile, when the node is restarted or powered off, the memory cache needs to be reloaded, and the possibility of hot spot data loss can be met.

Disclosure of Invention

Embodiments of the present invention provide a data reading and writing method, a terminal, and a computer-readable storage medium, which can solve the problem of memory limitation, increase cache capacity, and ensure that hot-point data is not lost after power failure.

The technical scheme of the embodiment of the invention is realized as follows:

in a first aspect, an embodiment of the present invention provides a data reading and writing method, where the method includes:

receiving a data reading instruction, wherein the data reading instruction comprises characteristic information of data to be read;

determining a hit data index in a memory according to the characteristic information;

and reading data in a cache according to the hit data index, wherein the cache is a Solid State Disk (SSD).

In a second aspect, an embodiment of the present invention provides a data reading and writing method, where the method includes:

receiving a data writing instruction, wherein the data writing instruction comprises characteristic information of data to be written;

determining a hit data index in a memory according to the characteristic information;

and updating the pointed position of the hit data index in a cache according to the characteristic information, wherein the cache is a Solid State Disk (SSD).

In a third aspect, an embodiment of the present invention provides a terminal, where the terminal at least includes: a processor and a storage medium configured to store executable instructions, wherein: the processor is configured to execute stored executable instructions;

the executable instructions are configured to perform the above-described data read-write method.

In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are configured to perform the above data reading and writing method.

The embodiment of the invention provides a data reading and writing method, a terminal and a computer readable storage medium, wherein a data reading instruction is received, and the data reading instruction comprises characteristic information of data to be read; determining a hit data index in a memory according to the characteristic information; reading data in a cache according to the hit data index, wherein the cache is a Solid State Disk (SSD); therefore, the cache is the SSD, so that the problem of memory limitation can be solved, the cache capacity is increased, and the hot point data can be ensured not to be lost after power failure because the data is read according to the hit data index.

Drawings

In the drawings, which are not necessarily drawn to scale, like reference numerals may describe similar components in different views. Like reference numerals having different letter suffixes may represent different examples of similar components. The drawings illustrate generally, by way of example, but not by way of limitation, various embodiments discussed herein.

FIG. 1 is a schematic diagram of a flow chart of a data reading and writing method according to an embodiment of the present invention;

FIG. 2 is a schematic diagram of a flow chart of implementing a second data read-write method according to an embodiment of the present invention;

FIG. 3 is a schematic diagram of an implementation flow of a data read/write method according to an embodiment of the present invention;

FIG. 4 is a schematic diagram of a flow chart of a method for reading and writing data according to an embodiment of the present invention;

FIG. 5 is a diagram illustrating a structure of a log according to an embodiment of the present invention;

fig. 6 is a schematic diagram of a cache structure according to an embodiment of the present invention;

FIG. 7 is a flowchart illustrating a method for recovering a cache by replaying a log according to an embodiment of the present invention;

fig. 8 is a schematic structural diagram of a terminal according to an embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the following describes specific technical solutions of the present invention in further detail with reference to the accompanying drawings in the embodiments of the present invention. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种结构体排序方法、排序装置及排序器

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类