CN106354667B - A kind of buffer control method and device of solid state hard disk - Google Patents

A kind of buffer control method and device of solid state hard disk Download PDF

Info

Publication number
CN106354667B
CN106354667B CN201610782423.2A CN201610782423A CN106354667B CN 106354667 B CN106354667 B CN 106354667B CN 201610782423 A CN201610782423 A CN 201610782423A CN 106354667 B CN106354667 B CN 106354667B
Authority
CN
China
Prior art keywords
total amount
hard disk
solid state
predetermined value
state hard
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.)
Active
Application number
CN201610782423.2A
Other languages
Chinese (zh)
Other versions
CN106354667A (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.)
Inspur Beijing Electronic Information Industry Co Ltd
Original Assignee
Inspur Beijing Electronic Information Industry 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 Inspur Beijing Electronic Information Industry Co Ltd filed Critical Inspur Beijing Electronic Information Industry Co Ltd
Priority to CN201610782423.2A priority Critical patent/CN106354667B/en
Publication of CN106354667A publication Critical patent/CN106354667A/en
Application granted granted Critical
Publication of CN106354667B publication Critical patent/CN106354667B/en
Active 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/12Replacement control
    • G06F12/121Replacement control using replacement algorithms
    • G06F12/123Replacement control using replacement algorithms with age lists, e.g. queue, most recently used [MRU] list or least recently used [LRU] list
    • 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/0893Caches characterised by their organisation or structure
    • G06F12/0897Caches characterised by their organisation or structure with two or more cache hierarchy levels
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1032Reliability improvement, data loss prevention, degraded operation etc
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/22Employing cache memory using specific memory technology
    • G06F2212/222Non-volatile memory

Landscapes

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

Abstract

The invention discloses a kind of buffer control method of solid state hard disk and devices, comprising: to add current time stamp to cache file, and is inserted into leveldb database;Total amount of data in leveldb database is added 1, the target accumulated amount with current time stamp is added 1;Judge whether target accumulated amount is greater than first predetermined value;If it is greater than first predetermined value, then new timestamp is inserted into as current time stamp;Otherwise, judge whether current data total amount is greater than second predetermined value;If it is, deleting cache file corresponding with earliest time stamp, and update current data total amount.Therefore, it deletes cache file to be determined by the total amount of data in current database, and deletion is cache file corresponding with earliest time stamp, it is smoothly horizontal to maintain a comparison with this utilization rate that solid state hard disk is effectively ensured, and is less prone to biggish fluctuation.Furthermore it is possible to realize that batch is deleted, the working efficiency of caching is improved.

Description

