WO2011147187A1 - 多级缓存下固态硬盘的写方法及装置 - Google Patents

多级缓存下固态硬盘的写方法及装置 Download PDF

Info

Publication number
WO2011147187A1
WO2011147187A1 PCT/CN2010/080656 CN2010080656W WO2011147187A1 WO 2011147187 A1 WO2011147187 A1 WO 2011147187A1 CN 2010080656 W CN2010080656 W CN 2010080656W WO 2011147187 A1 WO2011147187 A1 WO 2011147187A1
Authority
WO
WIPO (PCT)
Prior art keywords
hdd
content
heat
ssd
load
Prior art date
Application number
PCT/CN2010/080656
Other languages
English (en)
French (fr)
Inventor
陈骞
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201080003686XA priority Critical patent/CN102203749B/zh
Priority to PCT/CN2010/080656 priority patent/WO2011147187A1/zh
Publication of WO2011147187A1 publication Critical patent/WO2011147187A1/zh

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/0893Caches characterised by their organisation or structure
    • G06F12/0897Caches characterised by their organisation or structure with two or more cache hierarchy levels

Definitions

  • the present invention relates to storage technologies, and in particular, to a method and an apparatus for writing a solid state hard disk under a multi-level cache. Background technique
  • the Solid State Driver has better input and output (10) performance than the Hard Disk Driver (HDD), and the delay is lower, and the SSD has other advantages.
  • the lifetime of the SSD is limited by the number of write erases of the SSD.
  • SLC single-level cell
  • MLC multi-level cell
  • a 32GB MLC SSD can write up to 32*10,000 data of about 32TB. After writing so much data at most, the SSD will be invalid.
  • the number of HDD readings and writes has little effect on the lifetime of the HDD.
  • the life of the HDD is more susceptible to environmental temperature and vibration.
  • the caching service caches hotspot content on an edge server that is closer to the user.
  • the key to caching is the cache replacement algorithm.
  • the cache replacement algorithm refers to the principle of content replacement when the cache space is full. It implements the hot content of the cache and replaces the colder content. The hot and cold content is changing with time, and the new content is constantly being injected and constantly changing. Therefore, the cached storage medium is constantly writing and deleting data.
  • a multi-level cache can be formed, which is composed of an SSD and an HDD.
  • the hot content in the SSD With the high performance of the SSD, less hot content can be stored in the HDD to reduce costs.
  • the cache replacement algorithm the content that needs to enter the cache first enters the HDD, and the coldest content in the HDD is eliminated.
  • the embodiment of the invention provides a method and a device for writing a solid state hard disk in a multi-level cache to reduce the cost.
  • An embodiment of the present invention provides a method for writing a solid state hard disk under a multi-level cache, including: acquiring an input/output 10 load value of the HDD and acquiring a load threshold;
  • the HDD is The highest-heat content is written into the SSD, and the content of the lowest heat in the SSD is written into the HDD to perform content exchange between the SSD and the HDD.
  • the embodiment of the present invention provides a write device for a solid state hard disk under a multi-level cache, comprising: an ear block for acquiring an input/output 10 load value of the HDD and acquiring a load threshold; and a first interchange module, if The highest heat of the content in the HDD in the multi-level cache exceeds the lowest heat of the content in the SSD in the multi-level cache, and the 10 load value of the HDD is greater than or equal to the 10 load threshold, and the highest in the HDD The content of the heat is written into the SSD, and the content of the lowest heat in the SSD is written into the HDD to perform the exchange of the contents in the SSD and the HDD.
  • the embodiment of the present invention considers not only the heat factor but also the 10 load value of the HDD in the process of content exchange between the SSD and the HDD.
  • the load value is greater than or equal to 10 load thresholds
  • the SSD is written.
  • the write operation to the SSD is performed, which can reduce the write operation to the SSD and reduce the cost.
  • FIG. 1 is a schematic flow chart of a method according to a first embodiment of the present invention
  • FIG. 2 is a schematic flow chart of a method according to a second embodiment of the present invention.
  • FIG. 3 is a schematic flow chart of a method according to a third embodiment of the present invention.
  • FIG. 4 is a schematic diagram of arrangement of content heat in an SSD and an HDD according to an embodiment of the present invention
  • FIG. 5 is a schematic flowchart of a method according to a fourth embodiment of the present invention.
  • FIG. 6 is a schematic flow chart of a method according to a fifth embodiment of the present invention.
  • FIG. 7 is a schematic structural view of a device according to a sixth embodiment of the present invention. detailed description
  • FIG. 1 is a schematic flowchart of a method according to a first embodiment of the present invention, including:
  • Step 11 Obtain the 10 load value of the HDD and obtain the 10 load threshold.
  • the 10 load threshold may be a preset fixed value, for example, 80%.
  • the 10 load threshold may also be a dynamically acquired value, that is, the 10 load threshold is dynamically calculated according to the load value of the HDD in a certain period of time.
  • Step 12 If the highest heat content of the content in the HDD in the multi-level cache exceeds the multi-level The lowest heat of the content in the SSD in the cache, and the 10 load value of the HDD is greater than or equal to the 10 load threshold, and the content of the highest heat in the HDD is written into the SSD, and the lowest heat in the SSD is Content is written into the HDD to exchange content in the SSD and HDD.
  • FIG. 2 is a schematic flowchart of a method according to a second embodiment of the present invention.
  • the load threshold is a fixed value.
  • the embodiment includes:
  • Step 21 Determine that the highest heat of content in the HDD exceeds the minimum heat of the content in the SSD.
  • the heat content of each content in the HDD or the SSD can be determined according to the amount of clicks, for example, the content with a high click volume is hot.
  • Step 22 Obtain the current 10 load value of the HDD.
  • the 10 load value of the HDD can be obtained through the iostat-x command in the shell.
  • the 10 load value of the HDD can also be obtained through the API interface provided by the system.
  • the load information of the disk can be obtained through the shell command iostat-x.
  • the %1! field reflects the overall load of the current disk/partition.
  • the following example shows that there are 5 disks in the system. C0d0 ⁇ c0d4, the 10 load value of cOdO is 29.47%, and the 10 load value of c0d4 is 12.37%:
  • Step 23 Determine whether the current 10 load value is greater than or equal to a preset threshold. If yes, go to step 24, otherwise, go to step 25.
  • the value of the %util field reaches 70% and 80%, indicating that the disk load is high, so you can set the HDD's 10 threshold to a higher value, such as 80%.
  • Step 24 Exchange the HDD and SSD content.
  • the application module sends an indication message to the HDD and the SSD, and the indication message can cause the HDD to move the hot content to the SSD, and move the low-heat content in the SSD to the HDD to implement content exchange between the SSD and the HDD.
  • Step 25 Keep the content from moving.
  • a message indicating the movement of the content is not sent.
  • the 10-load threshold of the HDD is compared with a preset fixed value, and after the fixed value is exceeded, the SSD is written, thereby reducing the write in the SSD.
  • the number of operations extending the life of the SSD and reducing costs.
  • FIG. 3 is a schematic flowchart of a method according to a third embodiment of the present invention. This embodiment can further ensure a hit ratio. This embodiment includes:
  • Step 31 Determine that the highest heat of the content in the HDD exceeds the minimum heat of the content in the SSD; Step 32: Obtain the current 10 load value of the HDD;
  • Step 33 Determine whether the current 10 load value is greater than or equal to a preset threshold. If yes, go to step 35. Otherwise, go to step 34.
  • the HD load's 10 load threshold is set, it is possible to change the heat sorting of the content in the SSD and HDD, which may cause the tail content of the SSD (the lowest heat content) to be lower than the HDD's head content. (The hottest content). For example, referring to FIG. 4, the content on the left indicates that the heat of the SSD and the HDD are in order, and the content on the right indicates that the heat of the contents of the SSD and the HDD are out of order, wherein, in FIG. 4, the heat is A larger value indicates a higher heat.
  • the embodiment further includes the following steps:
  • Step 34 Determine whether the hot content of the SSD tail content is greater than the hot content of the HDD tail content. If yes, go to step 36. Otherwise, go to step 35.
  • Step 35 Interchange the HDD and SSD content to ensure that the content of the SSD tail is hotter than the HDD tail content.
  • the application module sends an indication message to the SSD and HDD indicating that the HDD moves the hottest content in the HDD into the SSD and instructs the SSD to move the less hot content into the HDD.
  • Step 36 Keep the content from moving.
  • the 10-load threshold of the HDD is compared with a preset fixed value, and after the fixed value is exceeded, the SSD is written, thereby reducing the number of write operations in the SSD. Extend the life of the SSD and reduce costs.
  • the heat of the tail content of the SSD and the HDD by comparing the heat of the tail content of the SSD and the HDD, after the content of the HDD tail content is greater than or equal to the heat of the SSD tail content, the content with the highest heat of the HDD is exchanged for the content with the lowest heat in the SSD, and the user can be guaranteed. Get the hit rate of the data in the cache.
  • FIG. 5 is a schematic flowchart of a method according to a fourth embodiment of the present invention.
  • the 10 load threshold is a dynamic threshold.
  • the embodiment includes:
  • Step 51 Determine that the highest heat of the content in the HDD exceeds the minimum heat of the content in the SSD.
  • Step 52 Obtain the current 10 load value of the HDD.
  • steps 51-52 For details of steps 51-52, refer to steps 21-22 of Figure 2.
  • Step 53 Acquire the load value of the HDD in a certain period of time, and obtain a dynamic 10 load threshold according to the load value of the HDD in a certain period of time.
  • the calculation formula can be as follows:
  • U thld Max(U min ,Min(U max ,U aver + (U tmax - U aver ) x (1 - U aver )));
  • is the 10 load threshold
  • ⁇ /Dish and ⁇ / are respectively the preset maximum allowable maximum value and minimum value of 10 loads, which is the average value of the 10 load of the HDD in the preset time
  • U is preset The peak value of the 10 load of the HDD in a given time
  • Max() is the maximum value operation
  • Min() is the minimum value operation.
  • Step 54 Determine whether the current 10 load value is greater than or equal to the dynamic 10 load threshold. If yes, go to step 55. Otherwise, go to step 56.
  • Step 55 Interchange the HDD and SSD content.
  • Step 56 Keep the content from moving.
  • the present embodiment can further compare the heat of the SSD tail content and the HDD tail content as shown in FIG. 3, and perform corresponding processing as shown in FIG. 3.
  • the 10 load threshold of the HDD is compared with the dynamic threshold, and after the dynamic threshold is exceeded, the SSD is written, thereby reducing the number of write operations in the SSD and prolonging the use of the SSD. Life, reduce costs.
  • the dynamic threshold in this embodiment can better reflect the actual situation and balance system resources.
  • FIG. 6 is a schematic flowchart of a method according to a fifth embodiment of the present invention, including:
  • Step 61 Determine that the highest heat of the content in the HDD exceeds the minimum heat of the content in the SSD.
  • Step 62 Obtain the current 10 load value of the HDD.
  • step 21-22 For details of steps 61-62, see step 21-22.
  • Step 63 Determine whether the current 10 load value is greater than or equal to 10 load threshold. If yes, go to step 65. Otherwise, go to step 64.
  • the 10 load threshold may be a fixed value or a dynamic value. For details, refer to step 23 or step 53-54.
  • the embodiment further includes:
  • Step 64 Determine whether the heat content of the HDD is greater than or equal to the heat threshold of entering the SSD. If yes, go to step 65. Otherwise, go to step 66.
  • the heat threshold for entering the SSD can be obtained by the following formula:
  • H thld MH mm in(H w ,H low + (H high - H lo x ( ⁇ - U aver )))
  • a Wd is the heat threshold
  • H Aig ⁇ PH is the highest and lowest value of the content heat on the SSD
  • ⁇ / ⁇ is the average value of the 10 load of the HDD in the preset time
  • H ma ⁇ p H mm They are the maximum and minimum values of the allowed allowable heat
  • Max() is the maximum value
  • Min() is the minimum value.
  • H can dynamically change with the average load of the HDD of the most recent period of time; if t/ is large, ⁇ is relatively small, and if it is small, H thld is increased by a large amount;
  • the dish can be set to 80% of H AA and H mm can be set to H
  • Step 65 Interchange the HDD and SSD content.
  • Step 66 Keep the content from moving.
  • the tail content comparison and corresponding processing flow in the SSD and the HDD can be further performed as shown in FIG. 3 to ensure the hit rate.
  • the heat factor but also the load value of the HDD is considered in the content exchange process of the SSD and the HDD, and the write operation to the SSD can be reduced, and the cost can be reduced.
  • the occupancy of the HDD and the SSD can be balanced.
  • FIG. 7 is a schematic structural diagram of a device according to a sixth embodiment of the present invention, including an acquiring module 71 and a first mutual
  • the module 72 is configured to acquire the 10 load value of the HDD and obtain the 10 load threshold.
  • the first swap module 72 is configured to: if the highest heat of the content in the HDD in the multi-level cache exceeds the multi-level The lowest heat of the content in the SSD in the cache, and the 10 load value of the HDD is greater than or equal to the 10 load threshold, and the content of the highest heat in the HDD is written into the SSD, and the lowest heat in the SSD is Content is written into the HDD to exchange content in the SSD and HDD.
  • the implementation may further include a second interchange module 73, the second interchange module 73 is configured to: when the highest heat of the content in the HDD in the multi-level cache exceeds the minimum heat of the content in the SSD in the multi-level cache, And when the 10 load value of the HDD is less than the 10 load threshold, comparing a minimum heat of content in the SSD and a minimum heat of content in the HDD; if a minimum heat of content in the SSD is less than or equal to the HDD When the content is the lowest heat, the content with the lowest heat in the SSD is interchanged with the content with the highest heat in the HDD, so that the lowest heat of the content in the SSD is greater than the lowest heat of the content in the HDD.
  • the second interchange module 73 is configured to: when the highest heat of the content in the HDD in the multi-level cache exceeds the minimum heat of the content in the SSD in the multi-level cache, And when the 10 load value of the HDD is less than the 10 load threshold, comparing a minimum heat of content in the SSD and
  • the implementation may further include a third interchange module 74, wherein the third interchange module 74 is configured to: when the highest heat of the content in the HDD in the multi-level cache exceeds the minimum heat of the content in the SSD in the multi-level cache, And the 10th load value of the HDD is less than the 10 load threshold, obtaining a heat threshold for entering the SSD and comparing the highest heat of the content in the HDD with the heat threshold; if the highest heat of the content in the HDD is greater than or equal to The heat threshold is written into the SSD in the highest heat content in the HDD, and the content of the lowest heat in the SSD is written into the HDD to perform the exchange of the SSD and HDD content.
  • the third interchange module 74 is configured to: when the highest heat of the content in the HDD in the multi-level cache exceeds the minimum heat of the content in the SSD in the multi-level cache, And the 10th load value of the HDD is less than the 10 load threshold, obtaining a heat threshold for entering the SSD and comparing the highest heat of the content
  • the foregoing program may be stored in a computer readable storage medium, and when executed, the program includes the steps of the foregoing method embodiment; and the foregoing storage medium includes: ROM, RAM, A variety of media that can store program code, such as a disk or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Digital Magnetic Recording (AREA)
  • Debugging And Monitoring (AREA)

Description

多级緩存下固态硬盘的写方法及装置
技术领域
本发明涉及存储技术, 尤其涉及一种多级緩存下固态硬盘的写方法及装 置。 背景技术
固态硬盘( Solid State Driver, SSD )具有比普通硬盘( Hard Disk Driver, HDD ) 更优的输入输出 (Input Output, 10 )性能, 且延迟更低, 并且 SSD 还具有其他优点。 但是, SSD的寿命受限于 SSD的写擦除次数, 例如, 单级 单元( Single-Level Cell, SLC )可擦除 100,000次,多级单元( Multi-Level Cell, MLC )可擦除 10,000次; 假设一块 32GB的 MLC的 SSD, 最多可以写入 32*10,000约 32TB的数据,在最多反复写入这么多的数据后, SSD就会失效。 但是, HDD的读写次数对 HDD的寿命影响是很小的, HDD的寿命更易受环 境温度、 震动情况等因素的影响。
对于高带宽需求的流媒体的緩存(cache )服务来说, 緩存服务是把热点 内容緩存到离用户比较近的边缘服务器上。 緩存的关键是緩存替换算法, 緩 存替换算法是指当緩存空间满的时候进行内容替换的原则, 实现緩存较热的 内容, 替换掉较冷的内容。 内容的冷热是随着时间的变化, 新的内容不断的 注入而不断变化的, 所以, 緩存的存储介质是不停地进行着数据的写入和删 除的。
对于如流媒体这种高带宽应用来说, HDD的 10能力是不足的, 需要釆 用 SSD, 以利用 SSD的高 10性能。 但是, 流媒体的緩存服务又需要多个写 入删除, 这会影响 SSD的使用寿命。 为此, 考虑到 10性能及使用成本, 可 以组成多级緩存,该多级緩存由 SSD和 HDD组成。将热的内容存储在 SSD, 利用 SSD的高 10性能, 不太热的内容就可以存储在 HDD, 以降低成本。 根据緩存替换算法, 需要进入緩存的内容首先进入 HDD, 淘汰掉 HDD 中最冷的内容, 如果 HDD中最热的内容超过 SSD中最冷的内容, 则需要交 换 HDD和 SSD的内容, 以保持 SSD和 HDD的内容的热度是由高到低的。 但是由于内容热度的不断变化, SSD和 HDD 中的内容需要频繁互换, 这样 依然会降低 SSD的寿命, 造成成本增加。 发明内容
本发明实施例是提供一种多级緩存时固态硬盘的写方法及装置, 以降低 成本。
本发明实施例提供了一种多级緩存下固态硬盘的写方法, 包括: 获取 HDD的输入输出 10负载值及获取 10负载阈值;
如果所述多级緩存中的 HDD中内容的最高热度超过所述多级緩存中的 SSD中内容的最低热度, 且所述 HDD的 10负载值大于等于所述 10负载阈值, 将所述 HDD中最高热度的内容写入所述 SSD中, 将所述 SSD中最低热度的内 容写入所述 HDD中, 以进行所述 SSD和 HDD中内容的互换。
本发明实施例提供了一种多级緩存下固态硬盘的写装置, 包括: 获耳 莫块, 用于获取 HDD的输入输出 10负载值及获取 10负载阈值; 第一互换模块, 用于如果所述多级緩存中的 HDD中内容的最高热度超过 所述多级緩存中的 SSD中内容的最低热度, 且所述 HDD的 10负载值大于等于 所述 10负载阈值,将所述 HDD中最高热度的内容写入所述 SSD中,将所述 SSD 中最低热度的内容写入所述 HDD中, 以进行所述 SSD和 HDD中内容的互换。
由上述技术方案可知, 本发明实施例通过在进行 SSD和 HDD的内容互 换过程中不仅考虑热度因素, 还考虑 HDD的 10负载值, 在 HDD中的热度 超过 SSD中的热度时, 还需要 10负载值大于等于 10负载阈值时对 SSD进 行写操作, 而不是在 HDD中的热度超过 SSD中的热度即进行对 SSD的写操 作, 可以减少对 SSD的写操作, 降低成本。 附图说明
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中 所需要使用的附图作一简单地介绍, 显而易见地, 下面描述中的附图是本发 明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性的 前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明第一实施例的方法流程示意图;
图 2为本发明第二实施例的方法流程示意图;
图 3为本发明第三实施例的方法流程示意图;
图 4为本发明实施例中 SSD和 HDD中内容热度排列示意图;
图 5为本发明第四实施例的方法流程示意图;
图 6为本发明第五实施例的方法流程示意图;
图 7为本发明第六实施例的装置结构示意图。 具体实施方式
为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本发 明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于 本发明中的实施例, 本领域普通技术人员在没有做出创造性劳动前提下所获 得的所有其他实施例, 都属于本发明保护的范围。
图 1为本发明第一实施例的方法流程示意图, 包括:
步骤 11: 获取 HDD的 10负载值及获取 10负载阈值;
其中, 该 10负载阈值可以为预先设定的固定值, 例如 80%。 该 10负载 阈值也可以为动态获取的值, 即根据一定时间内的 HDD的负载值,动态计算 得到所述 10负载阈值。
步骤 12: 如果所述多级緩存中的 HDD中内容的最高热度超过所述多级 緩存中的 SSD中内容的最低热度,且所述 HDD的 10负载值大于等于所述 10 负载阈值, 将所述 HDD中最高热度的内容写入所述 SSD中, 将所述 SSD中 最低热度的内容写入所述 HDD中, 以进行所述 SSD和 HDD中内容的互换。
本实施例通过在进行 SSD和 HDD的内容互换过程中不仅考虑热度因素, 还考虑 HDD的 10负载值, 可以减少对 SSD的写操作, 降低成本。
图 2为本发明第二实施例的方法流程示意图,本实施例以 10负载阈值为 固定值为例, 本实施例包括:
步骤 21 : 确定 HDD中内容的最高热度超过 SSD中内容的最低热度。 其中, 可以根据点击量来确定 HDD或者 SSD中各内容的热度, 例如, 点击量高的内容则热度高。
步骤 22: 获取 HDD的当前 10负载值。
其中, 可以通过 shell下的 iostat-x命令, 获取所述 HDD的 10负载值, 也可以通过***提供的 API接口, 获取所述 HDD的 10负载值。
具体地, 在 linux环境下, 可以通过 shell命令 iostat-x来获取磁盘的负载 信息,其中%1! 字段反映的就是当前磁盘 /分区的整体负载情况,如下的例子 显示了***中共有 5块磁盘 c0d0〜c0d4, cOdO的 10负载值为 29.47%, c0d4 的 10负载值为 12.37%:
Cache:#iostat-x
Linux 2.6.27.45-0. l-default(Cache) 10/29/10 _x86_64
avg-cpu: %user %nice%system%iowait %steal %idle
13.01 0.02 8.88 4.30 0.00 74.89
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util cciss/cOdO 1.08 514.19 326.31 87.06 2619.16 4811.13 17.97 0.50 1.21 0.71 29.47 cciss/cOdOpl 1.08 514.19 326.31 87.06 2619.16 4811.13 17.97 0.50 1.21 0.71 29.47 cciss/cOdl 0.02 0.00 0.01 0.00 0.22 0.00 41.85 0.00 4.00 2.67 0.00 cciss/c0d2 0.02 0.00 0.01 0.00 0.22 0.00 41.85 0.00 3.59 2.77 0.00 cciss/c0d3 1.14 13.70 2.50 4.65 133.06 146.84 39.13 0.01 0.75 0.32 0.23 cciss/c0d3pl 0.05 0.04 0.00 0.00 0.17 0.39 57.63 0.00 2.52 2.08 0.00 cciss/c0d3p2 1.09 13.65 2.49 4.65 132.83 146.45 39.11 0.01 0.75 0.32 0.23 cciss/c0d4 1.06 341.40 543.79 80.97 4358.76 3380.17 12.39 0.23 0.38 0.20 12.37 cciss/c0d4pl 1.06 341.40 543.79 80.97 4358.76 3380.17 12.39 0.23 0.38 0.20 12.37 另夕卜,如果操作***或者文件***提供了*** API接口,则可以通过 API 接口获取 10负载值。
步骤 23: 判断该当前 10负载值是否大于等于预先设定的阈值, 如果是, 执行步骤 24, 否则, 执行步骤 25。
通常, %util字段的值达到 70%和 80%说明磁盘的负载比较高, 所以, 可 以将 HDD的 10阈值设置为一个较高的值, 例如 80%。
步骤 24: 进行 HDD和 SSD内容的互换。
例如,应用模块向 HDD和 SSD发送指示消息,该指示消息可以使得 HDD 将热度高的内容移动到 SSD中, 将 SSD中热度低的内容移动到 HDD中, 实 现 SSD和 HDD的内容互换。
步骤 25: 保持内容不移动。
例如, 不发送指示内容移动的消息。
本实施例通过在 HDD中内容的热度超过 SSD中内容的热度后,将 HDD 的 10负载阈值与预先设定的固定值比较, 在超过该固定值后再写入 SSD中, 可以减少 SSD中写操作的次数, 延长 SSD的使用寿命, 降低成本。
图 3为本发明第三实施例的方法流程示意图, 本实施例可以进一步保证 命中率, 本实施例包括:
步骤 31 : 确定 HDD中内容的最高热度超过 SSD中内容的最低热度; 步骤 32: 获取 HDD的当前 10负载值;
步骤 33: 判断该当前 10负载值是否大于等于预先设定的阈值, 如果是, 执行步骤 35, 否则, 执行步骤 34。
上述步骤的具体内容可以参见步骤 21 -23。
因为设置了 HDD的 10负载阈值, 可能改变 SSD和 HDD中内容的热度 排序, 可能导致 SSD的尾部内容(热度最低的内容)低于 HDD的头部内容 (热度最高的内容) 。 例如, 参见图 4, 左侧的内容表明 SSD和 HDD的热 度是按序排列的, 右侧的内容表明 SSD和 HDD的内容的热度出现不按序排 列的情况, 其中, 图 4中, 热度的值越大表明热度越高。
此时, 为了保证命中率, 需要保证 SSD尾部内容的热度至少高于 HDD 尾部内容的热度。 为此, 本实施例还包括如下步骤:
步骤 34:判断 SSD尾部内容热度是否大于 HDD尾部内容热度,如果是, 执行步骤 36, 否则, 执行步骤 35。
步骤 35: 进行 HDD和 SSD内容的互换, 保证 SSD尾部内容热度大于 HDD尾部内容热度。
例如,应用模块向 SSD和 HDD发送指示消息,该指示消息指示 HDD将 HDD中最热的内容移动至 SSD中, 并且指示 SSD将热度最小的内容移动至 HDD中。
步骤 36: 保持内容不移动。
本实施例通过在 HDD中内容超过 SSD中内容后, 将 HDD的 10负载阈 值与预先设定的固定值比较,在超过该固定值后再写入 SSD中,可以减少 SSD 中写操作的次数, 延长 SSD的使用寿命, 降低成本。 并且, 本实施例通过比 较 SSD和 HDD的尾部内容的热度, 在 HDD尾部内容的热度大于等于 SSD 尾部内容的热度后,将 HDD的热度最高的内容互换 SSD中热度最低的内容, 可以保证用户向緩存中获取数据的命中率。
图 5为本发明第四实施例的方法流程示意图,本实施例以 10负载阈值为 动态阈值为例, 本实施例包括:
步骤 51 : 确定 HDD中内容的最高热度超过 SSD中内容的最低热度。 步骤 52: 获取 HDD的当前 10负载值。
其中, 步骤 51-52的具体内容可以参见图 2的步骤 21-22。
步骤 53: 获取一定时间内的 HDD的负载值, 并根据一定时间内的 HDD 的负载值, 获取动态的 10负载阈值。 例如, 计算公式可以如下:
Uthld = Max(Umin,Min(Umax,Uaver + (Utmax - Uaver) x (1 - Uaver)));
其中, ω为 10负载阈值, ^/皿和^/ 分别为预先设定的 10负载允许的 最大值和最小值, 为预先设定的时间内的 HDD的 10负载的平均值, U 为预先设定的时间内的 HDD的 10负载的峰值, Max()为取最大值运算, Min() 为取最小值运算。
通过上述计算公式可以看出, „能够反映最近一段时间的平均 10负载 情况; 稍高于平均 10负载 如果^较大,则 ω上浮较小,如果^ 较小, 则 „上浮较大; 可以将 t/max设置为 80%, [/min设置为 40%
步骤 54: 判断该当前 10负载值是否大于等于该动态的 10负载阈值, 如 果是, 执行步骤 55, 否则, 执行步骤 56
步骤 55: 进行 HDD和 SSD内容的互换。
步骤 56: 保持内容不移动。
步骤 55-56的具体内容可以参见步骤 24-25
可以理解的是, 本实施例为了保证命中率, 可以如图 3所示, 进一步比 较 SSD尾部内容和 HDD尾部内容的热度, 并进行如图 3所示的相应处理。
本实施例通过在 HDD中内容超过 SSD中内容后, 将 HDD的 10负载阈 值与动态阈值比较,在超过该动态阈值后再写入 SSD中,可以减少 SSD中写 操作的次数, 延长 SSD的使用寿命, 降低成本。 另外, 本实施例釆用动态阈 值可以更好地反映实际情况, 均衡***资源。
图 6为本发明第五实施例的方法流程示意图, 包括:
步骤 61 : 确定 HDD中内容的最高热度超过 SSD中内容的最低热度。 步骤 62: 获取 HDD的当前 10负载值。
步骤 61 -62的具体内容可以参见步骤 21 -22
步骤 63: 判断当前 10负载值是否大于等于 10负载阈值, 若是, 执行步 骤 65, 否则, 执行步骤 64 其中, 该 10负载阈值可以为固定值, 也可以为动态值, 具体判断内容可 以参见步骤 23或者步骤 53-54
如果按照 10负载阈值的方式进行处理, 可能出现内容都被 HDD拦截的 情况, 此时即使 HDD的 10能够负担, 但是从尽可能均衡利用***资源的角 度看, 可以要求 HDD不要拦截太多, 将部分比较热的内容升级到 SSD中。 为此, 本实施例还包括:
步骤 64: 判断 HDD中内容的热度是否大于等于进入 SSD的热度阈值, 若是, 执行步骤 65, 否则, 执行步骤 66
其中, 进入 SSD的热度阈值可以釆用如下计算公式得到:
Hthld = M Hmm in(Hw,Hlow + (Hhigh - Hlo x (\ - Uaver)))
其中, AWd为热度阈值, HAig^P H 分别为 SSD上内容热度的最高值和最 低值, ί/α 为预先设定的时间内的 HDD的 10负载的平均值, Hma^p Hmm分别 为预先设定的允许的热度的最大值和最小值, Max()为取最大值运算, Min() 为取最小值运算。
从上述计算公式可以看出 H 能够随最近一段时间的 HDD的 10平均 负载动态变化;如果 t/ 较大,则 ω相对 „增加较小,如果 较小,则 Hthld 相对 ^增加较大; H皿可以设置为 HA A的 80%, Hmm可以设置为 H
步骤 65: 进行 HDD和 SSD内容的互换。
步骤 66: 保持内容不移动。
步骤 65-66的具体内容可以参见步骤 24-25
另夕卜,可以理解的是,本实施例依然可以如图 3所示再进行 SSD和 HDD 中尾部内容比较及相应处理流程, 以保证命中率。
本实施例通过在进行 SSD和 HDD的内容互换过程中不仅考虑热度因素, 还考虑 HDD的 10负载值, 可以减少对 SSD的写操作, 降低成本。 另外, 本 实施例通过设置进入 SSD的阈值, 可以均衡 HDD和 SSD的占用情况。
图 7为本发明第六实施例的装置结构示意图, 包括获取模块 71和第一互 换模块 72;获取模块 71用于获取所述 HDD的 10负载值及获取 10负载阈值; 第一互换模块 72用于如果所述多级緩存中的 HDD中内容的最高热度超过所 述多级緩存中的 SSD中内容的最低热度,且所述 HDD的 10负载值大于等于 所述 10负载阈值, 将所述 HDD中最高热度的内容写入所述 SSD中, 将所述 SSD中最低热度的内容写入所述 HDD中, 以进行所述 SSD和 HDD中内容 的互换。
本实施还可以进一步包括第二互换模块 73 , 第二互换模块 73用于当所 述多级緩存中的 HDD中内容的最高热度超过所述多级緩存中的 SSD中内容 的最低热度, 且所述 HDD的 10负载值小于所述 10负载阈值时, 比较所述 SSD中内容的最低热度和所述 HDD中内容的最低热度; 如果所述 SSD中内 容的最低热度小于等于所述 HDD中内容最低热度时, 将所述 SSD中热度最 低的内容与所述 HDD中热度最高的内容互换, 使得所述 SSD中的内容的最 低热度大于所述 HDD中内容的最低热度。
本实施还可以进一步包括第三互换模块 74, 第三互换模块 74用于当所 述多级緩存中的 HDD中内容的最高热度超过所述多级緩存中的 SSD中内容 的最低热度, 且所述 HDD的 10负载值小于所述 10负载阈值时, 获取进入 SSD的热度阈值并比较所述 HDD 中内容的最高热度和所述热度阈值; 如果 所述 HDD中内容的最高热度大于等于所述热度阈值, 将所述 HDD中最高热 度的内容写入所述 SSD中,将所述 SSD中最低热度的内容写入所述 HDD中, 以进行所述 SSD和 HDD内容的互换。
本实施例通过在进行 SSD和 HDD的内容互换过程中不仅考虑热度因素, 还考虑 HDD的 10负载值, 可以减少对 SSD的写操作, 降低成本。
可以理解的是, 上述方法及设备中的相关特征可以相互参考。 另外, 上 述实施例中的 "第一" 、 "第二" 等是用于区分各实施例, 而并不代表各实 施例的优劣。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分步骤 可以通过程序指令相关的硬件来完成, 前述的程序可以存储于计算机可读取 存储介质中, 该程序在执行时, 执行包括上述方法实施例的步骤; 而前述的 存储介质包括: ROM, RAM,磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对其 限制; 尽管参照前述实施例对本发明进行了详细的说明, 本领域的普通技术 人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改, 或 者对其中部分技术特征进行等同互换; 而这些修改或者互换, 并不使相应技 术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims

权 利 要 求
1、 一种多级緩存下固态硬盘的写方法, 其特征在于, 包括:
获取普通硬盘 HDD的输入输出 10负载值及获取 10负载阈值; 如果所述多级緩存中的 HDD 中内容的最高热度超过所述多级緩存中的 固态硬盘 SSD中内容的最低热度,且所述 HDD的 10负载值大于等于所述 10 负载阈值, 将所述 HDD中最高热度的内容写入所述 SSD中, 将所述 SSD中 最低热度的内容写入所述 HDD中, 以进行所述 SSD和 HDD中内容的互换。
2、 根据权利要求 1所述的方法, 其特征在于, 所述 10负载阈值为预先 设定的固定值。
3、 根据权利要求 2所述的方法, 其特征在于, 所述预先设定的固定值为 80%。
4、 根据权利要求 1所述的方法, 其特征在于, 所述获取 10负载阈值, 包括:
根据一定时间内的 HDD的负载值, 获取所述 10负载阈值。
5、 根据权利要求 4 所述的方法, 其特征在于, 所述根据一定时间内的 HDD的负载值, 获取所述 10负载阈值的计算公式为:
Uthld = Max(Umm,Min(Umax,Uaver + (Utmax - Uaver) x (1 _ Uaver)))
其中, [/^为10负载阈值, [/皿和 t/mm分别为预先设定的 10负载允许的 最大值和最小值, ί/α 为预先设定的时间内的 HDD的 10负载的平均值, Utmax 为预先设定的时间内的 HDD的 10负载的峰值, Max()为取最大值运算, Min() 为取最小值运算。
6、根据权利要求 1所述的方法,其特征在于, 当所述多级緩存中的 HDD 中内容的最高热度超过所述多级緩存中的 SSD 中内容的最低热度, 且所述 HDD的 10负载值小于所述 10负载阈值时, 所述方法还包括:
比较所述 SSD中内容的最低热度和所述 HDD中内容的最低热度; 如果所述 SSD中内容的最低热度小于等于所述 HDD中内容的最低热度 时, 将所述 SSD中热度最低的内容与所述 HDD中热度最高的内容互换, 使 得所述 SSD中的内容的最低热度大于所述 HDD中内容的最低热度。
7、根据权利要求 1所述的方法,其特征在于, 当所述多级緩存中的 HDD 中内容的最高热度超过所述多级緩存中的 SSD 中内容的最低热度, 且所述 HDD的 10负载值小于所述 10负载阈值时, 所述方法还包括:
获取进入 SSD的热度阈值;
比较所述 HDD中内容的最高热度和所述热度阈值;
如果所述 HDD中内容的最高热度大于等于所述热度阈值, 将所述 HDD 中最高热度的内容写入所述 SSD中,将所述 SSD中最低热度的内容写入所述 HDD中, 以进行所述 SSD和 HDD内容的互换。
8、 根据权利要求 7所述的方法, 其特征在于, 所述获取进入 SSD的热 度阈值的计算公式为:
Hthld = M Hmm in(Hw,Hlow + (Hhigh - Hlo x (\ - Uaver)))
其中, AWd为热度阈值, HAig^P H 分别为 SSD上内容热度的最高值和最 低值, ί/α 为预先设定的时间内的 HDD的 10负载的平均值, Hma^p Hmm分别 为预先设定的允许的热度的最大值和最小值, Max()为取最大值运算, Min() 为取最小值运算。
9、 根据权利要求 1-8任一项所述的方法, 其特征在于, 所述获取 HDD 的 10负载值, 包括:
通过 shell下的 iostat-x命令, 获取所述 HDD的 10负载值;
或者,
通过***提供的 API接口, 获取所述 HDD的 10负载值。
10、 一种多级緩存下固态硬盘的写装置, 其特征在于, 包括:
获耳 莫块, 用于获取普通硬盘 HDD的输入输出 10负载值及获取 10负 载阈值; 第一互换模块,用于如果所述多级緩存中的 HDD中内容的最高热度超过 所述多级緩存中的固态硬盘 SSD中内容的最低热度,且所述 HDD的 10负载 值大于等于所述 10负载阈值, 将所述 HDD中最高热度的内容写入所述 SSD 中, 将所述 SSD中最低热度的内容写入所述 HDD 中, 以进行所述 SSD和 HDD中内容的互换。
11、 根据权利要求 10所述的装置, 其特征在于, 还包括:
第二互换模块,用于当所述多级緩存中的 HDD中内容的最高热度超过所 述多级緩存中的 SSD中内容的最低热度,且所述 HDD的 10负载值小于所述 10负载阈值时, 比较所述 SSD中内容的最低热度和所述 HDD中内容的最低 热度; 如果所述 SSD中内容的最低热度小于等于所述 HDD中内容的最低热 度时, 将所述 SSD中热度最低的内容与所述 HDD中热度最高的内容互换, 使得所述 SSD中的内容的最低热度大于所述 HDD中内容的最低热度。
12、 根据权利要求 10所述的装置, 其特征在于, 还包括:
第三互换模块,用于当所述多级緩存中的 HDD中内容的最高热度超过所 述多级緩存中的 SSD中内容的最低热度,且所述 HDD的 10负载值小于所述 度和所述热度阈值; 如果所述 HDD 中内容的最高热度大于等于所述热度阈 值, 将所述 HDD中最高热度的内容写入所述 SSD中, 将所述 SSD中最低热 度的内容写入所述 HDD中, 以进行所述 SSD和 HDD内容的互换。
PCT/CN2010/080656 2010-12-31 2010-12-31 多级缓存下固态硬盘的写方法及装置 WO2011147187A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201080003686XA CN102203749B (zh) 2010-12-31 2010-12-31 多级缓存下固态硬盘的写方法及装置
PCT/CN2010/080656 WO2011147187A1 (zh) 2010-12-31 2010-12-31 多级缓存下固态硬盘的写方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2010/080656 WO2011147187A1 (zh) 2010-12-31 2010-12-31 多级缓存下固态硬盘的写方法及装置

Publications (1)

Publication Number Publication Date
WO2011147187A1 true WO2011147187A1 (zh) 2011-12-01

Family

ID=44662781

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/080656 WO2011147187A1 (zh) 2010-12-31 2010-12-31 多级缓存下固态硬盘的写方法及装置

Country Status (2)

Country Link
CN (1) CN102203749B (zh)
WO (1) WO2011147187A1 (zh)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2733617A4 (en) * 2012-06-30 2014-10-08 Huawei Tech Co Ltd DATA BUFFER DEVICE, DATA STORAGE SYSTEM AND METHOD THEREFOR
CN103019615B (zh) * 2012-07-19 2015-08-26 中国人民解放军国防科学技术大学 一种基于负载控制的提高闪存固态硬盘持久性方法
CN103744624B (zh) * 2014-01-10 2017-09-22 浪潮电子信息产业股份有限公司 一种实现存储***ssd缓存数据选择性升级的***架构
CN105493024B (zh) * 2014-11-28 2019-03-08 华为技术有限公司 一种数据阈值预测方法与相关装置
CN105893118B (zh) * 2016-03-30 2019-11-26 联想(北京)有限公司 一种信息处理方法及电子设备
CN107273040A (zh) * 2016-04-08 2017-10-20 北京优朋普乐科技有限公司 数据缓存方法和装置
CN106527988B (zh) * 2016-11-04 2019-07-26 郑州云海信息技术有限公司 一种固态硬盘数据迁移的方法及装置
CN106775500A (zh) * 2017-02-10 2017-05-31 郑州云海信息技术有限公司 一种计算机硬盘存储文件的方法与装置
CN107748649B (zh) * 2017-09-18 2021-03-30 北京京东尚科信息技术有限公司 一种缓存数据的方法和装置
CN110362277B (zh) * 2019-07-19 2021-03-02 重庆大学 基于混合存储***的数据分类存储方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101446924A (zh) * 2008-12-16 2009-06-03 成都市华为赛门铁克科技有限公司 一种数据存储及获取方法、***
US20100211731A1 (en) * 2009-02-19 2010-08-19 Adaptec, Inc. Hard Disk Drive with Attached Solid State Drive Cache
CN101907978A (zh) * 2010-07-27 2010-12-08 浙江大学 基于固态硬盘和磁性硬盘的混合存储***及存储方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101446924A (zh) * 2008-12-16 2009-06-03 成都市华为赛门铁克科技有限公司 一种数据存储及获取方法、***
US20100211731A1 (en) * 2009-02-19 2010-08-19 Adaptec, Inc. Hard Disk Drive with Attached Solid State Drive Cache
CN101907978A (zh) * 2010-07-27 2010-12-08 浙江大学 基于固态硬盘和磁性硬盘的混合存储***及存储方法

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LEE, SEHWAN ET AL.: "Unifying Buffer Replacement and Prefetching with Data Migration for Heterogeneous Storage Devices.", 2010 16TH INTERNATIONAL CONFERENCE ON PARALLEL AND DISTRIBUTED SYSTEMS, 10 December 2010 (2010-12-10) *
PAYER, HANNES ET AL.: "Combo Drive: Optimizing Cost and Performance in a Heterogeneous Storage Device.", WORKSHOP ON INTEGRATION SOLID-STATE MEMORY INTO THE STORAGE HIERARCHY 2009(WISH 2009), 7 March 2009 (2009-03-07), pages 1,4 - 5 *

Also Published As

Publication number Publication date
CN102203749A (zh) 2011-09-28
CN102203749B (zh) 2013-06-26

Similar Documents

Publication Publication Date Title
WO2011147187A1 (zh) 多级缓存下固态硬盘的写方法及装置
WO2016175028A1 (ja) 情報処理システム、記憶制御装置、記憶制御方法および記憶制御プログラム
US8347050B2 (en) Append-based shared persistent storage
TWI426444B (zh) 包含快閃式介面的硬碟驅動器之可調整儲存系統
US10558395B2 (en) Memory system including a nonvolatile memory and a volatile memory, and processing method using the memory system
WO2015008356A1 (ja) ストレージコントローラ、ストレージ装置、ストレージシステム、半導体記憶装置
US20140006687A1 (en) Data Cache Apparatus, Data Storage System and Method
TW201030516A (en) Hybrid memory device
US9098404B2 (en) Storage array, storage system, and data access method
JP2011530133A (ja) キャッシュコンテンツの記憶管理
WO2013107029A1 (zh) 一种基于块存储的数据处理方法、装置及***
US8688904B1 (en) Method for managing data storage
WO2015100653A1 (zh) 一种数据缓存方法、装置及***
US9898413B2 (en) Auto-adaptive system to implement partial write buffering for storage systems dynamic caching method and system for data storage system
WO2012071950A1 (zh) 拷贝数据的方法、读取数据的方法和装置及***
US20140237190A1 (en) Memory system and management method therof
WO2019047612A1 (zh) 基于闪存的存储路径优化的键值存储管理方法
CN108205478B (zh) 智能序列式小型计算机***接口物理层功率管理
CN102510390B (zh) 利用硬盘温度自检测指导数据迁移的方法和装置
US20120047330A1 (en) I/o efficiency of persistent caches in a storage system
US20240020014A1 (en) Method for Writing Data to Solid-State Drive
WO2011131003A1 (zh) 实现手机缓冲存储器机制的***及手机操作***加载方法
WO2013075627A1 (zh) 一种数据的缓存方法、装置和服务器
WO2016194979A1 (ja) ストレージシステム、ストレージ制御装置、ストレージ制御方法及びプログラム
CN102063263A (zh) 固态硬盘响应主机读写操作请求的方法、设备及***

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201080003686.X

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10852056

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10852056

Country of ref document: EP

Kind code of ref document: A1