智汇华云 | flashcache物理现象及实践
发布时间:2025/11/10 12:17 来源:象山家居装修网
4、源字符串布局
两个社会活动函数调用。建构device mapper字符串,之外是dm.c可以知道,在加载flashcache_create工具有创设flashcache电子元件时,亦会加载 flashcache_ctlformula_,分派创设工具有,它亦会创设一社会活动函数调用_delay_clean,主要负责对整个cache电子元件的脏块搬运,由 flashcache_clean_set在前提下加载(见字符串),通过flashcache_clean_all分派对所有sets的成像与搬运。 另外一个社会活动函数调用,_kq_xxx,在flashcache_init当中,由flashcache子系统存储时分派,通过对5个job链表展开 管控,分派统枚举据库的升级与完毕管控formula_、读过硬盘后的SSD只读过、以及对下次函数调用的管控,主要就是负责举例来说后的管控社会活动隶属于直觉管控子系统,即“举例来说后管控 子系统”,由硬盘或SSD举例来说后不尽相同意味着被配置。
配置的时机可以看flashcache_mapformula_,管控直觉则主要在formula_flashcache_io_callback内部判断,the same block的下次函数调用应该为空,如果不为空,则值得注意亦会加载flashcache_do_handler,分派对下次函数调用的管控。
5、统枚举据配置
对读过,转交到bio,首先,根据 bio->bi_sector,即硬碟的格式化号,得到SSD上的set。其次,在set内排序应该击当中前提,如果击当中前提,则将硬碟的格式化号反转为SSD的 格式化号,然后将此bio向SSD审批,展开读过取;如果没人击当中前提,则首先向硬碟动力审批bio,从硬碟读过统枚举据,读过取完毕后,由回退formula_触发回撰写SSD操作者,将 bio的格式化号反转为SSD的=格式化号,然后向SSD动力程序审批,将硬碟读过取的统枚举据只读过SSD。对撰写,同应用程序页内置,极为值得注意只读过硬碟,而是只读过 SSD,同时,保持一个阀值,一般为20%,在脏块比例达到此误差时,撰写回硬盘。
6、源字符串地址:
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、流媒体flashcache开发人员
# git clone
3、编译内置
# 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
。杭州妇科医院哪家比较专业莆田白癜风专科医院哪好
武汉癫痫检查费用
漳州看白癜风哪里好
西安看白癜风哪家医院好
百姓健康
支原体肺炎吃什么药止咳化痰
怎么解酒
风热感冒咳嗽吃什么好的快
妇产科

-
“你怎么哭了?”湖州爸爸“失态”落泪,儿子却说:那一刻鼓励我走到今天
比起母亲节,外祖父节的气氛是含蓄的。 毕竟,一句“外婆,我爱你”,有点难出口。 不是不爱,来得多的时候,含蓄、噩梦、行动说话,这才是你和外祖父的沟通。
- 2025-11-10深夜,警察队猛翻垃圾堆,只为一个承诺…
- 2025-11-1047只!以外来自境外
- 2025-11-105000万人在线追!话剧电视直播能否觅知音
- 2025-11-10小心!浙江一医院2天接收10多例,3人幸运地瘫痪!最近很多人在做这事,“老师傅”更要注意…
- 2025-11-10老爸为女儿囤了一阳台塑料袋 你家中老人喜欢囤塑料袋吗
- 2025-11-10看!强降雨来临时,他们,在地面部队!
- 2025-11-102022北京高考外语卷已现满分作文,6月25日发布高考成绩
- 2025-11-10*ST中潜聘任汪源担任美国公司财务总监 2021年美国公司亏损1.43亿
- 2025-11-10嗨德福德财务负责人蔡雪清辞职 张旻接任 2021年年末公司亏损34.01万
- 2025-11-10上海莱士股东莱士中国被动增资3547.9万股 2021年公司净利12.95亿