A kind of buffer control method and device of solid state hard disk
Technical field
The present invention relates to technical field of data storage, more particularly to the buffer control method and dress of a kind of solid state hard disk It sets.
Background technique
In technical field of data storage, especially distributed storage, large batch of reading file is needed, if direct slave The reading of tool hard disk then causes elapsed time too long, and therefore, existing method is usually by the data buffer storage in mechanical hard disk to admittedly Leveldb database in state hard disk then directly takes out from solid state hard disk when needing to read, then is read by memory It takes.
Since the effect of solid state hard disk is L2 cache, the utilization rate of solid state hard disk is extremely important, if solid-state is hard There is a large amount of useless data in disk, then when needing new data buffer storage, the inadequate buffer space of solid state hard disk, by This is as it can be seen that the utilization rate for improving solid state hard disk is extremely important.
In the prior art, in order to improve the utilization rate of solid state hard disk, usual way is in leveldb database One TTL of data setting (Time To Live), to define the life cycle of data.But the program has corresponding disadvantage End, because the quantity of the data of write-in leveldb database is uneven in section in different times, if setting data TTL then cannot adequately utilize the memory space of L2 cache, therefore also will receive corresponding influence in efficiency.For example: If being written with 99w small documents data altogether within the period of time1,1w small documents being written in the period of time2 Data.The utilization rate of solid state hard disk reaches 100% at this time, then solid state hard disk cannot be re-used as L2 cache and carry out data write-in, Only wait until that the lifetime of write-in data in the time1 time terminates, the utilization rate of disk is 1% at this time.It can be seen by example Out, the solution at present in industry prevent the utilization rate of solid state hard disk from it is constant in a certain range, but up and down fluctuation Seriously, seriously cause solid state hard disk that cannot adequately utilize, or even will appear disk utilization rate and reach 100%.
It can be seen that how to keep the stability of solid state hard disk utilization rate is that those skilled in the art ask urgently to be resolvedly Topic.
Summary of the invention
The object of the present invention is to provide a kind of buffer control methods of solid state hard disk, for keeping solid state hard disk utilization rate Stability.
In order to solve the above technical problems, the present invention provides a kind of buffer control method of solid state hard disk, comprising:
To add the current time stamp in leveldb database to cache file, and to include in document number and file The format of appearance is inserted into the leveldb database;
Total amount of data in the leveldb database is added 1, will there is current time in the leveldb database The target accumulated amount of stamp adds 1;
Judge whether the target accumulated amount is greater than first predetermined value;
If the target accumulated amount is greater than the first predetermined value, be inserted into new timestamp, and will be described new when Between stamp be used as current time stamp;
If the target accumulated amount is not more than the first predetermined value, judge whether current data total amount is greater than second Predetermined value;
If current data total amount is greater than the second predetermined value, deletion is corresponding with earliest time stamp to have cached text Part, and update current data total amount;
Wherein, second predetermined value is that the solid state hard disk reaches total amount of data corresponding to predetermined utilization rate for the first time.
Preferably, further includes: record each timestamp in presently described leveldb database, and record each timestamp With the corresponding relationship of corresponding cache file.
Preferably, cache file corresponding with earliest time stamp is deleted described, and it is specific to update current data total amount Are as follows:
The reading times that the earliest time stabs corresponding each cache file are counted, it is more than predetermined for filtering out reading times The timestamp of these cache files is changed to current time stamp by the cache file of number;Reading times are less than described pre- The cache file for determining number is deleted, and updates current data total amount.
Preferably, the update current data total amount specifically includes:
Count the data volume that the reading times are less than the cache file of the pre-determined number;
Current data total amount is subtracted into the data volume;
Delete the earliest time stamp.
Preferably, further includes: by each timestamp in presently described leveldb database and each timestamp with it is corresponding The corresponding relationship of cache file is loaded onto memory.
Preferably, the document number is the corresponding Hash remainder value of original document number.
Preferably, further includes: when receiving removal request, according to the removal request in the leveldb database It is middle to delete corresponding cache file, and update the leveldb database.
Preferably, the predetermined utilization rate is 80%.
Preferably, the second predetermined value is the 80% of the solid state hard disk total amount.
In order to solve the above technical problems, the present invention provides a kind of buffer control device of solid state hard disk, comprising:
Adding unit, for add the current time stamp in leveldb database to cache file, and to include text The format of piece number and file content is inserted into the leveldb database;
Computing unit will be in the leveldb database for the total amount of data in the leveldb database to be added 1 Target accumulated amount with current time stamp adds 1;
First judging unit, for judging whether the target accumulated amount is greater than first predetermined value;
It is inserted into unit, if being greater than the first predetermined value for the target accumulated amount, is inserted into new timestamp, and Using the new timestamp as current time stamp;
Second judgment unit judges current number if being not more than the first predetermined value for the target accumulated amount Whether it is greater than second predetermined value according to total amount;
Updating unit is deleted and earliest time stamp pair if being greater than the second predetermined value for current data total amount The cache file answered, and update current data total amount;
Wherein, second predetermined value is that the solid state hard disk reaches total amount of data corresponding to predetermined utilization rate for the first time.
The buffer control method and device of solid state hard disk provided by the present invention, comprising: to be added to cache file Current time stamp in leveldb database, and to include that the format of document number and file content is inserted into leveldb data In library;Total amount of data in leveldb database is added 1, will there is the target accumulated of current time stamp in leveldb database Amount plus 1;Judge whether target accumulated amount is greater than first predetermined value;If target accumulated amount is greater than first predetermined value, insertion is new Timestamp, and using new timestamp as current time stamp;If target accumulated amount is not more than first predetermined value, judgement is worked as Whether preceding total amount of data is greater than second predetermined value;If current data total amount is greater than second predetermined value, deletion and earliest time Corresponding cache file is stabbed, and updates current data total amount.It is not due to it will be apparent that deleting cache file in this method The life cycle of cache file arrives, but determined by the total amount of data in current database, i.e., it ought reach the of setting When two predetermined values, just need to delete cache file, and second predetermined value reaches predetermined utilization rate institute for solid state hard disk for the first time Corresponding total amount of data, therefore cache file is deleted for the first time by whether reaching the predetermined utilization rate of solid state hard disk and determining, simultaneously Record total amount of data at this time as the total amount of data upper limit, hereafter delete cache file by the total amount of data in current database It determines.More importantly deletion is cache file corresponding with earliest time stamp, a timestamp is corresponding have been cached File can be set, and therefore, the utilization rate of solid state hard disk can be effectively ensured, and to maintain a comparison smoothly horizontal, no Easily there is biggish fluctuation.In addition, multiple cache files can have and stab at the same time, it is thereby achieved that batch is deleted It removes, improves the working efficiency of caching.
Detailed description of the invention
In order to illustrate the embodiments of the present invention more clearly, attached drawing needed in the embodiment will be done simply below It introduces, it should be apparent that, drawings in the following description are only some embodiments of the invention, for ordinary skill people For member, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of flow chart of the buffer control method of solid state hard disk provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic diagram of buffer memory structure provided in an embodiment of the present invention;
Fig. 3 is a kind of structure chart of the buffer control device of solid state hard disk provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, rather than whole embodiments.Based on this Embodiment in invention, those of ordinary skill in the art are without making creative work, obtained every other Embodiment belongs to the scope of the present invention.
Core of the invention is to provide the buffer control method and device of a kind of solid state hard disk.
In order to enable those skilled in the art to better understand the solution of the present invention, with reference to the accompanying drawings and detailed description The present invention is described in further detail.
Fig. 1 is a kind of flow chart of the buffer control method of solid state hard disk provided in an embodiment of the present invention.As shown in Figure 1, Include:
S10: to add the current time stamp in leveldb database to cache file, and to include document number and text The format of part content is inserted into leveldb database.
S11: adding 1 for the total amount of data in leveldb database, will have current time stamp in leveldb database Target accumulated amount adds 1.
S12: judge whether target accumulated amount is greater than first predetermined value.
If so, S13 is entered step, if not, entering step S14.
S13: it is inserted into new timestamp, and using new timestamp as current time stamp.
S14: judge whether current data total amount is greater than second predetermined value.If so, entering step S15.
S15: cache file corresponding with earliest time stamp is deleted, and updates current data total amount.
Wherein, second predetermined value is that solid state hard disk reaches total amount of data corresponding to predetermined utilization rate for the first time.
Data are orderly to store from small to large in the form of (key, value) data pair according to key in Leveldb database , use document number as key in the present invention, using file content as value.For the ease of deleting unused data for a long time, That is the data of aging, thus we each file be inserted into leveldb database when, to this document plus a timestamp.It can With understanding, this timestamp simply indicates that the temporal information that leveldb database is added to cache file, in addition, not Timestamp with cache file may be the same or different, i.e., multiple cache files can have identical timestamp.When Between the setting stabbed can be as accurate as the second, user can carry out precision set according to the storage condition of itself.
In specific implementation, there is the quantity of file stabbed at the same time to be known as cumulant, on this cumulant also has Limit, i.e., first predetermined value described above.Target accumulated amount is intended merely to distinguish the cumulant for currently needing to count and remaining Cumulant, there is no substantive meanings.First predetermined value may be set according to actual conditions, it is to be understood that if setting It is smaller, then more can guarantee solid state hard disk utilization rate stationarity (because, if first predetermined value is set as 1000, When having arrived step S15, it is necessary to delete 1000 cache files if first predetermined value is set as 100 and arrive step When S15, it is necessary to delete 100 cache files).But first predetermined value is also not the smaller the better, if too small, needs More timestamp needs constantly to be inserted into new timestamp, cause the amount for once deleting cache file less, need more Secondary deletion.
Because there is cache file write-in, total amount of data needs to add 1, for example, current data total amount is 9999, then writes After entering this cache file, total amount of data is changing to 10000.If current time stamp is 201606031556, this document Timestamp be exactly 201606031556.It is understood that may be first for timestamp 201606031556 A timestamp may not also be first timestamp, and if not first timestamp, then the timestamp of the front is exactly 201606031555,201606031554 etc..Multiple cache files can have identical timestamp, for example, timestamp For 201606031556 corresponding document numbers since 1001, the corresponding document number of timestamp 201606031555 is 1-1000.Very Obviously, the cache file of document number 1-1000 timestamp having the same, if total amount of data reaches the second predetermined value of setting, It then needs to delete some cache files.Since each cache file has a timestamp, if a timestamp is corresponding Cache file is exactly that batch deletes cache file in fact.It is also continued to explain with above example, if timestamp 201606031555 be earliest time stamp in current database, then deletes earliest time and stab corresponding cache file, exactly delete Except the cache file of document number 1-1000.It should be noted that earliest time stamp mentioned in the present invention is opposite, it is current That timestamp relatively earliest in each timestamp in database.
Since second predetermined value is that solid state hard disk reaches total amount of data corresponding to predetermined utilization rate for the first time, it can understand Are as follows: cache file is deleted for the first time by whether reaching the predetermined utilization rate of solid state hard disk and determining that the corresponding data of the utilization rate are total Whether amount is used as the upper limit, that is, second predetermined value, hereafter delete cache file and determined by the total amount of data in current database, i.e., It is determined more than second predetermined value.
The buffer control method of solid state hard disk provided in this embodiment, to be added in leveldb database to cache file Current time stamp, and to include that the format of document number and file content is inserted into leveldb database;By leveldb Total amount of data in database adds 1, and the target accumulated amount in leveldb database with current time stamp is added 1;Judge target Whether cumulant is greater than first predetermined value;If target accumulated amount is greater than first predetermined value, it is inserted into new timestamp, and will be new Timestamp as current time stamp;If target accumulated amount is not more than first predetermined value, whether current data total amount is judged Greater than second predetermined value;If current data total amount is greater than second predetermined value, cached corresponding with earliest time stamp is deleted File, and update current data total amount.It will be apparent that deleting the life that cache file is not due to cache file in this method The life period arrives, but determined by the total amount of data in current database, i.e., when reaching the second predetermined value of setting, just need Cache file is deleted, and second predetermined value is that solid state hard disk reaches total amount of data corresponding to predetermined utilization rate for the first time, Therefore cache file is deleted for the first time by whether reaching the predetermined utilization rate of solid state hard disk and determining, while the data of record at this time are total Amount is used as the total amount of data upper limit, hereafter deletes cache file and is determined by the total amount of data in current database.Even more important It is that deletion is cache file corresponding with earliest time stamp, and the corresponding cache file of a timestamp is can to set , therefore, the utilization rate of solid state hard disk can be effectively ensured, and to maintain a comparison smoothly horizontal, is less prone to biggish wave It is dynamic.In addition, multiple cache files can have and stab at the same time, it is thereby achieved that batch is deleted, the work of caching is improved Make efficiency.
In the above-described embodiments, buffer control process needs know the cumulant stabbed at the same time, it is also necessary to know most Early timestamp and current time stamp.It is counted for the ease of facilitating, in the present embodiment further include: record current leveldb database In each timestamp, and record the corresponding relationship of each timestamp with corresponding cache file.
Fig. 2 is a kind of schematic diagram of buffer memory structure provided in an embodiment of the present invention.For those skilled in the art's energy It is enough more to understand buffer control method provided by the invention, a kind of schematic diagram of buffer memory structure is provided, sees Fig. 2.Inode1, Inode2, Inode3 etc. indicate document number, and value1, value2, value3 etc. indicate file content, with (inode, value) It is cached as storage form.
In specific implementation, it can be used to store to the form of database and record each timestamp in current leveldb database, And record the corresponding relationship of each timestamp with corresponding cache file, i.e., record result is inserted into leveldb data Library.Timestamp, which is expressed as (time+inode, NULL) NULL with the corresponding relationship of corresponding cache file, indicates empty data, does not have Have substantive content, institute using such form be the memory requirement for meeting leveldb database.Likewise, current leveldb number Be inserted into leveldb database according to timestamp each in library in (time, NULL) form, leveldb can according to time to its into The orderly arrangement of row.Since the storage of the data in leveldb database is orderly stored according to the size order of key.Cause This above three classes data (time, NULL), (time+inode, NULL) and (inode, value) can be by adding prefix The form of aa_, bb_, cc_ are distinguish and sort, as shown in Figure 2.
In solid state hard disk cache file needs read by memory, if one cache file reading frequency compared with Height, but in buffer control, the timestamp of this document becomes earliest time in current leveldb database and stabs, if be not added With screening, then the more cache file of this reading times will be deleted.
In order to solve this problem, as preferred embodiment, corresponding with earliest time stamp text has been cached deleting Part, and update current data total amount specifically:
Statistics earliest time stabs the reading times of corresponding each cache file, filters out reading times more than pre-determined number Cache file, the timestamp of these cache files is changed to current time stamp;Reading times are less than pre-determined number Cache file is deleted, and updates current data total amount.
Such as current earliest time stamp is 201606031555, corresponding 1000 files of the timestamp, this 1000 files There is its reading times, filter out the file that reading times are greater than pre-determined number, such as file 1- file 5, then by file 1- text The timestamp of part 5 is changed to current time stamp;File 6- file 1000 is deleted, and updates current data total amount.It is understood that If the timestamp of file 1- file 5 is changed to current time stamp, current time stamp and file 1- file are also recorded 5 corresponding relationship;And since file 1- file 5 is not deleted really, but remained as protected object, because This nor affects on the total amount of data of leveldb database, and this embodiment is not repeated.
As preferred embodiment, update current data total amount and specifically include: statistics reading times are less than predetermined time Current data total amount is subtracted data volume by the data volume of several cache files, deletes earliest time stamp.
In the above-described embodiments, the premise for updating current data total amount is that reading times are less than the slow of pre-determined number File is deposited as object is deleted, since these cache files will be really deleted, it is therefore desirable to which current data total amount is subtracted number According to amount, earliest time stamp is deleted.For example, file 6- file 1000 is deleted, corresponding data volume is exactly 955.
Preferably embodiment, further includes: by each timestamp and each timestamp in current leveldb database It is loaded onto memory with the corresponding relationship of corresponding cache file.
In being embodied again, memory needs repeatedly to read the file in leveldb database, above- mentioned information is loaded onto interior In depositing, is conducive to memory and quickly reads.This embodiment is not repeated for specific reading process.
Preferably embodiment, document number are the corresponding Hash remainder value of original document number.
It is inconvenient if being indicated with serial data since original document number is usually longer serial data, this implementation It takes the corresponding Hash remainder value of original document number as respective document number in example, sees and obtain data structure in Fig. 2.
Preferably embodiment, further includes: when receiving removal request, according to removal request in leveldb number According to deleting corresponding cache file in library, and update leveldb database.
For solid state hard disk, include not only writing process, further include deletion process, deletes process and writing process is former Manage identical, detailed process are as follows: corresponding cache file is found according to removal request, this document is deleted, judges whether to delete Success, if it is not, then explanation needs to repeat aforesaid operations without deleting successfully.If deleted successfully, judge that this document is corresponding Timestamp whether be newest timestamp, if it is newest timestamp, then judge that the newest timestamp is this corresponding file, If it is, subtracting 1 as current time stamp for newest timestamp.If not newest timestamp, then also need to delete the time The corresponding relationship of stamp and this document, and the total amount of data in leveldb database is subtracted 1.
Preferably embodiment, first predetermined value 1000.It is understood that first predetermined value is for 1000 A kind of specific embodiment does not represent and there was only a kind of this embodiment.
Preferably embodiment, predetermined utilization rate are 80%.Therefore, second predetermined value is to reach solid state hard disk for the first time Total amount of data corresponding to the 80% of utilization rate.For example, it is total to reach data corresponding to the 80% of solid state hard disk utilization rate for the first time Amount is 100,000, then second predetermined value is exactly 100,000.It is understood that predetermined utilization rate is 80% only a kind of specific Embodiment does not represent and there was only a kind of this embodiment.
Fig. 3 is a kind of structure chart of the buffer control device of solid state hard disk provided in an embodiment of the present invention.As shown in figure 3, The buffer control device of solid state hard disk, comprising:
Adding unit 10, for add the current time stamp in leveldb database to cache file, and to include The format of document number and file content is inserted into leveldb database.
Computing unit 11 is worked as the total amount of data in leveldb database to be added 1 by having in leveldb database The target accumulated amount of preceding timestamp adds 1.
First judging unit 12, for judging whether target accumulated amount is greater than first predetermined value.
It is inserted into unit 13, if being greater than first predetermined value for target accumulated amount, is inserted into new timestamp, and will be new Timestamp is as current time stamp.
Second judgment unit 14 judges current data total amount if being not more than first predetermined value for target accumulated amount Whether second predetermined value is greater than.
Updating unit 15 is deleted corresponding with earliest time stamp if being greater than second predetermined value for current data total amount Cache file, and update current data total amount.
Wherein, second predetermined value is that solid state hard disk reaches total amount of data corresponding to predetermined utilization rate for the first time.
Since the embodiment of device part is corresponded to each other with the embodiment of method part, the embodiment of device part is asked Referring to the description of the embodiment of method part, wouldn't repeat here.
The buffer control device of solid state hard disk provided in this embodiment, comprising: adding unit, for add to cache file Add the current time stamp in leveldb database, and to include described in the format of document number and file content is inserted into In leveldb database;Computing unit, for the total amount of data in the leveldb database to be added 1, by the leveldb Target accumulated amount in database with current time stamp adds 1;First judging unit, for whether judging the target accumulated amount Greater than first predetermined value;It is inserted into unit, if being greater than the first predetermined value for the target accumulated amount, when being inserted into new Between stab, and using the new timestamp as current time stamp;Second judgment unit, if little for the target accumulated amount In the first predetermined value, then judge whether current data total amount is greater than second predetermined value;Updating unit, if being used for current number It is greater than the second predetermined value according to total amount, then deletes cache file corresponding with earliest time stamp, and it is total to update current data Amount.It is arrived it will be apparent that deleting the life cycle that cache file has been not due to cache file in the present apparatus, but by current What the total amount of data in database determined, i.e., when reaching the second predetermined value of setting, just need to delete cache file, more Importantly, what is deleted is cache file corresponding with earliest time stamp, the corresponding cache file of a timestamp is can With setting, therefore, the utilization rate of solid state hard disk can be effectively ensured, and to maintain a comparison smoothly horizontal, be less prone to compared with Big fluctuation.In addition, multiple cache files can have and stab at the same time, it is thereby achieved that batch is deleted, improve slow The working efficiency deposited.
The buffer control method and device of solid state hard disk provided by the present invention are described in detail above.Specification In each embodiment be described in a progressive manner, the highlights of each of the examples are it is different from other embodiments it Place, the same or similar parts in each embodiment may refer to each other.For the device disclosed in the embodiment, due to itself and reality It is corresponding to apply method disclosed in example, so being described relatively simple, reference may be made to the description of the method.It should refer to It out, for those skilled in the art, without departing from the principle of the present invention, can also be to the present invention Some improvement and modification can also be carried out, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Professional further appreciates that, unit described in conjunction with the examples disclosed in the embodiments of the present disclosure And algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These Function is implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Profession Technical staff can use different methods to achieve the described function each specific application, but this realization is not answered Think beyond the scope of this invention.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can directly be held with hardware, processor The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology In any other form of storage medium well known in field.

