CN110716896A - Data writing method, data reading method, data writing system, data reading device, electronic equipment and storage medium - Google Patents

Data writing method, data reading method, data writing system, data reading device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110716896A
CN110716896A CN201910894457.4A CN201910894457A CN110716896A CN 110716896 A CN110716896 A CN 110716896A CN 201910894457 A CN201910894457 A CN 201910894457A CN 110716896 A CN110716896 A CN 110716896A
Authority
CN
China
Prior art keywords
data
written
read
file management
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910894457.4A
Other languages
Chinese (zh)
Inventor
王大瑶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910894457.4A priority Critical patent/CN110716896A/en
Publication of CN110716896A publication Critical patent/CN110716896A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1847File system types specifically adapted to static storage, e.g. adapted to flash memory or SSD

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The present disclosure provides a data writing method, a data reading method, a data writing system, a data reading system, an electronic device, and a storage medium, and relates to a storage technology. The specific implementation scheme comprises the steps that data with high heat degree are written into a file management module, so that cache data are maintained by the file management module, and the problem that the cache data are easy to lose after a process is restarted due to the fact that the cache data are stored by a memory in the prior art can be solved.

Description

Data writing method, data reading method, data writing system, data reading device, electronic equipment and storage medium
Technical Field
The present disclosure relates to computer technology, and more particularly, to storage technology.
Background
The storage system is a system in which a computer is composed of various storage devices for storing programs and data, a control unit, a device (hardware) for managing information scheduling, and an algorithm (software). The storage system of a computer is generally composed of cache, memory, and external memory.
Among them, caching is an important content in a storage system. Conventional cache systems often utilize memory to store cache data.
However, this method may cause that after the process is restarted, the previously accumulated cache data will all be invalid, thereby causing a large amount of cache miss and causing a problem of system performance degradation.
Disclosure of Invention
The present disclosure provides a data writing method, a data reading method, a data writing device, a data reading device, an electronic device, and a storage medium, so as to solve the technical problem in the prior art that cache data is easy to lose.
A first aspect of the present disclosure is to provide a data writing method, including:
acquiring data to be written, if the data to be written is high-heat data, applying management index information to a file management module, and applying storage space to the file management module;
and writing the data to be written into the storage space, and recording the corresponding relation between the information of the data to be written and the management index information.
Optionally, the information of the data to be written includes a storage location of the data to be written in the file management module.
In this optional implementation, by recording the relationship between the address of the data in the file management module and the management information, the data can be more quickly located to the data storage location when the data is read, thereby improving the data reading speed.
Optionally, if the information about the management application fails and/or the storage space application fails, determining memory index information corresponding to the data to be written in the memory;
and recording the corresponding relation between the information of the data to be written and the memory index information.
In this optional implementation, if the management index information or the storage space cannot be applied, the data to be written cannot be written into the file management module, and at this time, the data may be written into the memory as cache data, so as to avoid that the index information of the data cannot be recorded.
Optionally, the method further includes:
and if the data to be written is not the high-heat data, writing the data to be written into a disk module.
Optionally, the method further includes:
recording the management index information of the data to be written into an LRU list.
Optionally, the memory index information of the data to be written is recorded into the LRU list.
In this embodiment, elimination management of the cache data may be performed through the LRU list, so as to release the storage space occupied by the cache data in time.
A second aspect of the present disclosure is to provide a data reading method, including:
determining whether the data to be read is cache data or not according to the corresponding relation between the information of the data to be read and the index information;
if so, determining whether the cache data is first cache data stored in a file management module or second cache data stored in a memory according to the corresponding relation;
and reading the data to be read according to the determination result.
A third aspect of the present disclosure is to provide a data management system, including:
the file management module is used for recording the relation between the information of the cache data and the corresponding index information; the cache data comprises first cache data stored in the file management module and second cache data stored in a memory;
the magnetic disk module is used for recording original data;
and the memory module is used for recording the second cache data and the memory data.
A fourth aspect of the present disclosure is to provide a data writing apparatus, including:
the acquisition module is used for acquiring data to be written;
the application module is used for applying management index information to the file management module and applying storage space to the file management module if the data to be written is high-heat data;
and the writing module is used for writing the data to be written into the storage space and recording the corresponding relation between the information of the data to be written and the management index information.
A fifth aspect of the present disclosure is to provide a data reading apparatus, comprising:
the first determining module is used for determining whether the data to be read is cache data or not according to the corresponding relation between the information of the data to be read and the index information;
a second determining module, configured to determine, if the first cache data is the first cache data stored in the file management module, or determine, according to the corresponding relationship, whether the cache data is the second cache data stored in the memory;
and the reading module is used for reading the data to be read according to the determination result.
A sixth aspect of the present disclosure provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a data writing method according to the first aspect or a data reading method according to the second aspect.
A seventh aspect of the present disclosure is to provide a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the data writing method according to the first aspect or the data reading method according to the second aspect.
According to the data writing and reading method, system, device, electronic equipment and storage medium, data with high heat are written into the file management module, so that the file management module is used for maintaining cache data, and the problem that the cache data are easy to lose after the process is restarted due to the fact that the cache data are stored in the memory in the prior art can be solved.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a diagram of an exemplary application scenario in accordance with the present application;
FIG. 2 is a flow chart illustrating a data writing method according to an exemplary embodiment of the present application;
FIG. 3 is a flow chart illustrating a data writing method according to another exemplary embodiment of the present application;
FIG. 4 is a flow chart illustrating a data reading method according to an exemplary embodiment of the present application;
FIG. 5 is a flow chart illustrating a data reading method according to another exemplary embodiment of the present application;
FIG. 6 is a block diagram of a data management system shown in an exemplary embodiment of the present application;
FIG. 7 is a block diagram of a data writing apparatus according to an exemplary embodiment of the present application;
fig. 8 is a block diagram illustrating a data writing apparatus according to another exemplary embodiment of the present application;
FIG. 9 is a block diagram of a data reading device according to an exemplary embodiment of the present application;
FIG. 10 is a block diagram of a data reading device according to another exemplary embodiment of the present application;
fig. 11 is a block diagram of an electronic device shown in an exemplary embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The storage system in the computer system comprises a plurality of parts, specifically comprising a hard disk, a memory and a cache. The storage capacity of a hard disk is large, but the speed of reading data from the hard disk is slow. The memory has a smaller storage capacity than the hard disk, but the data reading speed is faster than that of the hard disk. The cache has a smaller storage capacity but the data is read faster than the memory.
Caching is primarily a matter of using a small amount of high performance storage media, and thus less expensive in exchange for high performance access. When the processor reads data, the processor firstly queries the cache, and if the processor hits (hit), the processor can directly acquire the data from the cache. If not, the data may be read again from the memory. If the memory is not hit (miss), the data can be read from the hard disk.
The traditional storage system usually uses a memory to store cache data, but after the process is restarted, the previously accumulated cache data will be invalid, so that a large amount of cache miss is caused, and the performance of the system is greatly reduced.
In the scheme provided by this embodiment, the cache data is managed based on the file management module, so as to solve the problem that the cache data is easy to lose.
The method provided by the embodiment can be applied to a computer system, for example, in an application scenario as shown in fig. 1, when the computer system 11 interacts with the external device 12, the computer system may be triggered to read or write data. External device 12 may also be a computer system. As another example, a user operating a computer system may also trigger it to read or write data, and as another example, internal logic of the computer system may trigger it to read or write data.
Fig. 2 is a flowchart illustrating a data writing method according to an exemplary embodiment of the present application.
As shown in fig. 2, the data writing method provided in this embodiment includes:
step 101, acquiring data to be written, if the data to be written is high-heat data, applying for management index information to a file management module, and applying for storage space to the file management module.
The method provided by the embodiment can be applied to a computer system, and when the computer system needs to write data, the method provided by the embodiment can be executed.
Specifically, a file management module may be disposed in the computer system, and configured to record a corresponding relationship between the information of the cache data and the index information. For example, a temporary file system (tmpfs) may be installed in the computer system as a file management module.
Furthermore, the file management module can also store cache data, and is particularly used for storing data which is more likely to be read by a processor.
In practical applications, the method provided by this embodiment may store the cache data in both the file management module and the memory, and the difference is that the cache data stored in the file management module is more likely to be read by the processor, and is more hot, and the cache data stored in the memory is second. The cache data stored in the file management module is actually stored in the memory, and is managed only by the file management module, so that the problem that the data are lost after the process is restarted is solved.
When data needs to be written, whether the data is high-heat data or not can be judged, and if yes, the data is stored in the file management module. If the storage space of the file management module is full, the file management module can be written into the memory. In another embodiment, the data with higher heat in the high heat data may be stored in the file management module, and when the storage space of the file management module is insufficient, the remaining high heat data may be stored in the memory.
Specifically, the access frequency of the data may be used as an evaluation index for evaluating the popularity of the data, for example, when the access frequency reaches a threshold, the data is considered to be high-popularity data.
Further, if it is determined that the data to be written is high-heat data, management index information may be applied to the management module.
In actual application, index information is set for the cache data, and the cache data can be better managed. In the method provided by this embodiment, if the data to be written is high-heat data, the data needs to be written into the file management module, and therefore, the index information of the data can be set in the file management module.
And the file management module can be used for storing the data to be written. The file management module can be applied according to the storage space occupied by the data to be written.
Specifically, after the application for managing the referenced information and the storage space is successful, step 102 may be executed.
And 102, writing the data to be written into a storage space, and recording the corresponding relation between the information of the data to be written and the management index information.
Furthermore, after the application is made to the storage space, the data to be written can be written into the storage space, so that the high-heat data can be written into the file management module.
In actual application, the corresponding relationship between the information of the data to be written and the management index information can be recorded.
The information of the cached data and the index information corresponding to the information can be recorded in the file management module. If the cache data is stored in the file management module, the corresponding index information is management index information.
Specifically, the information to be written with data may be, for example, a storage address of the data. For example, the data is stored in the file management module, the information of the data refers to the storage address of the data in the file management module, that is, the storage space allocated for the high-heat data.
Further, the cache data stored in the file management module may be stored only in the file management module, and is not further stored in the memory. For example, a data may be read from the memory, processed, and then stored, and at this time, if the data meets the requirement of writing to the file management module, the data may be written to the file management module, and the corresponding data in the memory may be deleted.
If a data to be written is written into the file management module, when the corresponding relation between the information of the data to be written and the management index information is recorded, the corresponding relation between the data index information and the storage address of the data index information in the file management module can be recorded. Optionally, since the data is actually recorded in the memory, the corresponding relationship between the data index information and the storage address in the memory may also be recorded. The storage address of the data in the memory can be associated with the storage address in the file management module by the index information.
The cache data is written into the file management module, and the corresponding relation between the information of the data to be written and the corresponding index information is recorded, so that the cache data is convenient to manage. And the data are recorded in the file management module, and can not be lost after the process is restarted.
The method provided by the present embodiment is used for writing data, and is performed by a device provided with the method provided by the present embodiment, and the device is generally implemented in a hardware and/or software manner.
The data writing method provided by the embodiment includes: acquiring data to be written, if the data to be written is high-heat data, applying management index information to a file management module, and applying storage space to the file management module; and writing the data to be written into the storage space, and recording the corresponding relation between the information of the data to be written and the management index information. According to the data writing method provided by the embodiment, the data with high heat is written into the file management module, so that the cache data is maintained by using the file management module, and the problem that the cache data is easy to lose after the process is restarted due to the fact that the cache data is stored by using a memory in the prior art can be solved.
Fig. 3 is a flowchart illustrating a data writing method according to another exemplary embodiment of the present application.
As shown in fig. 3, the data writing method provided in this embodiment includes:
step 201, data to be written is obtained.
If the data to be written is high-heat data, step 202 is performed. Otherwise, step 205 is performed.
Step 202, applying for management index information to the file management module, and applying for storage space to the file management module.
Step 201 is similar to the implementation principle and manner of obtaining the data to be written in step 101, and is not described again.
Step 202 is similar to the implementation principle and manner of applying for the index information and the storage space in step 101, and is not described again.
If the application for managing the index information and the storage space is successful, step 203 is executed, otherwise, step 204 is executed.
Step 203, writing the data to be written into the storage space, and recording the corresponding relationship between the information of the data to be written and the management index information.
Step 203 is implemented in a similar manner and principle as step 102.
The information of the data to be written comprises the storage position of the data to be written in the file management module.
Specifically, the index information of the data and the storage position in the file management module are recorded, and when the data is read, the corresponding data can be quickly found according to the corresponding relation, so that the reading speed is improved.
When the processor reads the data, it may send a data acquisition request to the file management module. The file management module can determine whether the data is written into the file management module according to the corresponding relation between the storage address and the index information, and if so, the file management module can directly read corresponding data from the file management module and feed the corresponding data back to the processor so as to achieve the purpose of quick reading. If the data is not hit in the file management module, the corresponding data can be read from the memory.
Step 204, determining memory index information corresponding to the data to be written in the memory, and recording the corresponding relation between the information of the data to be written and the memory index information.
In practical application, if the file management module is unsuccessfully applied for index information or storage space, the data to be written cannot be written into the file management module, and at this time, the data can be written into the memory as cache data.
In this case, the index information of the data to be written may be determined in the memory.
Specifically, the cache data information stored in the memory and the memory index information corresponding to the cache data information may also be recorded.
In this embodiment, since the data is not stored in the file management module, the information of the data may be its storage location in the memory. The storage location of the data to be written in the memory and the corresponding memory index information can be recorded. And may be recorded in the file management module.
When reading data, according to the data information recorded in the file management module and the index information corresponding to the data information, whether the data is stored in the file management module or the memory is determined, and then the data is read at a corresponding position.
After the data is stored in the memory, the data can be written into a disk so as to avoid data loss. For example, a user enters a text segment in a document, the modified content can be stored in a memory, and the modified content can be written to a disk after the user clicks on save or the system automatically saves the document.
Step 205, writing the data to be written into the disk module.
If the data to be written is not the high-heat data, the data is not considered to be the cache data, and therefore the data can be written into the disk module, and the data can be recorded.
Optionally, step 206 may also be performed after step 203. Step 207 may also be performed after step 204.
In step 206, the management index information of the data to be written is recorded into the LRU list.
In step 207, the memory index information is recorded into the LRU list.
An LRU list may also be maintained to record index information of the cached data. LRU (lastregister used) indicates least recently used, and if data has been accessed recently, then the probability of future access is higher, and therefore, it can be added to the LRU list.
Generally, the length of the LRU list is limited, and thus, index information of cache data that can be recorded therein is also limited. If the index information to be recorded exceeds the limited length of the LRU list, index information in which a record to be accessed in the future is low can be discarded. In the method provided by this embodiment, cache data may be evicted based on the LRU list.
Specifically, if the data to be written is written into the file management module, the data to be written has management index information, and at this time, the management index information of the data may be written into the LRU list.
Further, if the data to be written is written into the memory, the data to be written has memory index information, and at this time, the memory index information of the data may be written into the LRU list.
In actual application, the cache data can be adjusted according to the updating condition of the index information in the LRU list. For example, due to the limited length of the LRU list, the index information a therein is deleted, and the corresponding cache data may be deleted in the file management module or the memory. Thereby freeing up the storage space that stores the portion of the cached data.
Fig. 4 is a flowchart illustrating a data reading method according to an exemplary embodiment of the present application.
Step 301, determining whether the data to be read is cache data according to the corresponding relationship between the information of the data to be read and the index information.
The method provided by the embodiment can be applied to a computer system, and when the computer system needs to read data, the method provided by the embodiment can be executed.
Specifically, a file management module may be disposed in the computer system, and configured to record a corresponding relationship between the information of the cache data and the index information. For example, a temporary file system (tmpfs) may be installed in the computer system as a file management module.
Furthermore, the file management module can also store cache data, and is particularly used for storing data which is more likely to be read by a processor.
In practical applications, the method provided by this embodiment may store the cache data in both the file management module and the memory, and the difference is that the cache data stored in the file management module is more likely to be read by the processor, and is more hot, and the cache data stored in the memory is second.
When data needs to be read, whether the data is cache data or not can be determined according to the information of the data and the corresponding relation between the data information and the index information.
Specifically, if the information of the data to be read is stored in the correspondence, the data may be considered as cache data, otherwise, the data is considered as not cache data. For example, the correspondence relationship stores information of the cache data a and its corresponding index 1, information of the cache data B and its corresponding index 2, and information of the cache data C and its corresponding index 3. When the data to be read is a, it may be determined in the correspondence that the information of the data to be read a is recorded, and thus, the data is cache data.
If yes, go to step 302.
Step 302, determining whether the cache data is the first cache data stored in the file management module or the second cache data stored in the memory according to the corresponding relationship.
Further, in the method provided in this embodiment, the cache data may be stored in the file management module, and may also be stored in the memory.
In practical applications, the cache data can be read more quickly. And determining whether the cache data is stored in the file management module or the memory according to the corresponding relation.
If the cached data is stored in the file management module, the corresponding index information may be management index information; if the cached data is stored in the memory, the corresponding index information may be memory index information.
Specifically, the location where the cache data is stored may be determined according to the category of the index information, specifically, whether the cache data is stored in the file management module or the memory, and then the data is read at the corresponding location.
For the sake of convenience of distinction, the cache data stored in the file management module is referred to as first cache data, and the cache data stored in the memory is referred to as second cache data.
In practical application, if the cached data is stored in the file management module, the information of the cached data in the correspondence relationship may include a storage location of the data in the file management module and a storage location of the data in the memory. The two addresses may be associated by index information.
The memory may store cache data and may also store common data. When the hot degree of one data is higher, the data can be rewritten into the file management module. In this case, the corresponding data in the memory may be deleted, thereby writing the high-heat data into the file management module.
Specifically, if the address of the data to be read in the file management module is recorded in the corresponding relationship, the data may be considered to be stored in the file management module. If the memory storage address of the data to be read is recorded in the corresponding relationship, the data can be considered to be stored in the memory. Optionally, since the data is actually recorded in the memory, the corresponding relationship between the data index information and the storage address in the memory may also be recorded. In this case, it is also possible to determine whether the data is recorded in the file management module according to whether two storage addresses of the data to be read are recorded in the correspondence relationship.
Step 303, reading the data to be read according to the determination result.
Further, after the specific storage location of the cache data is determined, the data to be read can be read from the corresponding location according to the determination result.
In practical application, the information of the cache data in the correspondence relationship may be a storage location of the cache data. For example, the starting position of a cache data in the memory, or the starting position of a cache data in the file management module.
When the data to be read is read, the data can be read according to the storage position in the corresponding relationship. Thereby further improving the reading speed.
Specifically, if the cache data is stored in the file management module, the corresponding relationship may record a storage address of the data in the file management module. In this case, the data can be read directly from the file management module.
Further, if the cache data is stored in the memory, the corresponding relationship may record a storage address of the data in the memory, that is, a storage address. In this case, the data can be read directly from the memory.
In practical application, when the processor reads data to be read, the processor can send out the storage address of the data. Specifically, the file management module may determine whether a corresponding address is recorded in the correspondence relationship according to the storage address, and if so, the data is considered as cache data. At this time, it may be further determined whether the data is stored in the file management module according to the corresponding relationship, specifically, it may be determined whether the index information corresponding to the storage address is stored in the file management module, and it may be further determined whether the data is stored in the file management module, and if so, the data to be read may be directly read from the file management module. Otherwise, the data may be read from the memory.
The method provided by the present embodiment is used for reading data, and is performed by a device provided with the method provided by the present embodiment, and the device is generally implemented in a hardware and/or software manner.
The data reading method provided by the embodiment comprises the following steps: determining whether the data to be read is cache data or not according to the corresponding relation between the information of the data to be read and the index information; if so, determining whether the cache data is first cache data stored in the file management module or second cache data stored in the memory according to the corresponding relation; and reading the data to be read according to the determination result. In the method provided by this embodiment, the file management module stores the cache data with high popularity, and the file management module maintains the cache data, so that the problem that the cache data is easily lost after the process is restarted due to the fact that the cache data is stored by using the memory in the prior art can be solved.
Fig. 5 is a flowchart illustrating a data reading method according to another exemplary embodiment of the present application.
As shown in fig. 5, the data reading method provided in this embodiment includes:
step 401, determining whether the data to be read is cache data according to the corresponding relationship between the information of the data to be read and the index information.
Step 401 is similar to step 301 in implementation principle and manner, and is not described again.
If yes, go to step 402. Otherwise, step 404 is performed.
Step 402, determining whether the cache data is the first cache data stored in the file management module or the second cache data stored in the memory according to the corresponding relationship.
Step 402 is similar to step 302 in implementation principle and manner, and is not described in detail.
Step 403, if the data to be read is the first cache data, reading the data to be read from the file management module; and if the data to be read is the second cache data, reading the data to be read from the memory.
If the cache data is determined to be the first cache data, that is, the first cache data is stored in the file management module, the data may be read from the file management module.
Specifically, the first cache data may be read from the file management module according to the information of the data to be read in the corresponding relationship. In the method provided in this embodiment, the information of the data to be read may include a storage address of the data, specifically a storage address in a memory, and may also include a storage address in a file management module.
Further, index information may be further set in the corresponding relationship, and the storage address of the data in the memory and the storage address in the file management module may be associated by the index information. Therefore, the data can be read from the file management module according to the storage address in the file management module in the correspondence relationship of the data to be read.
In practical application, the processor may send the storage address of the data to be read to the file management module, so that the file management module determines whether the corresponding relationship of the data is stored according to the corresponding relationship and the received storage address, and if the corresponding relationship of the data is stored, the processor may determine that the data is cached. The file management module can further judge whether the data is stored in the file management module, if so, the data is first cache data, and the file management module can acquire corresponding data according to a storage address of the file management module and send the corresponding data to the processor.
The first cache data can be read from the file management module according to the information of the data to be read in the corresponding relationship. In the method provided by this embodiment, the information of the data to be read may include a storage address of the data, specifically, a storage address in the file management module.
In practical application, the processor may send the storage address of the data to be read to the file management module, so that the file management module determines whether the corresponding relationship of the data is stored according to the corresponding relationship and the received storage address, and if the corresponding relationship of the data is stored, the processor may determine that the data is cached. The file management module may further determine whether the data is stored in the file management module, and if not, the data is second cache data, and the file management module may send a data acquisition request to the memory, so that the memory sends the data to be read to the processor.
In an alternative embodiment, the processor sends the memory storage address of the data to the file management module. The file management module may determine whether the data is cached data according to the recorded correspondence. It is further determined whether the data is stored in the file management module or the memory.
Step 404, reading the data to be read from the disk.
If the file management module does not store the corresponding relation related to the data to be read, the data can be regarded as not cache data, and the data can be read from the disk.
Specifically, after the processor does not inquire the relevant information of the data to be read in the file management module, the processor can send a request to the disk, and then read the data to be read from the disk.
Optionally, the data read from the disk may be stored in the file management module or the memory as cache data.
Step 405, increasing the access frequency of the data to be read.
Furthermore, after the data to be read is read, the data to be read is accessed once, and at the moment, the access frequency of the data to be read can be improved.
In practical applications, the access frequency of each data may be recorded, for example, the access frequency of each data within a preset time period is recorded. It is also possible to record only the access frequency of the cached data.
Here, an LRU list may be set, in which index information of each cache data is recorded, that is, information of the cache data and index information in the index information correspondence relationship are recorded. The data access frequency corresponding to each index information may also be recorded in the LRU list. The frequency of data access in the LRU list can be updated.
Specifically, if the read data is not the first cache data, that is, is not stored in the file management module, step 406 may also be executed.
And step 406, determining whether to write the data to be read into the file management module according to the access frequency.
Further, whether to write the data to be read into the file management module or not can be determined according to the access frequency after the data is updated.
For example, the current cache data may be sorted according to the updated access frequency, and if the read data is located before the preset rank, the read data may be added to the file management module. For another example, if the access frequency after the data update exceeds a preset threshold, the data may be written into the file management module.
In practical application, if data is written into the file management module, the management index information of the data and the storage position of the management index information in the file management module can be recorded in the file management module.
Optionally, in the method provided in this embodiment, the method may further include:
step 407, update the index information in the LRU list.
In the method provided in this embodiment, an LRU list may be further provided, where index information of each cache data may be stored.
Specifically, after data is read from the disk, the data may be written into a cache, for example, into a memory. At this time, index information for the data may be created and the corresponding index information written to the LRU list.
Further, the ordering of the index information in the LRU list may be updated according to the updated access frequency of the read data. For example, the index information in the LRU list is sorted according to the access frequency of the cached data, and after the access frequency of one of the data is updated, the sorting result may also be updated. That is, in the method provided in this embodiment, the index information included in the LRU list may be updated, and the index information sorting in the LRU list may also be updated.
In practical application, if the index information to be recorded exceeds the limited length of the LRU list, the index information sorted later may be deleted, and the cache data corresponding to the index information may be deleted in the memory or the file management module.
Fig. 6 is a block diagram of a data management system according to an exemplary embodiment of the present application.
As shown in fig. 6, the data management system provided in this embodiment includes a file management module 51, a disk module 52, and a memory module 53.
The disk module 52 stores therein original data. Some of these data may be stored in the memory module 53 as memory data.
Specifically, the memory data or a part of the data stored in the disk module 52 may also be stored as cache data in the file management module 51 and the memory module 53 for storing the part of the cache data.
When the processor reads data, it may first read from the cache data, and if the query result is not hit, that is, the data is not the cache data, it may further read from the memory module 53, and if the data is also not hit in the memory module 53, it may further read from the disk module 52.
Further, the cache data stored in the file management module 51 is the first cache data. The cache data stored in the memory module 53 is the second cache data
The file management module 51 may also store the relationship between the information of the cached data and the index information (Nodes) corresponding thereto. The cache data comprises first cache data and second cache data. This mapping relationship may be stored in Nodes.
In practical application, the information of the cached data may be a storage location of the cached data. For example, the first cache data may have a memory storage location and a storage location in the file management module, and thus, the information of the first cache data may include at least two storage locations. For another example, the second cache data has memory storage locations, and thus, the information may include at least one storage location.
Optionally, an lru list may be further set in the memory, and is used to perform elimination management on the index information node of the cache data. The position of the index information of the cache data in the lru list can be quickly located based on the map in the memory.
Specifically, some data in the disk module 52 may be mapped into the file management module 51, so that the high-heat data is stored in the file management module 51.
The embodiments shown in fig. 2 to 4 can be applied to the data management system provided in this embodiment. The management system may be provided in a computer system, thereby enabling the computer to perform the method of any of figures 2-4.
Fig. 7 is a block diagram of a data writing apparatus according to an exemplary embodiment of the present application.
As shown in fig. 7, the data writing device provided in this embodiment includes:
an obtaining module 61, configured to obtain data to be written;
an application module 62, configured to apply for management index information to a file management module and apply for a storage space to the file management module if the data to be written is high-heat data;
and a writing module 63, configured to write the data to be written into the storage space, and record a corresponding relationship between information of the data to be written and the management index information.
The data writing device provided by the embodiment comprises: the acquisition module is used for acquiring data to be written; the application module is used for applying management index information to the file management module and applying storage space to the file management module if the data to be written is high-heat data; and the writing module is used for writing the data to be written into the storage space and recording the corresponding relation between the information of the data to be written and the management index information. The data writing device provided by this embodiment writes data with high heat into the file management module, so that the file management module is used to maintain the cache data, and the problem that the cache data is easily lost after the process is restarted due to the fact that the cache data is stored by using the memory in the prior art can be solved.
Fig. 8 is a block diagram of a data writing apparatus according to another exemplary embodiment of the present application.
As shown in fig. 8, in the data writing device provided in this embodiment, based on the foregoing embodiment, the information of the data to be written includes a storage location of the data to be written in the file management module.
Optionally, if the application module 62 fails to apply for the information of the management initiator and/or fails to apply for the storage space, the write module 63 is specifically configured to determine, in the memory, memory index information corresponding to the data to be written;
the apparatus further comprises a recording module 64 for:
and recording the corresponding relation between the information of the data to be written and the memory index information.
Optionally, if the data to be written is not the high-heat data, the writing module 63 is further configured to determine, in the memory, memory index information corresponding to the data to be written;
the recording module 64 is further configured to record a corresponding relationship between the information of the data to be written and the memory index information.
Optionally, a first LRU module 65 is further included for:
recording the management index information of the data to be written into an LRU list.
Optionally, a second LRU module 65 is further included for:
and recording the memory index information of the data to be written into the LRU list.
Fig. 9 is a block diagram of a data reading apparatus according to an exemplary embodiment of the present application.
As shown in fig. 9, the data reading apparatus provided in this embodiment includes:
a first determining module 81, configured to determine whether the data to be read is cache data according to a correspondence between information of the data to be read and the index information;
a second determining module 82, configured to determine, if the first cache data is stored in the file management module, or determine, according to the corresponding relationship, whether the cache data is the first cache data stored in the memory;
and the reading module 83 is configured to read the data to be read according to the determination result.
The data reading device provided by the embodiment comprises: the first determining module is used for determining whether the data to be read is cache data or not according to the corresponding relation between the information of the data to be read and the index information; the second determining module is used for determining whether the cache data is the first cache data stored in the file management module or the second cache data stored in the memory according to the corresponding relation if the cache data is the first cache data stored in the file management module; and the reading module is used for reading the data to be read according to the determination result. The data reading device provided by this embodiment stores cache data with high heat in the file management module, and maintains the cache data by using the file management module, so as to solve the problem that the cache data is easy to lose after the process is restarted due to the use of the memory to store the cache data in the prior art.
Fig. 10 is a block diagram of a data reading apparatus according to another exemplary embodiment of the present application.
As shown in fig. 10, in the data reading apparatus provided in this embodiment, optionally, if the data to be read is not cache data, the reading module 83 is further configured to read the data to be read from a disk.
Optionally, the reading module 83 is specifically configured to:
if the data to be read is first cache data, reading the data to be read from the file management module;
and if the data to be read is second cache data, reading the data to be read from the memory.
Optionally, a frequency maintenance module 84 is further included, configured to increase the access frequency of the data to be read;
if the data to be read is not the first cache data, the apparatus further includes a write module 85 configured to:
and determining whether to write the data to be read into the file management module according to the access frequency.
Optionally, an updating module 86 is further included, configured to:
the index information of the cache data is updated in the LRU list.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 11, is a block diagram of an electronic device according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 11, the electronic apparatus includes: one or more processors 1001, memory 1002, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 11 illustrates an example of one processor 1001.
The memory 1002 is a non-transitory computer readable storage medium provided herein. The memory stores instructions executable by at least one processor to cause the at least one processor to perform the data writing method or the data reading method provided by the application. The non-transitory computer-readable storage medium of the present application stores computer instructions for causing a computer to execute the data writing method or the data reading method provided by the present application.
The memory 1002, as a non-transitory computer-readable storage medium, may be used for storing non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions/modules corresponding to the data writing method or the data reading method in the embodiment of the present application (for example, the obtaining module 61, the applying module 62, and the writing module 63 shown in fig. 7, and further for example, the first determining module 81, the second determining module 82, and the reading module 83 shown in fig. 9). The processor 1001 executes various functional applications of the server and data processing, i.e., implements the data writing method or the data reading method in the above-described method embodiments, by executing the non-transitory software programs, instructions, and modules stored in the memory 1002.
The memory 1002 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 1002 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 1002 may optionally include memory located remotely from the processor 1001, which may be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device may further include: an input device 1003 and an output device 1004. The processor 1001, the memory 1002, the input device 1003, and the output device 1004 may be connected by a bus or other means, and fig. 11 illustrates an example of connection by a bus.
The input device 1003 may receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic apparatus, such as an input device like a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, etc. The output devices 1004 may include a display device, auxiliary lighting devices (e.g., LEDs), and tactile feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (16)

