CN102521161B - Data caching method, device and server - Google Patents

Data caching method, device and server Download PDF

Info

Publication number
CN102521161B
CN102521161B CN201110371549.8A CN201110371549A CN102521161B CN 102521161 B CN102521161 B CN 102521161B CN 201110371549 A CN201110371549 A CN 201110371549A CN 102521161 B CN102521161 B CN 102521161B
Authority
CN
China
Prior art keywords
data
disk
buffer memory
raw data
replaced
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.)
Expired - Fee Related
Application number
CN201110371549.8A
Other languages
Chinese (zh)
Other versions
CN102521161A (en
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201110371549.8A priority Critical patent/CN102521161B/en
Publication of CN102521161A publication Critical patent/CN102521161A/en
Priority to PCT/CN2012/084951 priority patent/WO2013075627A1/en
Application granted granted Critical
Publication of CN102521161B publication Critical patent/CN102521161B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache

Abstract

The invention provides a data caching method, device and server which can improve the hit ratio of the cache and improve the operating speed of the system. The data caching method comprises the following steps of: judging whether raw data in a disk of new data in the cache are in the same mapping group with raw data in the disk of data to be replaced in the cache, wherein the mapping group is one or multiple storage groups corresponding to one storage group in the cache; if the raw data in the disk of the new data in the cache are not in the same mapping with the raw data in the disk of the data to be replaced in the cache, migrating the raw data in the disk of the new data in the cache to the same mapping group of the disk with the raw data in the disk of the data to be replaced in the cache; and writing the new data in the cache into a storage position in the cache of the data to be replaced in the cache. The method, the device and the server provided by the invention are applied to the field of data cache.

Description

A kind of caching method of data, device and server
Technical field
The present invention relates to data buffer storage field, particularly relate to a kind of caching method of data, device and server.
Background technology
I/O (Input/Output, input and output) speed between disk and internal memory is an important bottleneck of system performance always.At present in order to improve the speed of system, a lot of system adds level cache between internal memory and disk, for depositing the instruction and data that CPU needs to run in the recent period, can improve the access speed of CPU to disk.
In prior art, between disk and buffer memory, main employing group is connected mapped mode, manages data cached in units of group.Disk is all divided into the identical group of size with the storage space of buffer memory, the storage space of usual disk is more much larger than the storage space of buffer memory, in disk, the data of multiple storage sets correspondence will be cached to same storage sets in buffer memory, and such mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk.
State buffer memory group to be in realization connected in the process of mapping, buffer memory manages data cached in units of group.Newly enter data in buffer memory will be stored in buffer memory, the raw data of data in the buffer memory be replaced in disk must with buffer memory in newly enter the raw data of data in disk and be positioned at same mapping group, data in the buffer memory be replaced like this may be the data of comparatively focus in whole buffer memory, and can not replace in whole buffer memory the non-hot spot data or the coldest data that are positioned at other storage sets.And these non-hot spot datas or the coldest data take spatial cache, other hot spot data can not be made to be stored in buffer memory, thus the hit rate of buffer memory can be affected, reduce the operating rate of system.
Summary of the invention
Embodiments of the invention provide a kind of caching method of data, device and server, improve the hit rate of buffer memory and the speed of system cloud gray model.
For achieving the above object, embodiments of the invention adopt following technical scheme:
A caching method for data, comprising:
Judge newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory and whether be arranged in the same mapping group of disk, described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk;
If newly enter the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory in described buffer memory be not arranged in the same mapping group of disk, move in the Disk Mapping group that in described buffer memory, the raw data of data to be replaced in disk is identical by newly entering the raw data of data in disk in described buffer memory;
The memory location of data to be replaced in described buffer memory in described buffer memory is write by newly entering data in described buffer memory.
A buffer storage for data, comprising:
First judging unit, judge newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory and whether be arranged in the same mapping group of disk, described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk;
Disk migration units, if newly enter the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory in described buffer memory be not arranged in the same mapping group of disk, for moving in the Disk Mapping group that in described buffer memory, the raw data of data to be replaced in disk is identical by newly entering the raw data of data in disk in described buffer memory;
Buffer memory writing unit, for writing the memory location of data to be replaced in described buffer memory in described buffer memory by newly entering data in described buffer memory.
A kind of server, comprises the buffer storage of above-mentioned data.
Embodiments provide a kind of caching method of data, device and server, between disk with buffer memory, the employing group pattern mapped that is connected carries out carrying out the buffer memory of data in units of group.By belonging in the buffer memory of different mappings group newly to enter the raw data of data in disk and move in the Disk Mapping group that in buffer memory, the raw data of data to be replaced in disk is identical by with the raw data of data to be replaced in buffer memory in disk, what have target is stored into data to be replaced memory location in the buffer in buffer memory by newly entering data in buffer memory.Such ability is more effective gets rid of the data be of little use in buffer memory, as the coldest data or non-hot spot data, makes hot spot data can not be replaced out buffer memory, thus can improve the hit rate of buffer memory, improves the operating rate of system.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
The schematic flow sheet of the caching method of the data that Fig. 1 provides for the embodiment of the present invention one;
The structural representation of the buffer storage of the data that Fig. 2 provides for the embodiment of the present invention one;
The schematic flow sheet of the caching method of the data that Fig. 3 provides for the embodiment of the present invention two;
The structural representation of the buffer storage of the data that Fig. 4 provides for the embodiment of the present invention three;
Fig. 5 is that disk and buffer memory employing group are connected the schematic diagram of the mode mapped;
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Embodiment one
Embodiments provide a kind of caching method of data, as shown in Figure 1, comprising:
S101, judge newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory and whether be arranged in the same mapping group of disk, described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk.
If newly enter the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory in described buffer memory be not arranged in the data of disk same mapping group, perform S102 step; If newly enter the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory in buffer memory to be arranged in the data of disk same mapping group, perform S103 step.
S102, to move to newly entering the raw data of data in disk in described buffer memory in the Disk Mapping group that in described buffer memory, the raw data of data to be replaced in disk is identical.
S103, write the memory location of data to be replaced in described buffer memory in described buffer memory by newly entering data in described buffer memory.
In concrete buffer memory, data to be replaced can by adding up according to accessed time and accessed frequency the data of buffer memory, and the coldest data of acquisition or non-hot spot data are as described replacement data.
The embodiment of the present invention additionally provides a kind of buffer storage of data, as shown in Figure 2, comprising: the first judging unit 21, disk migration units 22 and buffer memory writing unit 23.
First judging unit 21, whether be arranged in the same mapping group of disk for judging newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory, described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk.
Disk migration units, if newly enter the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory in described buffer memory be not arranged in the same mapping group of disk, for moving to newly entering the raw data of data in disk in described buffer memory in the Disk Mapping group that in described buffer memory, the raw data of data to be replaced in disk is identical.
Buffer memory writing unit 23, for writing the memory location of data to be replaced in described buffer memory in described buffer memory by newly entering data in described buffer memory.
A kind of server, comprises the buffer storage of above-mentioned data.
Embodiments provide a kind of caching method of data, device and server, between disk with buffer memory, the employing group pattern mapped that is connected carries out carrying out the buffer memory of data in units of group.By belonging in the buffer memory of different mappings group newly to enter the raw data of data in disk and move in the Disk Mapping group that in buffer memory, the raw data of data to be replaced in disk is identical by with the raw data of data to be replaced in buffer memory in disk, what have target is stored into data to be replaced memory location in the buffer in buffer memory by newly entering data in buffer memory.Such ability is more effective gets rid of the data be of little use in buffer memory, as the coldest data or non-hot spot data, makes hot spot data can not be replaced out buffer memory, thus can improve the hit rate of buffer memory, improves the operating rate of system.
Embodiment two,
Embodiments provide a kind of caching method of data, as shown in Figure 3, comprising:
S301, judge newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory and whether be arranged in the same mapping group of disk, described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk.
If newly enter the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory in described buffer memory be not arranged in the data of disk same mapping group, then perform S302 step; If newly enter the raw data of data to be replaced in disk in the raw data in disk of data and described buffer memory in described buffer memory to be positioned at the data of same mapping group, then perform S305 step.
Whether S302, to judge that the raw data of data to be replaced in disk in described buffer memory is arranged in the storage space of the mapping group of disk full.
If to be arranged in the storage space of the mapping group of disk full for the raw data of data to be replaced in disk in described buffer memory, then perform S303; If the storage space that in described buffer memory, the raw data of data to be replaced in disk is arranged in the mapping group of disk less than, then perform S304.
The memory location of the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory is newly entered in S303, cache exchanging.
Newly enter the raw data of data in disk in S304, described buffer memory to move to the raw data of data to be replaced in disk in described buffer memory and be arranged in the clear position of the mapping group of disk.
S305, write the memory location of data to be replaced in described buffer memory in described buffer memory by newly entering data in described buffer memory.
Wherein, in described buffer memory, data to be replaced can by adding up according to accessed time and accessed frequency the data of buffer memory, and the coldest data of acquisition or non-hot spot data are as described replacement data.
Further, newly can also enter the memory location of the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory in cache exchanging after, by the exchanges data memory location that the not data cached and raw data of data to be replaced in buffer memory in disk newly entering the raw data association of data in disk in buffer memory associates, newly enter in the not data cached and buffer memory of the raw data association of data in disk newly to enter the raw data of data in disk in described buffer memory and be positioned at the same storage sets of disk and physical storage address is continuous, in the data of the raw data association of data to be replaced in disk in described buffer memory and buffer memory, the raw data of data to be replaced in disk is positioned at the data of the same storage sets of disk and physical storage address is continuous.
Further, newly can also enter after the raw data of data in disk be stored into the clear position of the mapping group in described buffer memory belonging to the raw data of data to be replaced in disk in described buffer memory, the not data cached clear position being stored into mapping group in buffer memory belonging to the raw data of data to be replaced in disk of the association of the raw data in disk of data will be newly entered in buffer memory, newly enter in the not data cached and buffer memory of the raw data association of data in disk newly to enter the raw data of data in disk in described buffer memory and be positioned at the same storage sets of disk and physical storage address is continuous.
Above-mentioned buffer memory can adopt non-volatile storage medium, as the cached medium of SSD (solid state disk, solid state hard disc), PCM (phase-change memory, phase transition storage).
We are described in detail to the detailed process of the data in magnetic disk caching method that the embodiment of the present invention provides below.
I/O speed between disk and internal memory is an important bottleneck of system performance always, between disk and internal memory, add level cache, can effectively improve I/O speed.
Employing group between disk and disk buffering is connected pattern, manages data cached in units of group.As shown in Figure 5, the storage space of disk and buffer memory is divided into onesize storage sets, suppose in buffer memory, there is N number of storage sets, M blocks of data is had in each storage sets, because the storage space of disk is more much larger than the storage space of buffer memory, in disk, there is multiple storage sets can be mapped to the same storage sets of buffer memory like this.Exemplary, have 3 storage sets in Fig. 5 in disk respectively by the same storage sets of correspondence mappings to buffer memory, these 3 storage sets are called the mapping group of disk.Be the mapping group c1 of disk as schemed A1c1, A2c1, A3c1 tri-storage sets, the data in this mapping group c1 can only be mapped in the C1 storage sets of buffer memory.Supposing the system uses certain blocks of data m1 in a certain storage sets A3cN in mapping group cN, revises after m1 is used to data m1.Amended data content becomes m1A3, and m1A3 will be stored in buffer memory as newly entering data in buffer memory.And the raw data m1 of m1A3 in disk belongs to the data in mapping group cN.Like this when buffer memory CN storage sets storage space less than, newly enter the clear position that data m1A3 just directly can be stored into the CN storage sets of buffer memory in buffer memory.
And when the storage space of buffer memory C1 storage sets is full, in order to improve cache hit rate, the travelling speed of raising system, buffer memory can according to storing data in the buffer accessed time and accessed frequency, count the coldest data or non-hot spot data as data to be replaced in buffer memory, be written to data to be replaced memory location in the buffer in buffer memory by what newly enter in buffer memory that data have a target.
Such disposal system can judge newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory and whether be arranged in the same mapping group of disk, and described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk.If newly enter the raw data of data to be replaced in disk in the raw data in disk of data and buffer memory in buffer memory to be arranged in disk same mapping group, according to the connected mode mapped of group, for SSD buffer memory medium, need, first in the buffer directly by this data erase to be replaced, then to write the memory location of data to be replaced at buffer memory by newly entering data in buffer memory.
If disposal system judges newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory be not arranged in the data of disk same mapping group, whether disposal system judges that the raw data of data to be replaced in disk in buffer memory is arranged in the storage space of the mapping group of disk further full.
If the storage space that in buffer memory, the raw data of data to be replaced in disk is arranged in the mapping group of disk is occupied full, so disposal system exchanges memory location each other by newly entering the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory in buffer memory.
Further, the exchanges data memory location that the not data cached and raw data of data to be replaced in buffer memory in disk newly entering the raw data association of data in disk in buffer memory can also associate by disposal system, newly enters the raw data in disk newly entering data in the not data cached and buffer memory that the raw data of data in disk associate and is positioned at the same storage sets of disk and physical storage address is continuous in described buffer memory.In the data of the raw data association of data to be replaced in disk in described buffer memory and buffer memory, the raw data of data to be replaced in disk is positioned at the same storage sets of disk and physical storage address is continuous.Then need by newly enter in buffer memory data in disk raw data association not data cached be stored into buffer memory time, be directly stored in buffer memory.Disposal system can be made like this to carry out buffer memory to the data in disk more fast, effectively upgrade the data in buffer memory.
If the storage space that in buffer memory, the raw data of data to be replaced in disk is arranged in the mapping group of disk is not also occupied full, so disposal system moves to the raw data of data to be replaced in disk in buffer memory be arranged in the clear position of the mapping group of disk by newly entering the raw data of data in disk in buffer memory.Further, disposal system can also move to newly entering in buffer memory raw data association not data cached of data in disk the raw data of data to be replaced in disk in buffer memory and is arranged in the clear position of the mapping group of disk, newly enters in the not data cached and buffer memory of the raw data association of data in disk newly to enter the raw data of data in disk and be positioned at the same storage sets of disk and physical storage address is continuous in described buffer memory.Disposal system can be made like this to carry out buffer memory to the data in disk more fast, effectively upgrade the data in buffer memory.
Concrete, newly enter in buffer memory data in disk raw data association data or buffer memory in data to be replaced in disk raw data association data, association mentioned here can be belong to identical file or attribute data relatively, the concrete different piece as an audio-video document, if data are the Part I of video file, can be then the other part of this video file with the data of this data correlation.
Moving to newly entering the raw data of data in disk in buffer memory after in Disk Mapping group that in buffer memory, the raw data of data to be replaced in disk is identical, disposal system also needs to revise the filec descriptor newly entering data in buffer memory, specifically comprises: the mapping relations newly entering data and disk in amendment buffer memory.Further according to the mapping relations newly entering data and disk in amended buffer memory, system upgrades in buffer memory automatically newly enters data storage sets in the buffer.Then disposal system detects in I/O request queue the operation whether had newly entering data in buffer memory, if there is the operation to newly entering data in this buffer memory in I/O request queue, need to revise the filec descriptor newly entering data in I/O request queue in this buffer memory simultaneously, specifically comprise: the mapping relations newly entering data and disk in amendment buffer memory.
The data cache method that the embodiment of the present invention provides, between disk with buffer memory, the employing group pattern mapped that is connected carries out carrying out the buffer memory of data in units of group.In order to effectively replace the coldest data in buffer memory or non-hot spot data, first judging newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory and whether being positioned at same mapping group.When newly entering that in the raw data of data in disk and buffer memory, the raw data of data to be replaced in disk is positioned at different mappings group in the buffer, the raw data of data in disk will be newly entered and be stored into the mapping group of the raw data of data to be replaced in disk in buffer memory in buffer memory, the coldest in buffer memory or non-hot spot data can be replaced like this, thus the hit rate of buffer memory can be improved, improve the operating rate of system.
Embodiment three,
Embodiments provide a kind of buffer storage of data, as shown in Figure 4, comprising: statistic unit 41, first judging unit 42, disk migration units 43, buffer memory writing unit 44.
Wherein, statistic unit 41, for the data in described buffer memory being added up according to accessed time and accessed frequency, the coldest data of acquisition or non-hot spot data are as data to be replaced in described buffer memory.
First judging unit 42, whether be arranged in the same mapping group of disk for judging newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory, described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk.
Disk migration units 43, if newly enter the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory in described buffer memory be not arranged in the same mapping group of disk, for moving to newly entering the raw data of data in disk in described buffer memory in the Disk Mapping group that in described buffer memory, the raw data of data to be replaced in disk is identical.
Disk migration units 43 specifically comprises the second judgment sub-unit 431, recon unit 432 and storing sub-units 433.
Second judgment sub-unit 431, whether full for judging that the raw data of data to be replaced in disk in described buffer memory is arranged in the storage space of the mapping group of disk.
Recon unit 432, if to be arranged in the storage space of the mapping group of disk full for the raw data of data to be replaced in disk in described buffer memory, for newly entering the memory location of the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory in cache exchanging.
Storing sub-units 433, if the storage space that in described buffer memory, the raw data of data to be replaced in disk is arranged in the mapping group of disk less than, move to the raw data of data to be replaced in disk in described buffer memory be arranged in the clear position of the mapping group of disk for newly entering the raw data of data in disk in described buffer memory.
Buffer memory writing unit 44, for writing the memory location of data to be replaced in described buffer memory in described buffer memory by newly entering data in described buffer memory.
Further, the exchanges data memory location of recon unit 432 also for the not data cached and raw data of data to be replaced in buffer memory in disk newly entering the raw data association of data in disk in buffer memory is associated, newly enter in the not data cached and buffer memory of the raw data association of data in disk newly to enter the raw data of data in disk in described buffer memory and be positioned at the same storage sets of disk and physical storage address is continuous, in the data of the raw data association of data to be replaced in disk in described buffer memory and buffer memory, the raw data of data to be replaced in disk is positioned at the same storage sets of disk and physical storage address is continuous.
Further, storing sub-units 433, also for the not data cached clear position moving to mapping group belonging to the raw data of replacement data in disk by newly entering the raw data association of data in disk in buffer memory, newly being entered the raw data in disk newly entering data in the not data cached and buffer memory of the association of the raw data in disk of data and being positioned at the same storage sets of disk and physical storage address is continuous in described buffer memory.
Above-mentioned buffer memory can adopt non-volatile storage medium, as the cached medium of SSD, PCM.
We are described in detail to the specific works process of the buffer storage of data below.
I/O speed between disk and internal memory is an important bottleneck of system performance always, between disk and internal memory, add level cache, can effectively improve I/O speed.
First judging unit of buffer storage can judge newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory and whether be arranged in the same mapping group of disk, and described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk.If newly enter the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory in described buffer memory to be arranged in the data of the same mapping group of disk, like this according to the connected mode mapped of group, for SSD buffer memory medium, buffer memory writing unit needs are first direct in the buffer to be wiped this replacement data, then newly will enter data write replacement data in buffer memory in the memory location of buffer memory.
If the first judging unit judges newly to enter in described buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory be not arranged in the data of the same mapping group of disk, whether the second judgment sub-unit of disk storage unit needs to judge further that the raw data of data to be replaced in disk in described buffer memory is arranged in the storage space of the mapping group of disk full.
If to be arranged in the storage space of the mapping group of disk full for the raw data of data to be replaced in disk in described buffer memory, so the recon unit of disk migration units will newly enter the memory location of the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory in cache exchanging.
Further, the exchanges data memory location that the not data cached and raw data of data to be replaced in buffer memory in disk newly entering the raw data association of data in disk in buffer memory can also associate by recon unit, newly enter in the not data cached and buffer memory of the raw data association of data in disk newly to enter the raw data of data in disk in described buffer memory and be positioned at the same storage sets of disk and physical storage address is continuous, in the data of the raw data association of data to be replaced in disk in described buffer memory and buffer memory, the raw data of data to be replaced in disk is positioned at the data of the same storage sets of disk and physical storage address is continuous.Buffer memory can be carried out to the data in disk more fast like this, effectively upgrade the data in buffer memory.
If the storage space that the raw data of data to be replaced in disk is arranged in the mapping group of disk in described buffer memory less than, so the storing sub-units of buffer storage moves to the raw data of data to be replaced in disk in described buffer memory be arranged in the clear position of the mapping group of disk by newly entering the raw data of data in disk in buffer memory.Further, storing sub-units can also move to newly entering in buffer memory raw data association not data cached of data in disk the raw data of data to be replaced in disk in buffer memory and is arranged in the clear position of the mapping group of disk, newly enters in the not data cached and buffer memory of the raw data association of data in disk newly to enter the raw data of data in disk and be positioned at the same storage sets of disk and physical storage address is continuous in described buffer memory.Disposal system can be made like this to carry out buffer memory to the data in disk more fast, effectively upgrade the data in buffer memory.
Concrete, newly enter in buffer memory data in disk raw data association data or buffer memory in data to be replaced in disk raw data association data, association mentioned here can be belong to identical file or attribute data relatively, the concrete different piece as an audio-video document, if data are the Part I of video file, can be then the other part of this video file with the data of this data correlation.
Moving to newly entering the raw data of data in disk in buffer memory after in Disk Mapping group that in buffer memory, the raw data of data to be replaced in disk is identical, buffer storage also needs to revise the filec descriptor newly entering data in buffer memory, specifically comprises: the mapping relations newly entering data and disk in amendment buffer memory.Further according to the mapping relations newly entering data and disk in amended buffer memory, buffer storage automatically upgrades in buffer memory and newly enters data storage sets in the buffer.Then the operation whether had newly entering data in buffer memory is detected in I/O request queue, if there is the operation to newly entering data in this buffer memory in I/O request queue, need to revise the filec descriptor newly entering data in I/O request queue in this buffer memory simultaneously, specifically comprise: the mapping relations newly entering data and disk in amendment buffer memory.
The buffer storage of the data that the embodiment of the present invention provides, between disk with buffer memory, the employing group pattern mapped that is connected carries out carrying out the buffer memory of data in units of group.First the first judging unit judges newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory and whether is positioned at same mapping group.When newly entering that in the raw data of data in disk and buffer memory, the raw data of data to be replaced in disk is not arranged in the different mappings group of disk in the buffer, the raw data of data in disk will be newly entered and be stored into the mapping group of the raw data of data to be replaced in disk in buffer memory in buffer memory, the coldest in buffer memory or non-hot spot data can be replaced like this, thus the hit rate of buffer memory can be improved, improve the operating rate of system.
The embodiment of the present invention additionally provides a kind of server, comprises the buffer storage of the data of embodiment one, three or adopts the caching method of the data of embodiment one, two to carry out data buffer storage.Server does not repeat them here about the course of work of the buffer memory of data.
One of ordinary skill in the art will appreciate that: the hardware that all or part of step realizing said method embodiment can be associated by programmed instruction has come, aforesaid program can be stored in a computer read/write memory medium, this program, when performing, performs the step comprising said method embodiment; And aforesaid storage medium comprises: ROM, RAM, magnetic disc or CD etc. various can be program code stored medium.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; change can be expected easily or replace, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of described claim.

Claims (9)

1. a caching method for data, is characterized in that, comprising:
Judge newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory and whether be arranged in the same mapping group of disk, described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk;
If newly enter the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory in described buffer memory be not arranged in the same mapping group of disk, whether fullly judge that the raw data of data to be replaced in disk in described buffer memory is arranged in the storage space of the mapping group of disk;
If to be arranged in the storage space of the mapping group of disk full for the raw data of data to be replaced in disk in described buffer memory, in cache exchanging, newly enter the memory location of the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory;
If the storage space that in described buffer memory, the raw data of data to be replaced in disk is arranged in the mapping group of disk less than, newly enter the raw data of data in disk in described buffer memory and move to the raw data of data to be replaced in disk in described buffer memory and be arranged in the clear position of the mapping group of disk;
The memory location of data to be replaced in described buffer memory in described buffer memory is write by newly entering data in described buffer memory.
2. method according to claim 1, is characterized in that, after newly entering the memory location of the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory, also comprises in cache exchanging:
By the exchanges data memory location that the not data cached and raw data of data to be replaced in buffer memory in disk newly entering the raw data association of data in disk in buffer memory associates, newly enter in the not data cached and buffer memory of the raw data association of data in disk newly to enter the raw data of data in disk in described buffer memory and be positioned at the same storage sets of disk and physical storage address is continuous, in the data of the raw data association of data to be replaced in disk in described buffer memory and buffer memory, the raw data of data to be replaced in disk is positioned at the same storage sets of disk and physical storage address is continuous.
3. method according to claim 1, is characterized in that, newly enters the raw data of data in disk and moves to after the raw data of data to be replaced in disk is arranged in the clear position of the mapping group of disk in described buffer memory, also comprise in described buffer memory:
To newly enter the not data cached clear position moving to mapping group belonging to the raw data of replacement data in disk of the raw data association of data in disk in buffer memory, newly enter the raw data in disk newly entering data in the not data cached and buffer memory of the association of the raw data in disk of data in described buffer memory and be positioned at the same storage sets of disk and physical storage address is continuous.
4. the method according to any one of claim 1-3, is characterized in that, also comprises:
Data in described buffer memory added up according to accessed time and accessed frequency, the coldest data of acquisition or non-hot spot data are as data to be replaced in described buffer memory.
5. a buffer storage for data, is characterized in that, comprising:
First judging unit, whether be arranged in the same mapping group of disk for judging newly to enter in buffer memory the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory, described mapping group is one or more storage sets corresponding with a storage sets in buffer memory in disk;
Disk migration units, comprises the second judgment sub-unit, recon unit and storing sub-units; If newly enter the raw data of data to be replaced in disk in the raw data of data in disk and described buffer memory in described buffer memory be not arranged in the same mapping group of disk,
Described second judgment sub-unit, whether full for judging that the raw data of data to be replaced in disk in described buffer memory is arranged in the storage space of the mapping group of disk;
Described recon unit, if to be arranged in the storage space of the mapping group of disk full for the raw data of data to be replaced in disk in described buffer memory, for newly entering the memory location of the raw data of data to be replaced in disk in the raw data of data in disk and buffer memory in cache exchanging;
Described storing sub-units, if the storage space that in described buffer memory, the raw data of data to be replaced in disk is arranged in the mapping group of disk less than, move to the raw data of data to be replaced in disk in described buffer memory be arranged in the clear position of the mapping group of disk for newly entering the raw data of data in disk in described buffer memory;
Buffer memory writing unit, for writing the memory location of data to be replaced in described buffer memory in described buffer memory by newly entering data in described buffer memory.
6. device according to claim 5, it is characterized in that, described recon unit, exchanges data memory location also for the not data cached and raw data of data to be replaced in buffer memory in disk newly entering the raw data association of data in disk in buffer memory is associated, newly enter in the not data cached and buffer memory of the raw data association of data in disk newly to enter the raw data of data in disk in described buffer memory and be positioned at the same storage sets of disk and physical storage address is continuous, in the data of the raw data association of data to be replaced in disk in described buffer memory and buffer memory, the raw data of data to be replaced in disk is positioned at the same storage sets of disk and physical storage address is continuous.
7. device according to claim 5, it is characterized in that, described storing sub-units, also for the not data cached clear position moving to mapping group belonging to the raw data of replacement data in disk by newly entering the raw data association of data in disk in buffer memory, newly being entered the raw data in disk newly entering data in the not data cached and buffer memory of the association of the raw data in disk of data and being positioned at the same storage sets of disk and physical storage address is continuous in described buffer memory.
8. the device according to any one of claim 5-7, is characterized in that, also comprises:
Statistic unit, for the data in described buffer memory being added up according to accessed time and accessed frequency, the coldest data of acquisition or non-hot spot data are as data to be replaced in described buffer memory.
9. a server, is characterized in that, comprises the buffer storage described in any one of claim 5-8.
CN201110371549.8A 2011-11-21 2011-11-21 Data caching method, device and server Expired - Fee Related CN102521161B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201110371549.8A CN102521161B (en) 2011-11-21 2011-11-21 Data caching method, device and server
PCT/CN2012/084951 WO2013075627A1 (en) 2011-11-21 2012-11-21 Method, device and server for caching data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110371549.8A CN102521161B (en) 2011-11-21 2011-11-21 Data caching method, device and server

Publications (2)

Publication Number Publication Date
CN102521161A CN102521161A (en) 2012-06-27
CN102521161B true CN102521161B (en) 2015-01-21

Family

ID=46292090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110371549.8A Expired - Fee Related CN102521161B (en) 2011-11-21 2011-11-21 Data caching method, device and server

Country Status (2)

Country Link
CN (1) CN102521161B (en)
WO (1) WO2013075627A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107229574A (en) * 2016-03-23 2017-10-03 上海复旦微电子集团股份有限公司 Caching and its control method

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521161B (en) * 2011-11-21 2015-01-21 华为技术有限公司 Data caching method, device and server
CN104252421A (en) * 2013-06-25 2014-12-31 华为技术有限公司 Caching method and caching device
CN104932990B (en) * 2015-06-03 2018-05-11 华为技术有限公司 The replacement method and device of data block in a kind of cache memory
CN108932150B (en) * 2017-05-24 2023-09-15 中兴通讯股份有限公司 Caching method, device and medium based on SSD and disk hybrid storage

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1347527A (en) * 1999-12-17 2002-05-01 皇家菲利浦电子有限公司 Data processor with cache
CN1499382A (en) * 2002-11-05 2004-05-26 华为技术有限公司 Method for implementing cache in high efficiency in redundancy array of inexpensive discs
EP1980945A1 (en) * 2006-01-31 2008-10-15 Fujitsu Limited Memory access control apparatus and memory access control method
CN102137139A (en) * 2010-09-26 2011-07-27 华为技术有限公司 Method and device for selecting cache replacement strategy, proxy server and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5829028A (en) * 1996-05-06 1998-10-27 Advanced Micro Devices, Inc. Data cache configured to store data in a use-once manner
CN100498740C (en) * 2007-09-11 2009-06-10 腾讯科技(深圳)有限公司 Data cache processing method, system and data cache device
US8171219B2 (en) * 2009-03-31 2012-05-01 Intel Corporation Method and system to perform caching based on file-level heuristics
CN102521161B (en) * 2011-11-21 2015-01-21 华为技术有限公司 Data caching method, device and server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1347527A (en) * 1999-12-17 2002-05-01 皇家菲利浦电子有限公司 Data processor with cache
CN1499382A (en) * 2002-11-05 2004-05-26 华为技术有限公司 Method for implementing cache in high efficiency in redundancy array of inexpensive discs
EP1980945A1 (en) * 2006-01-31 2008-10-15 Fujitsu Limited Memory access control apparatus and memory access control method
CN102137139A (en) * 2010-09-26 2011-07-27 华为技术有限公司 Method and device for selecting cache replacement strategy, proxy server and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107229574A (en) * 2016-03-23 2017-10-03 上海复旦微电子集团股份有限公司 Caching and its control method

Also Published As

Publication number Publication date
CN102521161A (en) 2012-06-27
WO2013075627A1 (en) 2013-05-30

Similar Documents

Publication Publication Date Title
CN104268094B (en) Optimized flash memory address mapping method
CN103049397B (en) A kind of solid state hard disc inner buffer management method based on phase transition storage and system
CN103019962B (en) Data buffer storage disposal route, device and system
CN103136121B (en) Cache management method for solid-state disc
CN108121503B (en) NandFlash address mapping and block management method
KR101028929B1 (en) Methods of Distributing Log Block Associativity in Real-time System And Flash Memory Device Performing the Same
CN102163175B (en) Hybrid address mapping method based on locality analysis
CN105095116A (en) Cache replacing method, cache controller and processor
CN108762664B (en) Solid state disk page-level cache region management method
US20140208038A1 (en) Sectored cache replacement algorithm for reducing memory writebacks
CN102521161B (en) Data caching method, device and server
CN103019971A (en) Method of quickly responding to trim command, SSD (Solid State Disk) controller and system
CN104794064A (en) Cache management method based on region heat degree
CN103399823B (en) The storage means of business datum, equipment and system
CN101644996A (en) Storage method of index data and storage control device
CN105138292A (en) Disk data reading method
CN102981963A (en) Implementation method for flash translation layer of solid-state disc
KR20100021868A (en) Buffer cache management method for flash memory device
CN108845957B (en) Replacement and write-back self-adaptive buffer area management method
CN110888600B (en) Buffer area management method for NAND flash memory
CN102063386B (en) Cache management method of single-carrier multi-target cache system
Xu et al. CAST: A page-level FTL with compact address mapping and parallel data blocks
CN100428193C (en) Data preacquring method for use in data storage system
CN101510176A (en) Control method of general-purpose operating system for accessing CPU two stage caching
CN103049393B (en) Memory headroom management method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150121

Termination date: 20191121

CF01 Termination of patent right due to non-payment of annual fee