Claims (10)

1. a kind of buffer control method of solid state hard disk characterized by comprising
To add the current time stamp in leveldb database to cache file, and to include document number and file content Format is inserted into the leveldb database;
Total amount of data in the leveldb database is added 1, will there is current time stamp in the leveldb database The target accumulated amount of cache file adds 1;
Judge whether the target accumulated amount is greater than first predetermined value;
If the target accumulated amount is greater than the first predetermined value, it is inserted into new timestamp, and by the new timestamp As current time stamp;
If the target accumulated amount is not more than the first predetermined value, it is predetermined to judge whether current data total amount is greater than second Value;
If current data total amount is greater than the second predetermined value, cache file corresponding with earliest time stamp is deleted, and Update current data total amount;
Wherein, second predetermined value is that the solid state hard disk reaches total amount of data corresponding to predetermined utilization rate for the first time.
2. the buffer control method of solid state hard disk according to claim 1, which is characterized in that further include: record current institute Each timestamp in leveldb database is stated, and records the corresponding relationship of each timestamp with corresponding cache file.
3. the buffer control method of solid state hard disk according to claim 2, which is characterized in that it is described deletion with it is earliest when Between stab corresponding cache file, and update current data total amount specifically:
The reading times that the earliest time stabs corresponding each cache file are counted, filter out reading times more than pre-determined number Cache file, the timestamp of these cache files is changed to current time stamp;Reading times are less than described predetermined time Several cache files is deleted, and updates current data total amount.
4. the buffer control method of solid state hard disk according to claim 3, which is characterized in that the update current data is total Measurer body includes:
Count the data volume that the reading times are less than the cache file of the pre-determined number;
Current data total amount is subtracted into the data volume;
Delete the earliest time stamp.
5. the buffer control method of solid state hard disk according to claim 2, which is characterized in that further include: it will be presently described Each timestamp and each timestamp are loaded onto memory with the corresponding relationship of corresponding cache file in leveldb database In.
6. the buffer control method of solid state hard disk according to claim 5, which is characterized in that the document number is original text The corresponding Hash remainder value of piece number.
7. according to claim 1 to the buffer control method of solid state hard disk described in 6 any one, which is characterized in that further include:
When receiving removal request, corresponding cached is deleted in the leveldb database according to the removal request File, and update the leveldb database.
8. the buffer control method of solid state hard disk according to claim 1, which is characterized in that the first predetermined value is 1000。
9. the buffer control method of solid state hard disk according to claim 1, which is characterized in that the predetermined utilization rate is 80%.
10. a kind of buffer control device of solid state hard disk characterized by comprising
Adding unit, for add the current time stamp in leveldb database to cache file, and to include document number It is inserted into the leveldb database with the format of file content;
Computing unit will have for the total amount of data in the leveldb database to be added 1 in the leveldb database The target accumulated amount of the cache file of current time stamp adds 1;
First judging unit, for judging whether the target accumulated amount is greater than first predetermined value;
It is inserted into unit, if being greater than the first predetermined value for the target accumulated amount, is inserted into new timestamp, and by institute New timestamp is stated as current time stamp;
Second judgment unit judges that current data is total if being not more than the first predetermined value for the target accumulated amount Whether amount is greater than second predetermined value;
Updating unit is deleted corresponding with earliest time stamp if being greater than the second predetermined value for current data total amount Cache file, and update current data total amount;
Wherein, second predetermined value is that the solid state hard disk reaches total amount of data corresponding to predetermined utilization rate for the first time.
CN201610782423.2A 2016-08-30 2016-08-30 A kind of buffer control method and device of solid state hard disk Active CN106354667B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610782423.2A CN106354667B (en) 2016-08-30 2016-08-30 A kind of buffer control method and device of solid state hard disk

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610782423.2A CN106354667B (en) 2016-08-30 2016-08-30 A kind of buffer control method and device of solid state hard disk

