Presentation is loading. Please wait.

Presentation is loading. Please wait.

Trading Flash Translation Layer For Performance and Lifetime

Similar presentations


Presentation on theme: "Trading Flash Translation Layer For Performance and Lifetime"— Presentation transcript:

1 Trading Flash Translation Layer For Performance and Lifetime
王 江 涛 我们闪存组今天报告的主题是inside and outside ssd 从闪存转换层和性能测试两方面来分析提高ssd性能的方法。 首先由我从设计高效的闪存转换层的角度来讨论提高闪存的读写性能和使用寿命。 接下来高雨同学会从ssd性能测试角度分析闪存的性能。

2 Outline Introduction Flash Translation Layer Address Mapping
1 Introduction 2 Flash Translation Layer 3 Address Mapping 4 Wear Leveling 5 Conclusion

3 Introduction of Flash Memory
Pros Small size and Lighter weight Low power consumption and Non-Volatility Shock resistance and Lesser noise Faster access performance 近十几年来,闪存已经被广泛应用于各种嵌入式系统和便携式设备;随着闪存容量的快速增长和价格的 不断下降,基于闪存的固态硬盘已经成为一种新的重要的二级存储设备,广泛应用于企业级计算环境中。与磁盘相比有闪存有很多优点 尺寸小、重量轻;能耗少、非易失;抗震动、低噪声,有着更快的读写速度。

4 flash memory chip OOB ECC(Hamming Code) Logical page number
DATA 一个闪存芯片是由多个block组织排列而成,每一个block又有许多page构成; 每一页由两部分区域:数据区域和spare read error correction code:纠错码,通常采用海明码,用于进行一页数据的纠错 OOB ECC(Hamming Code) Logical page number State: erased/valid/invalid

5 Introduction of Flash Memory
Cons Write granularity (page) Erase before write (block) Sequential write within a block Limited erase/write Out-of-place update when a page is to be overwritten, we allocate a new free or erased page we used a software layer called FTL indicate the physical location change of the page 闪存芯片物理组成的特性使得他与磁盘相比又有很多不足的地方。主要有四个方面:写的时候以页为单位; 写前擦除(以block为基本单位);块内顺序写是避免读写干扰;每个block有限的擦除次数 目前成熟的存储管理技术几乎都是基于磁盘的特性进行设计的。比如说更新数据的时候采用原位更新。 闪存 Erase before write的特性使得我们执行原位更新策略的代价太高,采用异地更新的策略; 这些与磁盘不同的策略使得上层应用(文件系统)是不能直接运行在闪存上。解决这个问题的主要方法就是在上层应用与闪存芯片之间加了一个存转换层(FTL).

6 Outline Introduction Flash Translation Layer Address Mapping
1 Introduction 2 Flash Translation Layer 3 Address Mapping 4 Wear Leveling 5 Conclusion

7 Flash Translation Layer
Function Address mapping Garbage collection(block reclamation) Wear-leveling Address translation:用于完成逻辑地址到物理地址的转换 Garbage collection:回收闪存上有多个无效页。开辟可用空间 Wear leveling 为了使得擦除操作更加均匀,通常采用磨损平衡策略。

8 Outline Introduction Flash Translation Layer Address Mapping
1 Introduction 2 Flash Translation Layer 3 Address Mapping 4 Wear Leveling 5 Conclusion

9 Address Mapping Mapping granularity Block-level FTL Scheme
Page-level scheme Block-level scheme Hybrid scheme Block-level FTL Scheme The same page offset within logical and physical block Mapping table reside in RAM (size is small) Erase operation frequent and space utilization is low 页级映射采用细粒度映射方式,每一个逻辑页能映射到任何一个物理页;这种模式的灵活性好,效率高。稍后做详细介绍 块级映射:物理块和逻辑块的规格是相同的;通过块内偏移定位块中的某一页 映射粒度比较粗糙,不灵活,擦除操作比较频繁,空间的利用率比较多,不能很好的解决块内顺序写的问题。

10 Address Mapping Hybrid FTL Scheme
DBA: store user data (block-level mapping) LBA: store overwriting data (page-level mapping) 与块级映射不同,混合映射方案把闪存分为两个区域:数据区和日志区,数据区采用块级映射,而日志区采用页级映射 日志区用于数据区页面的数据的异位更新,这种策略提高了空间利用率;实现了日志块内数据的顺序写。但也产生了另一个问题: 因为日志区的数量少,当可用的日志块低于一个阈值时便需要与对应的数据块进行merge操作;以获取新的日志快 其中full Merge操作的代价比较高,这里给出一个full merge 的例子。

11 Address Mapping Page-level FTL Scheme
A logical page number can be mapped into any page Mapping table stored in SRAM[1995] Mapping table is stored in Flash and cached in SRAM[2009] 页级映射: 映射表里存储了物理页和逻辑页的一一对应关系,最早在1995由ban提出,当时用于小容量闪存 页级映射采用细粒度映射方式,比较灵活,映射表比较大,随着闪存容量不断增大,映射表的容量变的很大;ram无法容纳 为了解决RAM大小的问题,一些学者提出将映射表存储在闪存,同时为了提高查找映射信息的速度,将一部分映射信息缓存在RAM。

12 Page-level FTL Scheme Related work
DFTL:A Flash Translation Layer Employing Demand-based Selective Caching of Page-level Address Mapping. (ASPLOS 2009) A Workload-Aware Adaptive Hybrid Flash Translation Layer with an Efficient Caching Strategy (CFTL) (MASCOTS 2011) LazyFTL: A Page-level Flash Translation Layer Optimized for NAND Flash Memory (SIGMOD 2011) 这里页级映射最具代表性的三个工作:一个是DFTL,最先提出将映射表存储在闪存上的页级映射 ; 第二个是 根据访问负载进行自适应调节的混合映射模式;他的主题思想仍然是页级映射 第三个是在sigmod2001发表一篇论文;针对dftl存在的问题提出了以一种lazy的方式解决映射信息更新频繁和可靠性的问题 这里简单介绍一下前两篇工作,然的后重点介绍一下第三篇工作。

13 DFTL Divided flash memory into MBA and DBA Use page-level mapping
MBA--Store the full mapping table on flash DBA—Store user data Use page-level mapping Dynamically swap page-level mapping entries in/out SRAM DFTL:为了提高查询映射信息地速度,选择使用较频繁的映射项缓存在ram,并根据访问负载的变化动态的对缓存信息进行换入换出

14 DFTL SRAM CMT: Caching Mapping Table GMD: Global Mapping Directory
LPN:logical page number PPN: physical page number CMT:Caching Mapping Table improves the mapping table lookup performance GMD: 提供了一个字典,对于一个读写请求我们可以根据请求的逻辑页号,通过查阅GMD来定位映射信息所在的mapping page

15 DFTL Pros Cons Realize sequential program within a block
Avoid full merge Cons Frequently update the mapping pages during garbage collection A poor reliability of mapping information The cost of read is large 优点:解决块内顺序写;避免了full merge;

16 Workload-Aware Adaptive FTL(CFTL)
Divided flash memory into MBA and DBA MBA--Store the full mapping on flash DBA—Store user data Use page-level mapping and block-level mapping Dynamically swap page-level mapping entries in/out SRAM Convert to each other based on data access patterns Read intensive: Block-level mapping Write intensive: Page-level mapping 针对DFTL读代价较高的特点,CFTL采用了动态的映射模式, 因为块级映射有利于读操作,当读操作密集时;就采用块级映射模式;如果写操作密集就采用页级映射;

17 Workload-Aware Adaptive FTL(CFTL)
Pros Realize sequential program within a block Avoid full merge Exploit temporal and spatial locality and workloads Improve the performance of read Cons Frequently update the mapping pages during garbage collection A poor reliability of mapping information Expensive read/write cost to build block mapping table 块级映射表要求逻辑上相邻的逻辑号在物理上也应该相邻 当在进行垃圾回收建立块级映射表的时; 有时需要把分散在不同物理块的数据集中到一起去代价很大

18 LazyFTL DBA: store user data
MBA: store mapping pages(page-level scheme) CBA: store valid user data when implement garbage collection UBA: Implement write requests 针对DFTL和CFTL 存在的映射信息可靠性和更新频繁的问题;lazyftl提出了一种新的解决方案 把闪存区域划分为四个区域:DBA MBA UBA CBA; 四个区域通过三个基本操作相互关联。 其中UBA和CBA所占比例比较小,当可用空间低于给定的阈值时会执行convert操作 以一种lazy的方式完成延时和批量更新

19 LazyFTL Write Garbage Collection Convert
Complete a write request in the UBA Store new mapping formation in RAM ( UMT: update mapping table ) Garbage Collection Reclaim a victim block in the DBA or the MBA Move valid data pages to CBA and store new mapping formation in RAM (UMT) Convert Implement a batch updates Convert CBA/UBA to DBA 写操作是在UBA区域完成的;把产生的新的映射信息存储RAM里(UMT) 垃圾回收是在DBA或者MBA区域内完成的,对DBA数据回收时将有效的数据页存储到CBA区域,把产生的新的映射信息存储在RAM里 如果CBA/UBA可用的数据块低于设置的阈值便选择一个block执行convert操作,根据UMT批量更新映射信息;并将block 转换为DBA

20 LazyFTL UMT的作用对映射信息进行延迟批量的更新,提高写的性能减少擦除次数。
因为采用了延迟更新,我们必须对新增到UMT的映射信息的状态进行一个跟踪,在每一个UMT中的映射项都添加了两个标志位 Update=1:表示该映射项信息需要添加或更新到mapping page Invalidate=1:表示映射项中逻辑页号关联的数据页要标记为无效,也就是说该逻辑页在DBA去存在一个旧版本的数据; 这些操作有convert来完成,下面开一个例子

21 Convert Algorithm 算法采用批量更新策略。执行convert操作时根据要擦除快的映射信息找到这些映射信息所关联的映射页集合 极为P, 然后查找UMT中其他与P相关的其它映射项,把这两部分映射信息进行一次批量更新,减少了擦除操作。

22 Performance Evaluation
作者将lazyftl与已有的一些映射策略和一种理想化的模式做了一个对比 这里理想化模式是指每一次读操作请求只引发一次读操作;每一次写操作请求只引发一次写操作;写满一页才引发一次擦除操作。 从实验结果来看lazyftl确实减少了擦除操作,提高了写的性能

23 LazyFTL Pros Adopt an update buffer to decrease frequently update the mapping pages Achieve consistency and reliability Improve write performance by reduce erase operation Cons Increase the cost of read operation Decrease speedup of garbage collection Not considering hot-cold data for wear leveling 作者采用了一种lazy的方式来对映射信息进行批量和延迟更新,减少了擦除操作 另外提高了可靠性(因为当系统发生故障时只需要扫描小部分区域即可重建映射信息) 因为采用延迟更新的策略,在执行垃圾回收时有对数据页的有效性进行判断,同时对甄别冷然数据带来了难度,不利于磨损平衡策略的实施

24 Outline Introduction Flash Translation Layer Address Mapping
1 Introduction 2 Flash Translation Layer 3 Address Mapping 4 Wear Leveling 5 Conclusion

25 Wear Leveling Introduction Some definitions Basic principle
Any one part of flash memory can only withstand a limited number of erase-write cycles Localities of data access inevitably degrade wear evenness in flash Some definitions Hot data block and cold data block (access frequency) Old block and young block (erase counts) Basic principle Prevent old blocks from being erased(cool down) Start erasing young blocks actively(heat up) 首先介绍一下磨损平衡的基本情况。前面讲的页级映射模式主要是减少擦除操作,提高闪存的读写性能。但是闪存还有另外一个特点就是有限的擦除次数 访问负载的区域性特点使得闪存中block之间的擦除次数是不均衡的,这对闪存的寿命有很大影响 Wear Leveling 的基本思想就是尽可能均匀的擦除block;

26 Wear Leveling Cold data migration Related work(Hybrid FTL Scheme)
move cold data from young blocks to old blocks Select young blocks when execute garbage collection Related work(Hybrid FTL Scheme) A Low-Cost Wear-Leveling Algorithm for Block-Mapping Solid-State Disks (lazy scheme) (LCTES2011) Cold data migration :将冷数据迁移到old block 中 因为冷数据不会频繁的更新,存放冷数据的block被擦除的该概率比较低。

27 Lazy Scheme Overview Recency Frequency Cold data migration
Consider recency (recent wear history ) and frequency Recency Update recency ( a logical block ) the time length since the latest update to a logical block Erase recency ( a physical block ) the time length since the latest erase operation on a physical block Frequency Elder block larger than the average erase count Junior block smaller than the average erase count lazy 模式将擦除块的最近擦除情况和当前的擦除状态进行了一个有效地结合, 原因是根据时间局部性的特点最近被更新的逻辑块有可能会很很快被再次更新,而它对应的物理块也就很可能再次被擦除。 根据这两个因素来选择擦除平衡选择的对象,会使擦除更加均衡

28 Lazy Scheme The goal of wear-leveling is that a block should keep its erase count close to the average. 下面通过一幅图来阐述作者的主要想法:为了降低磨损平衡的工作负载我们只对部分数据块感兴趣。首先找出最近擦除程度低的年轻块(也就是存放冷数据的数据块); 把数据迁移到最近擦除程度高的年老的块(含有热数据)。让这些年轻块参入到垃圾回收中,增加他们被擦除次数,从而达到磨损平衡 For junior block, we are interested in Block e and f. For elder block, we are interested in block a and b. We need to move valid data in block e and f to block a and b Re-map e and f to a and b and select Block e and f as victim blocks

29 Algorithm

30 Lazy Scheme Pros does not store wear information in RAM, but leaves all of this information in flash instead. utilizes the address-mapping information available and do not need to add extra data structures for wear leveling Cons It is important to uniformly visit every logical block when selecting a logical block for re-mapping.

31 Outline Introduction Flash Translation Layer Address Mapping
1 Introduction 2 Flash Translation Layer 3 Address Mapping 4 Wear Leveling 5 Conclusion

32 Conclusion Conclusion
Page mapping scheme shows the best performance in that it can decrease erase operations It is necessary to design an efficient wear leveling scheme for Page-Mapping Solid-State disks Some operations in FTL can be executed without interrupting current flash accesses by exploiting internal parallelism of flash memory As write caching to reduce erase operation SSD for primary storage, auxiliary PCM 页级映射模式大大减少了擦除操作,提高了ssd的性能 目前磨损平衡策略都是针对块级或混合级映射而设计的。设计基于页级映射是磨损平衡策略是非常必要的 可以利用ssd内部的并行机制,通过巧妙地设计使得ftl的几种操作与上层数据访问并行执行,提高整体性能 减少擦除操作也可以从硬件着手,将磁盘、SSD、pcm等组合在一起;构成混合存储系统; 比如 可以让磁盘或PCM作为ssd的写缓冲用于处理写操作和更新,减少擦除操作,ssd则主要用于处理读操作等。

33 Thank you


Download ppt "Trading Flash Translation Layer For Performance and Lifetime"

Similar presentations


Ads by Google