1. A method of writing data, comprising:
acquiring data to be written, if the data to be written is high-heat data, applying management index information to a file management module, and applying storage space to the file management module;
and writing the data to be written into the storage space, and recording the corresponding relation between the information of the data to be written and the management index information.
2. The method according to claim 1, wherein the information of the data to be written comprises a storage location of the data to be written in the file management module.
3. The method according to claim 1, wherein if the information triggered by the management fails to be applied and/or the storage space fails to be applied, determining memory index information corresponding to the data to be written in the memory;
and recording the corresponding relation between the information of the data to be written and the memory index information.
4. The method of claim 1, further comprising:
and if the data to be written is not the high-heat data, writing the data to be written into a disk module.
5. The method of claim 1, further comprising:
recording the management index information of the data to be written into an LRU list.
6. The method of claim 3 or 4, further comprising:
and recording the memory index information of the data to be written into the LRUlist.
7. A data reading method, comprising:
determining whether the data to be read is cache data or not according to the corresponding relation between the information of the data to be read and the index information;
if so, determining whether the cache data is first cache data stored in a file management module or second cache data stored in a memory according to the corresponding relation;
and reading the data to be read according to the determination result.
8. The method of claim 7, wherein if the data to be read is not cached data, reading the data to be read from a disk.
9. The method according to claim 7, wherein the reading the data to be read according to the determination result comprises:
if the data to be read is first cache data, reading the data to be read from the file management module;
and if the data to be read is second cache data, reading the data to be read from the memory.
10. The method of claim 9,
improving the access frequency of the data to be read;
if the data to be read is not the first cache data, the method further comprises:
and determining whether to write the data to be read into the file management module according to the access frequency.
11. The method of claim 7, further comprising:
the index information of the cache data is updated in the LRU list.
12. A data management system, comprising:
the file management module is used for recording the relation between the information of the cache data and the corresponding index information; the cache data comprises first cache data stored in the file management module and second cache data stored in a memory;
the magnetic disk module is used for recording original data;
and the memory module is used for recording the second cache data and the memory data.
13. A data writing apparatus, comprising:
the acquisition module is used for acquiring data to be written;
the application module is used for applying management index information to the file management module and applying storage space to the file management module if the data to be written is high-heat data;
and the writing module is used for writing the data to be written into the storage space and recording the corresponding relation between the information of the data to be written and the management index information.
14. A data reading apparatus, comprising:
the first determining module is used for determining whether the data to be read is cache data or not according to the corresponding relation between the information of the data to be read and the index information;
a second determining module, configured to determine, if the first cache data is the first cache data stored in the file management module, or determine, according to the corresponding relationship, whether the cache data is the second cache data stored in the memory;
and the reading module is used for reading the data to be read according to the determination result.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6 or 7-10.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-6 or 7-10.
CN201910894457.4A 2019-09-20 2019-09-20 Data writing method, data reading method, data writing system, data reading device, electronic equipment and storage medium Pending CN110716896A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910894457.4A CN110716896A (en) 2019-09-20 2019-09-20 Data writing method, data reading method, data writing system, data reading device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910894457.4A CN110716896A (en) 2019-09-20 2019-09-20 Data writing method, data reading method, data writing system, data reading device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110716896A true CN110716896A (en) 2020-01-21