Publications (2)

Publication Number Publication Date
CN106354667A CN106354667A (en) 2017-01-25
CN106354667B true CN106354667B (en) 2019-03-15

Family

ID=57856909

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610782423.2A Active CN106354667B (en) 2016-08-30 2016-08-30 A kind of buffer control method and device of solid state hard disk

Country Status (1)

Country Link
CN (1) CN106354667B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021120731A1 (en) * 2019-12-18 2021-06-24 深圳大普微电子科技有限公司 Data storage method and assembly, and data processing method and assembly
CN112988040B (en) * 2019-12-18 2023-02-24 深圳大普微电子科技有限公司 Data storage method, device and equipment and readable storage medium
CN114885405A (en) * 2022-05-13 2022-08-09 江西合力泰科技有限公司 Intelligent unlocking method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103281397A (en) * 2013-06-13 2013-09-04 苏州联讯达软件有限公司 Data-caching method and system based on timestamps and access density
CN105224252A (en) * 2015-09-28 2016-01-06 北京奇虎科技有限公司 Date storage method and device
CN105446893A (en) * 2014-07-14 2016-03-30 阿里巴巴集团控股有限公司 Data storage method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8161241B2 (en) * 2010-01-12 2012-04-17 International Business Machines Corporation Temperature-aware buffered caching for solid state storage
US8868824B2 (en) * 2012-04-19 2014-10-21 Microsoft Corporation Solid-state drive management and control

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103281397A (en) * 2013-06-13 2013-09-04 苏州联讯达软件有限公司 Data-caching method and system based on timestamps and access density
CN105446893A (en) * 2014-07-14 2016-03-30 阿里巴巴集团控股有限公司 Data storage method and device
CN105224252A (en) * 2015-09-28 2016-01-06 北京奇虎科技有限公司 Date storage method and device

