Flashcache First Experience

Source: Internet
Author: User

First, Introduction

Flashcache is a block device write-back cache kernel module developed for the Linux operating system, using device Mapper, the purpose of which is to accelerate the read and write performance of SAS disk with SSD by Flashcache module, and provide the IOPS of SAS disk. This module is open source by Facebook, source code address: Https://github.com/facebook/flashcache

Ii. Environmental Notes

1. Kernel version requirements (official record)

Flashcache to later Linux releases. We are now having built Flashcache on 2.6.18, 2.6.20 and 2.6.27-32. We have tested Flashcache on 2.6.18, 2.6.20, 2.6.27 and 2.6.32.

2, Equipment description

/DEV/SDB3 SAS disk/dev/dda SSD disk/cache cache Volume mount Directory

Third, environmental installation

Https://github.com/facebook/flashcache/archive/master.zipunzip FLASHCACHE-MASTER.ZIPCD Flashcache-mastermakemake Installmodprobe Flashcache # #加载flashcache模块lsmod | grep Flash # #查看flashcache模块是否加载echo "Modprobe flashcache" >>/etc/rc.local # #开机加载flashcac He module

Iv. creation, loading, and deletion of cache volumes

1. Create a cache volume

Flashcache_create-p back-s 50g-b 4k cachedev/dev/sda/dev/sdb3 # #建成功会在/dev/mapper/generate a device with a volume name named MOUNT/DEV/MAPPER/CAC hedev/cache/# #挂载即可使用了

Parameter description:

-P: Cache mode writeback,writethrough,writearound three kinds.
-S: Cache size, optional, if not specified the entire SSD device is used for caching, the default count unit is sector (sectors), but can accept k/m/g units.
-B: Specifies the block size, optional, default to 4KB, and must be an exponent of 2. The default unit is sector. can also use K as a unit, generally choose 4KB.
-F: Forced creation, no check

2. Cache Volume loading

Syntax: Flashcache_load ssd_devname cachedevname, load an already existing cache volume when the machine restarts and needs to be loaded

FLASHCACHE_LOAD/DEV/SDA Cachedev

3. Destroying cache Volumes

Flashcache_destroy/dev/sda

4. Delete Flashcache Volume

Dmsetup Remove Cachedev

Ps:

For Writethrough and Writearound mode caches, the disk is deleted or restarted, and the volume is deleted

Five, Flashcache boot configuration

Cp/root/flashcache-master/utils/flashcache/etc/init.d/chmod +x/etc/init.d/flashcachechkconfig--add/etc/init.d/ Flashcache

Vi/etc/init.d/flashcache # #填写几个变量的参数

Ssd_disk=/dev/sdabackend_disk=/dev/sdb3cachedev_name=cachedevmountpoint=/cacheflashcache_name=sda+sdb3

Six, Flashcache Tuning

Flashcache.fast_remove = 1: Open the Fast Remove feature to shut down the machine without writing the dirty blocks in the cache to disk.
Flashcache.reclaim_policy = 1: Dirty block brush out policy, 0:FIFO,1:LRU.
flashcache.dirty_thresh_pct = the dirty block threshold on each hash set on the 90:flashcache.
Flashcache.cache_all = 1:cache All content, you can filter by blacklist.
Flashecache.write_merge = 1: Open write merge to improve performance of the write disk.

Here's how:

1, execute "sysctl dev.flashcache" command, print out about Flashcache can adjust the options

Sysctl Dev.flashcache >>/etc/sysctl.conf

2, after the adjustment, the implementation of "SYSCTL-P" effective

Seven, monitoring

1, Flashcache volume error message report in/proc/flashcache/<cache name>/flashcache_errors:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4D/11/wKiom1RKIfvxDAI4AAEUbVNL0PI814.jpg "title=" Image111111.png "alt=" Wkiom1rkifvxdai4aaeubvnl0pi814.jpg "/>

2, Flashcache volume of statistical Information report in/proc/flashcache/<cache Name>/flashcache_stats:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/4D/12/wKioL1RKIm6gYUSYAAOmp-3adic601.jpg "title=" Image.png "alt=" Wkiol1rkim6gyusyaaomp-3adic601.jpg "/>

3. Cache statistic Information

You can use the Dmsetup status cachename command to query the cache statistics. "Dmsetup table CacheName" command can be dumps out ACHCE related statistics

4. Using Flashstat to monitor Cachedev use situation

cp/root/flashcache-master/utils/flashstat/bin/

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4D/12/wKioL1RKIrLTq5pvAAhm8PmLJ8Y859.jpg "title=" Image.png "alt=" Wkiol1rkirltq5pvaahm8pmlj8y859.jpg "/>

Eight, with FIO pressure test SAS disk (Flashcache acceleration before and after the contrast)

Flashcache before accelerating

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4D/12/wKioL1RKIwqzSceoAAIXqFE5sjY296.jpg "title=" Image111.png "alt=" Wkiol1rkiwqzsceoaaixqfe5sjy296.jpg "/>

Flashcache after acceleration

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4D/11/wKiom1RKIsTBnFJpAAJJfCwLSW0388.jpg "title=" Image.png "alt=" Wkiom1rkistbnfjpaajjfcwlsw0388.jpg "/>

This article from the "Cock Silk ops man" blog, declined reprint!

Flashcache First Experience

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.