Family

ID=69210715

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910894457.4A Pending CN110716896A (en) 2019-09-20 2019-09-20 Data writing method, data reading method, data writing system, data reading device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110716896A (en)

Similar Documents

Publication Publication Date Title
US11157449B2 (en) Managing data in storage according to a log structure
US10067883B2 (en) Using an access increment number to control a duration during which tracks remain in cache
US10802755B2 (en) Method and manager for managing storage system
US10114753B2 (en) Using cache lists for multiple processors to cache and demote tracks in a storage system
US9591096B2 (en) Computer system, cache control method, and server
US20160048551A1 (en) Relationship-based wan caching for object stores
US9612975B2 (en) Page cache device and method for efficient mapping
CN110737682A (en) cache operation method, device, storage medium and electronic equipment
US11593268B2 (en) Method, electronic device and computer program product for managing cache
US20150277782A1 (en) Cache Driver Management of Hot Data
US11194720B2 (en) Reducing index operations in a cache
US10747773B2 (en) Database management system, computer, and database management method
US9971520B2 (en) Processing read and write requests
US9990301B1 (en) Value cache in a computing system
CN110737397B (en) Method, apparatus and computer program product for managing a storage system
CN110716896A (en) Data writing method, data reading method, data writing system, data reading device, electronic equipment and storage medium
CN113051244A (en) Data access method and device, and data acquisition method and device
US8700861B1 (en) Managing a dynamic list of entries for cache page cleaning
US10579541B2 (en) Control device, storage system and method
US9304918B2 (en) Computer system and cache control method
US10922228B1 (en) Multiple location index
CN115964391A (en) Cache management method, device, equipment and storage medium
US10853267B2 (en) Adaptive method for selecting a cache line replacement algorithm in a direct-mapped cache
CN113779080A (en) Method and apparatus for transmitting data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination