1 / 21

开源混合存储方案 Flashcache

开源混合存储方案 Flashcache. 余锋 褚霸 淘宝核心系统 mryufeng@gmail.com http://yufeng.info. 互联网业务特点. 人多 请求是人发起的,天然读多写少(懒人多) 熟人之间的关系,天然有热点. 数据存储的需求. 业务特点反应在存储上: 数据量大 读多写少 有热点. 机械硬盘特点. 机械结构,寻道时间长,随机访问慢,高延迟时间 顺序访问速度快 每GB成本低,容量大 机械故障,磨损少. 固态盘特点. 电子器件,无活动部件,可靠性高 随机访问,无需寻道时间,低延迟时间 每GB成本相对高,容量相当小

svein
Download Presentation

开源混合存储方案 Flashcache

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 开源混合存储方案Flashcache 余锋 褚霸 淘宝核心系统 mryufeng@gmail.com http://yufeng.info

  2. 互联网业务特点 • 人多 • 请求是人发起的,天然读多写少(懒人多) • 熟人之间的关系,天然有热点

  3. 数据存储的需求 业务特点反应在存储上: • 数据量大 • 读多写少 • 有热点

  4. 机械硬盘特点 • 机械结构,寻道时间长,随机访问慢,高延迟时间 • 顺序访问速度快 • 每GB成本低,容量大 • 机械故障,磨损少

  5. 固态盘特点 • 电子器件,无活动部件,可靠性高 • 随机访问,无需寻道时间,低延迟时间 • 每GB成本相对高,容量相当小 • Nand芯片有擦写寿命

  6. 如何利用二者的优点 • 硬盘的高容量,高顺序访问,低成本 • 固态盘的高随机访问,低延迟时间

  7. 如何不多花钱呢? 欢迎Flashcache闪亮登场!

  8. Flashcache介绍 作者 Mohan Srinivasan 源于Facebook,初始用于加速MySQL InnoDB引擎IO 现在是通用的软件方案块设备加速器 内核模块,支持主流64位Linux 更多访问:http://github.com/facebook/flashcache

  9. Flashcache在内核的层次

  10. Flashcache特性 • 免费,高性能 • Device Mapper层,对外服务体现方式是块设备,无需修改应用 • 支持write back和write through二种模式 • 运行期状态可调整和查看

  11. 我有兴趣!!! 快告诉我如何用!

  12. 硬件设备 • PCI-E 高速Flash卡:/dev/vgca0 • 硬盘: /dev/sda12

  13. 安装 • 准备好你的源码树 • make install

  14. 加载 if (初次) flashcache_create  cachedev /dev/vgca0 /dev/sda12 else flashcache_load  cachedev /dev/vgca0 /dev/sda12 请稍候... 在/dev/mapper目录下看到我们的虚拟设备 cachedev 我们的混合盘就绪了: /dev/mapper/cachedev

  15. 使用 • 裸盘使用 • 安装文件系统: mkfs.ext3 /dev/mapper/cachedev

  16. 微调参数 # sysctl dev.flashcache dev.flashcache.cache_all = 0dev.flashcache.reclaim_policy = 0dev.flashcache.dirty_thresh_pct = 90

  17. Cache管理 • 预加载文件:flashcache_cacheit  filename • 删除Cache中的文件:flashcache_trim filename • 添加进程名单:flashcache_addpids <device_name> w|b pid1 • 删除进程名单:flashcache_delpids <device_name> w|b pid1

  18. 查看状态 • # dmsetup status cachedev • # dmsetup table cachedev • # dmsetup info cachedev

  19. 移除设备 • # dmsetup remove cachedev • 耐心等候

  20. 效果呢? 固态盘IO能力 * 热点百分比 还便宜!

  21. 谢谢大家! Q&A

More Related