The recovery method of control internal memory and device
Technical field
The application relates to data storage technology, in particular to recovery method and the device of control internal memory.
Background technology
In current Memory recycle mechanism, other internal memories except (dirty) internal memory that lost efficacy, its recovery is all random, cannot accurately control internal memory specifically at which time point is recovered.
This kind is reclaimed the mode of internal memory at random at present, it is possible to can make the data fast access newly writing internal memory, but there is following defect:
For some internal memories, it is recovered before data in its new write accessed (also namely performing reading operation), so, when the follow-up reading receiving the data for accessing this new write again operates, have to again turn to disk to complete reading operation, affect reading performance, reduce Operational Visit efficiency.
Summary of the invention
This application provides the recovery method of control internal memory and device, to improve reading performance and Operational Visit efficiency.
The technical scheme that the application provides comprises:
Control a method for Memory recycle, comprising:
For the internal memory setup times time parameter value of satisfied setting condition estimated out, described setting condition is: the data of write are accessed in setting-up time T1; Described T1 is less than or equals described time parameter value;
When carrying out Memory recycle, the time parameter value of detection internal memory, if time parameter value internal memory being detected expires, then reclaims internal memory, if time parameter value internal memory being detected is also not yet due, then forbids Memory recycle.
Control a device for Memory recycle, comprising:
Estimating unit, for the internal memory setup times time parameter value of the satisfied setting condition for estimating out, described setting condition is: the data of write are accessed in setting-up time T1; Described T1 is less than or equals described time parameter value;
Memory recycle control unit, for when carrying out Memory recycle, the time parameter value of detection internal memory, if time parameter value internal memory being detected expires, then reclaims internal memory, if time parameter value internal memory being detected is also not yet due, then forbids Memory recycle.
As can be seen from the above technical solutions, in the present invention, by selectively the internal memory in cache memory (cache) being arranged time parameter value, to determine that the data being provided with in the internal memory of time parameter value retain for some time (time parameter value), prevent internal memory from being recycled at random, this can improve the probability of follow-up business hit internal memory, the reading performance of effective raising business and Operational Visit efficiency.
Accompanying drawing explanation
Fig. 1 is method flow diagram provided by the invention;
The schema that Fig. 2 provides for the embodiment of the present invention 1;
The schema that Fig. 3 provides for the embodiment of the present invention 2;
The schema that Fig. 4 provides for the embodiment of the present invention 3;
Fig. 5 is apparatus structure schematic diagram provided by the invention.
Embodiment
In order to make the object, technical solutions and advantages of the present invention clearly, describe the present invention below in conjunction with the drawings and specific embodiments.
Method provided by the invention comprises the flow process shown in Fig. 1:
It is method flow diagram provided by the invention see Fig. 1, Fig. 1. This flow process can be applicable to the control application program of cache. As shown in Figure 1, this flow process can comprise the following steps:
Step 101 is the internal memory setup times time parameter value of satisfied setting condition estimated out, and setting condition is: the data of write are accessed in setting-up time T1; T1 is less than or equals time parameter value.
Step 102, when carrying out Memory recycle, the time parameter value of detection internal memory, if time parameter value internal memory being detected expires, then reclaims internal memory, if time parameter value internal memory being detected is also not yet due, then forbids Memory recycle.
It should be noted that, when the time parameter value that step 102 detects internal memory is also not yet due, then do not forbid Memory recycle under special circumstances, but need to force to reclaim internal memory. These Special Circumstances are: the internal memory being released at present cannot meet business demand. For this kind of Special Circumstances, then force to reclaim the also not yet due internal memory of some time parameter values from the angle first meeting business demand, to ensure that business can normally use. This kind of Special Circumstances do not belong to the emphasis of the application, therefore, are not described in detail.
That is, except above-mentioned Special Circumstances, the present invention is by arranging time parameter value to the internal memory in cache memory (cache) selectively, to determine that the data being provided with in the internal memory of time parameter value retain for some time (time parameter value), prevent internal memory from being recycled at random, this can improve the probability of follow-up business hit internal memory, the reading performance of effective raising business and Operational Visit efficiency.
So far, complete the flow process shown in Fig. 1.
The how internal memory setup times time parameter value of satisfied setting condition for estimating out is specifically described in step 101 below by embodiment:
Embodiment 1:
In the present embodiment 1, for the internal memory setup times time parameter value of the satisfied setting condition estimated out can comprise flow process shown in Fig. 2 in step 101:
See step 101 flowchart that Fig. 2, Fig. 2 are the embodiment of the present invention 1 offer. In actual applications, this flow process is generally be applied in the control application program of cache. As shown in Figure 2, this flow process can comprise the following steps:
Step 201, receives business write operation.
Wherein, when needing for client terminal during business application internal memory can send business write operation to the control application program of cache according to business demand, based on this, the control application program of cache can receive business write operation.
Step 202, it is determined that with the internal memory that described business write operation is associated, write data according to described business write operation in this internal memory determined.
When the control application program of cache receives business write operation, it is determined that needing to write data to internal memory, based on this, it can select one piece of internal memory (normally selecting internal memory in order) for this business write operation. Here, the internal memory selected is the above-mentioned internal memory being associated with business write operation that is that determine.
When determining and after the internal memory that business write operation is associated, according to business write operation, data to be written will be write to this and determine with the internal memory that business write operation is associated.
According to business demand, step 203, judges whether the data in this internal memory determined again are accessed in described T1, if it does, perform step 204, if not, terminate current flow process.
When data are write supreme state in the internal memory being associated with business write operation determined after, the business demand of this data association can be known based on these data, judge whether these data again can be accessed within the T1 time according to the business demand associated by these data, if, then perform step 204, if not, then mean that these data again can not be accessed within the T1 time, then above-mentioned determine that the internal memory being associated with business write operation can be recovered at any time, terminate current flow process.
Step 204, for this internal memory determined arranges time parameter value.
So far, complete the flow process shown in Fig. 2.
Can be found out by the flow process shown in Fig. 2, in the present invention, after receiving business write operation, can judge whether the internal memory that business write operation is associated arranges time parameter value, being judged by this kind can selectively as internal memory arranges time parameter value, can ensure to be provided with the internal memory of time parameter value, it can retain data for some time wherein (time parameter value), the data in internal memory are avoided to be released recovery at any time, improve the probability of follow-up business hit internal memory, the reading performance of effective raising business and Operational Visit efficiency.
Embodiment 2:
In the present embodiment 2, for the internal memory setup times time parameter value of the satisfied setting condition estimated out can comprise flow process shown in Fig. 3 in step 101:
See step 101 flowchart that Fig. 3, Fig. 3 are the embodiment of the present invention 2 offer. In actual applications, this flow process is generally be applied in the control application program of cache. As shown in Figure 3, this flow process can comprise the following steps:
Step 301, receives business reading operation.
Wherein, when the data read in internal memory according to business demand are shown, client terminal can send business reading and operate to the control application program of cache, and based on this, the control application program of cache can receive business reading operation.
Step 302, it is determined that operate the internal memory being associated with business reading.
When the control application program of cache receives business reading operation, it is determined that need from memory read data, based on this, its internal memory read according to business reading operation selection needs. Here, the internal memory selected is the above-mentioned internal memory being associated with business reading operation that is that determine.
When determining and after the internal memory that business reading operation is associated, will read the data in this internal memory, similar available data reading manner, repeats no more here.
According to business demand, step 303, judges whether the data in this internal memory determined again are accessed in described T1, if it does, perform step 304, if not, terminate current flow process.
After in the internal memory being associated with business reading operation that above-mentioned steps 302 is determined, the business demand of this data association can be known based on the data in this internal memory, judge whether these data again can be accessed within the T1 time according to the business demand associated by these data, if, then perform step 304, if not, then mean that these data again can not be accessed within the T1 time, then above-mentioned determining can be recovered at any time with the business reading internal memory that is associated of operation, terminates current flow process.
Step 304, for this internal memory determined arranges time parameter value.
So far, complete the flow process shown in Fig. 3.
Can be found out by the flow process shown in Fig. 3, in the present invention, after receiving business reading operation, can judge whether the internal memory that business reading operation is associated arranges time parameter value, being judged by this kind can selectively as internal memory arranges time parameter value, can ensure to be provided with the internal memory of time parameter value, it can retain data for some time wherein (time parameter value), the data in internal memory are avoided to be released recovery at any time, improve the probability of follow-up business hit internal memory, the reading performance of effective raising business and Operational Visit efficiency.
Embodiment 3:
In the present embodiment 3, for the internal memory setup times time parameter value of the satisfied setting condition estimated out can comprise flow process shown in Fig. 4 in step 101:
See step 101 flowchart that Fig. 4, Fig. 4 are the embodiment of the present invention 3 offer. In actual applications, this flow process is generally be applied in the control application program of cache. As shown in Figure 4, this flow process can comprise the following steps:
According to business demand, step 401, when performing pre-rdma read, judges whether the data in this internal memory read in advance are again accessed in described T1, if it does, perform step 402, if not, terminate current flow process.
Usually, the control application program of cache can be done bottom according to service needed and pre-read, when performing pre-rdma read, the business demand of this data association can be known for the data in the internal memory read in advance, judge whether these data again can be accessed within the T1 time according to the business demand associated by these data, if, then perform step 402, if not, then mean that these data again can not be accessed within the T1 time, can be recovered at any time, terminate current flow process.
Step 402, for this internal memory read in advance arranges time parameter value.
It should be noted that, in the present embodiment 3, when, after execution of step 402, also performing following step further:
Step a1, when the internal memory read in advance being detected by first visit, the time parameter value maintaining this internal memory read in advance is constant, when detecting that the internal memory read in advance is accessed for the second time, refreshes the time parameter value of this internal memory read in advance.
Here, step a1, step a2 is specifically by realizing taking under type: after arranging time parameter value as the internal memory read in advance, for this internal memory read in advance, access times are set, the initial value of access times is 0, afterwards, when the internal memory read in advance is accessed again, the access times of this internal memory are added 1, when the result obtained after the access times of internal memory add 1 is 2, just refresh the time parameter value that internal memory is set up, and the access times upgrading internal memory are 0, and the result obtained after the access times of internal memory add 1 is not when being 2, the time parameter value maintaining this internal memory read in advance is constant.
So far, complete the flow process shown in Fig. 4.
Can be found out by the flow process shown in Fig. 4, in the present invention, when carrying out internal memory and pre-read, can judge whether the internal memory read in advance arranges time parameter value, being judged by this kind can selectively as internal memory arranges time parameter value, can ensure to be provided with the internal memory of time parameter value, it can retain data for some time wherein (time parameter value), the data in internal memory are avoided to be released recovery at any time, improve the probability of follow-up business hit internal memory, the reading performance of effective raising business and Operational Visit efficiency.
It should be noted that, in the present invention, as a preferred embodiment, when arranging time parameter value for internal memory, can simultaneously with reference to above-mentioned three embodiments.
Also it should be noted that, in the present invention, in above-described embodiment 1 or embodiment 2, when, after arranging time parameter value for internal memory, arranging access times for this internal memory, the initial value of access times is 0. Afterwards, when the internal memory being set up time parameter value is accessed again, the access times of this internal memory are added 1, when the result obtained is 2, just refresh the time parameter value that internal memory is set up, and the access times upgrading internal memory are 0 after the access times of internal memory add 1.
Above method provided by the invention is described. Below device provided by the invention is described:
It is structure drawing of device provided by the invention see Fig. 5, Fig. 5. As shown in Figure 5, this device can comprise:
Estimating unit, for the internal memory setup times time parameter value of the satisfied setting condition for estimating out, described setting condition is: the data of write are accessed in setting-up time T1; Described T1 is less than or equals described time parameter value;
Memory recycle control unit, for when carrying out Memory recycle, the time parameter value of detection internal memory, if time parameter value internal memory being detected expires, then reclaims internal memory, if time parameter value internal memory being detected is also not yet due, then forbids Memory recycle.
Preferably, estimate the internal memory setup times time parameter value that unit is the satisfied setting condition estimated out described in comprise:
When receiving business write operation, it is determined that with the internal memory that described business write operation is associated, write data according to described write operation in this internal memory determined;
Judge whether the data in this internal memory determined again are accessed in described T1 according to business demand,
If it does, arrange time parameter value for this internal memory determined.
Preferably, estimate the internal memory setup times time parameter value that unit is the satisfied setting condition estimated out described in comprise:
When receiving business reading operation, it is determined that operate the internal memory being associated with described business reading;
Judge whether the data in this internal memory determined again are accessed in described T1 according to business demand,
If it does, arrange time parameter value for this internal memory determined.
Preferably, estimate the internal memory setup times time parameter value that unit is the satisfied setting condition estimated out described in comprise:
When performing pre-rdma read, judge whether the data in this internal memory read in advance are again accessed in described T1 according to business demand,
If it does, arrange time parameter value for this internal memory read in advance.
Preferably, described in estimate unit further when the internal memory read in advance being detected by first visit, the time parameter value maintaining this internal memory read in advance is constant; And, when detecting that the internal memory read in advance is accessed for the second time, refresh the time parameter value of this internal memory read in advance.
So far, complete the unit describe shown in Fig. 5.
The foregoing is only the better embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment of making, equivalent replacement, improvement etc., all should be included within the scope of protection of the invention.