Also Published As

Publication number Publication date
CN106354667A (en) 2017-01-25

Similar Documents

Publication Publication Date Title
CN106354667B (en) A kind of buffer control method and device of solid state hard disk
CN104699416B (en) A kind of data-storage system and a kind of date storage method
CN107943718B (en) Method and device for cleaning cache file
CN101673192B (en) Method for time-sequence data processing, device and system therefor
CN106339324B (en) A kind of method and device selecting garbage reclamation block
CN103425663B (en) Embedded system data base establishment table, deposit record, the method and apparatus for deleting record
CN109976671A (en) A kind of reading interference processing method, device, equipment and readable storage medium storing program for executing
CN108399047B (en) Flash memory file system and data management method thereof
CN107632791A (en) The distribution method and system of a kind of memory space
CN107643880A (en) The method and device of file data migration based on distributed file system
CN109032517A (en) A kind of method, apparatus and computer readable storage medium of data rule
CN104317944B (en) A kind of timestamp dynamic adjustment concurrency control method based on formula
CN109471836A (en) Data migration method, device and system
CN107066349A (en) A kind of method and system of cluster file system data protection
CN109086462A (en) The management method of metadata in a kind of distributed file system
CN109388624A (en) Distributed document delet method, device, system and computer readable storage medium
CN110147331A (en) Caching data processing method, system and readable storage medium storing program for executing
CN109521969A (en) A kind of solid state hard disk data recovery method, device and computer readable storage medium
CN107402819A (en) The management method and system of a kind of client-cache
CN106201778A (en) Information processing method and storage device
CN107506466A (en) A kind of small documents storage method and system
CN106020717B (en) Data processing method and electronic equipment
US9959060B1 (en) Data separation during host write with storage allocated based on traffic profiles
CN109446115A (en) A kind of mapping table management method, device and computer readable storage medium
CN109324761A (en) A kind of data cache method, device, equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant