智汇华云 | flashcache原理及实践中
2023-03-07 来源 : 电影
分派的意图可以看flashcache_map给定,管控语义则主要在给定flashcache_io_callback内部说明,the same block的继续前进配置文件前提为飞龙,如果不为飞龙,则某种程度才会子程序flashcache_do_handler,制订对继续前进配置文件的管控。
5、统计数器据分派
对读完,转送到bio,首先,根据 bio->bi_sector,即闪存的字节号,得到SSD上的set。其次,在set内查找前提里弹,如果里弹,则将闪存的字节号切换为SSD的 字节号,然后将此bio向SSD草拟,进行时录入;如果未曾里弹,则首先向闪存转子草拟bio,从闪存读完统计数器据,录入叫停后,由难以付诸给定叫停回写出SSD操作方法,将 bio的字节号切换为SSD的=字节号,然后向SSD应用程序草拟,将闪存录入的统计数器据录入SSD。对写出,同文件系统页填充,不一定另行录入闪存,而是录入 SSD,同时,保持良好一个阀值,一般为20%,在好像块数目达到此数值时,写出回硬盘。
6、API地址:
7、堆栈方法 flashcache支持三种堆栈方法:
Writeback : 对于录入,首先才会录入到Cache里,同时将对于block的元统计数器据dirty bit,但是不一定才会马上录入后备的device
Writethrough : 对于录入,录入到Cache里,同时也才会将统计数器据录入backing device,告诉他写出完backing device,仍要写出完
Writearound : 录入的时候,穿过Cache,另行录入backing device,即SSD只当读完堆栈
二、安装软件包
1、升级软件包
# rpm -ivh kernel-4.4.199-1.x86_64.rpm
# rpm -ivh kernel-devel-4.4.199-1.x86_64.rpm
2、转化grub
# grub2-set-default 0 && grub2-mkconfig -o /etc/grub2.cfg
3、重为启
# reboot
三、安装flashcache 1、安装相反应用软件
# yum install -y git make gcc
2、Appflashcache软件包
# git clone
3、PHP安装
# cd flashcache/
# make
# make install
4、写入软件包组件
# modprobe flashcache
体检
# lsmod | grep flashcache
flashcache 106496 1
dm_mod 110592 11 dm_log,dm_mirror,flashcache
5、则才会写入软件包组件完工后文件/etc/sysconfig/modules/flashcache.modules内容如下
#! /bin/sh
/sbin/modinfo -F filename flashcache> /dev/null 2>&1
if [ $? -eq 0 ]; then
/sbin/modprobe flashcache
fi
赋予权限
# chmod +x /etc/sysconfig/modules/flashcache.modules
6、始创堆栈仪器
# flashcache_create -p back -b 4k cachedev /dev/sdc /dev/sdb
cachedev cachedev, ssd_devname /dev/sdc, disk_devname /dev/sdb cache mode WRITE_BACK
block_size 8, md_block_size 8, cache_size 0
Flashcache metadata will use 440MB of your 32172MB main memory
值说明:
-p:堆栈方法 writeback,writethrough,writearound三种。
-s:堆栈大小不一,可中选项,如果未曾常指定则整个SSD仪器被运用于堆栈,默认的计数器一个单位是字节(sectors),但是可以放弃k/m/g一个单位。
-b:常指定块大小不一,可中选项,默认为4KB,须要为2的常指数。默认一个单位为字节。也可以用K作为一个单位,一般中选4KB。
-f:强制始创,不进行时体检
警惕: 慢速的ssd和后前端HDD硬盘可以是一个分区也可以是一块硬盘
7、堆栈硬盘
# mkfs.xfs /dev/mapper/cachedev
8、检视正常
# ll /proc/flashcache/sdc+sdb/
total 0
-r----r----r---- 1 root root 0 Dec 16 14:05 flashcache_errors #flashcache 卷的缺失讯息调查报告
-r----r----r---- 1 root root 0 Dec 16 14:05 flashcache_iosize_hist
-r----r----r---- 1 root root 0 Dec 16 14:05 flashcache_pidlists
-r----r----r---- 1 root root 0 Dec 16 14:05 flashcache_stats #flashcache 卷的统计讯息调查报告
9、检视说明的识字和里弹率讯息
# dmsetup status cachedev
0 419430400 flashcache stats:
reads(391120), writes(45940753)
read hits(337167), read hit percent(86)
write hits(20875155) write hit percent(45)
dirty write hits(20807737) dirty write hit percent(45)
replacement(11844), write replacement(183083)
write invalidates(5), read invalidates(19)
pending enqueues(33090), pending inval(33090)
metadata dirties(20621560), metadata cleans(1832026)
metadata batch(22220959) metadata ssd writes(232627)
cleanings(1832026) fallow cleanings(0)
no room(4520223) front merge(124207) back merge(1697772)
force_clean_block(0)
disk reads(53953), disk writes(6344364) ssd reads(2169176) ssd writes(41674210)
uncached reads(41405), uncached writes(4512356), uncached IO requeue(0)
disk read errors(0), disk write errors(0) ssd read errors(0) ssd write errors(0)
uncached sequential reads(0), uncached sequential writes(0)
pid_adds(0), pid_dels(0), pid_drops(0) pid_expiry(0)
lru hot blocks(10444544), lru warm blocks(10444544)
lru promotions(0), lru demotions(0)
10、检视软件包讯息
# sysctl -a | grep flashcache
dev.flashcache.sdc+sdb.cache_all = 1
dev.flashcache.sdc+sdb.clean_on_read_miss = 0
dev.flashcache.sdc+sdb.clean_on_write_miss = 0
dev.flashcache.sdc+sdb.dirty_thresh_pct = 20
dev.flashcache.sdc+sdb.do_pid_expiry = 0
dev.flashcache.sdc+sdb.do_sync = 0
dev.flashcache.sdc+sdb.fallow_clean_speed = 2
dev.flashcache.sdc+sdb.fallow_delay = 900
dev.flashcache.sdc+sdb.fast_remove = 0
dev.flashcache.sdc+sdb.io_latency_hist = 0
dev.flashcache.sdc+sdb.lru_hot_pct = 75
dev.flashcache.sdc+sdb.lru_promote_thresh = 2
dev.flashcache.sdc+sdb.max_clean_ios_set = 2
dev.flashcache.sdc+sdb.max_clean_ios_total = 4
dev.flashcache.sdc+sdb.max_pids = 100
dev.flashcache.sdc+sdb.new_style_write_merge = 0
dev.flashcache.sdc+sdb.pid_expiry_secs = 60
dev.flashcache.sdc+sdb.reclaim_policy = 0
dev.flashcache.sdc+sdb.skip_seq_thresh_kb = 0
dev.flashcache.sdc+sdb.stop_sync = 0
dev.flashcache.sdc+sdb.zero_stats = 0
11、安装正常查看应用软件
# cp /root/flashcache-master/utils/flashstat /bin/
# chmod +x /bin/flashstat
# flashstat
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
sysctl: reading key "net.ipv6.conf.eth0.stable_secret"
sysctl: reading key "net.ipv6.conf.lo.stable_secret"
======================================================================================================
Flashstat: a tool for flashcache status per second
Author : NinGoo(seaman.ning@gmail.com)
Version : 0.3
======================================================================================================
SSD Device: /dev/sdc Disk Device: /dev/sdb Cache Mode: WRITE_BACK
Capacity: 81598M Block Size: 4K Meta Block Size: 4096b
Total Blocks: 20889088 Cached Blocks: 159897 Cached Percent: 0
Set Numbers: 512 Dirty Blocks: 125921 Dirty Percent: 0
cache_all: 1 reclaim_policy: FIFO dirty_thresh_pct: 20
max_clean_ios_set: 2 max_clean_ios_total: 4 skip_seq_thresh: 0K
======================================================================================================
time read/s write/s diskr/s diskw/s ssdr/s ssdw/s uread/s uwrit/s metaw/s clean/s repl/s wrepl/s hit% whit% dwhit%
12-16 14:32:33 0 98813 0 0 0 99355 0 0 541 0 0 0 0|63 0|0 0|0
12-16 14:32:34 0 112569 0 0 0 113211 0 0 636 0 0 0 0|63 0|0 0|0
12-16 14:32:35 0 111352 0 0 0 112019 0 0 666 0 0 0 0|63 0|0 0|0
12-16 14:32:36 0 84825 0 0 0 85362 0 0 543 0 0 0 0|63 0|0 0|0
12-16 14:32:38 0 102305 0 0 0 102848 0 0 537 0 0 0 0|63 0|0 0|0
12-16 14:32:39 0 109665 0 0 0 110322 0 0 662 0 0 0 0|63 0|0 0|0
12-16 14:32:40 0 158722 0 0 0 159609 0 0 887 0 0 0 0|63 0|0 0|0
12、卸载
# dmsetup info cachedev
Name: cachedev
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 0
Event number: 0
Major, minor: 253, 2 #从仪器号2
Number of targets: 1
# dmsetup remove /dev/dm-2
# flashcache_destroy /dev/sdc
flashcache_destroy: Destroying Flashcache found on /dev/sdc. Any data will be lost !!
# dmsetup remove cachedev
# flashcache_destroy /dev/sdc -f
四、遇到的关键问题
1、重为启再次仪器没了
# modprobe flashcache
# modprobe -r flashcache
# flashcache_load /dev/sdc
。宁波看妇科去哪家医院比较好宁波哪家专科医院治疗前列腺炎好
信阳看妇科去哪家医院比较好
西安看白癜风去哪里比较好
北京甲状腺医院那家比较好
-
守住安全底线 让文物“光阴”起来
本周有两条关于出土文物的新闻倍受关注。一条是马首雕像重回圆明园。时隔160年,外流境外重要出土文物马首雕像终回故土。马首雕像不再是一件皇家偷,而是归属于人民的自然遗产。另一条是最高人民检察院对外...
-
蔚来汽车申请注册多个酒类商标 含“微醺该球队”“蔚来微醺该球队”“NIO BAR”等
e美国公司讯,企查查APP显示,武汉蔚来货车有限美国公司申领注册“光之子”品牌,国际形态学为啤酒,当前品牌静止状态为申领里。此外,蔚来货车先后申领多个“微醺埃弗顿”“蔚来微醺埃弗顿”和“NIO BAR...[详细]
-
《佛印禅师》读书分享会主办
12月末4日,长篇小说《佛印居士》念书个人会在云南大学举行。图为《佛印居士》个人会上,《佛印居士》作者——国家民委原副组长、香港地区全国人大民委副组长委员吴仕民介绍了...[详细]
-
在PT精品解开中国电信“色彩密码”
动深耕5G、光网、生物科技等从新型基础设施筹建,落成全球最主要规模的5G SA合建共享商用的网络。在“皓”总体,中所国移动积极前推“天前部皓”向“2+4+31+X+O”的层次所谓布局演进,实现网随皓动...[详细]
-
牛市价位未来肯定来
今天是2022年2月6日,春节假期快要结束了,明日2月7日周一股县内就要开盘。很多投资人非常重视紧接著衍生品怎么走去。我要说的是未来牛县内衍生品无疑亦会来,直到现在就是熬着,到底牛县内衍生品是...[详细]
-
连续开播一个星期,只卖了几十单,还限流了,到底是我玩抖音还是抖音玩我,今晚如常一下,和朋友看个电影
连续开播一个星期,只卖了几十单,还确保安全了,真的是我玩乐抖音还是抖音玩乐我,再来走动一下,和朋友看个影片a href="http:pdsbdf.999ask....[详细]