FS-Cache 调研
最近需要使用到 fscache,今天调研一下fs-cache,主要记录一些索引,方便以后查阅:
redhat 文档: (此文档讲解较为详细)
内核社区文档:https://www.kernel.org/doc/documentation/filesystems/caching/fscache.txt
fs-cache: a network filesystem caching facility:https://people.redhat.com/dhowells/fscache/fs-cache.pdf
nfs 相关,请阅读:https://www.cnblogs.com/xuyaowen/p/nfs_install.html (之前写的关于nfs安装相关的内容)
使用nfs缓存减少io (此篇文章较为实践,我也进行了相同的测试,显示fscache起作用,大家可以参考)
关于linux内核中对文件系统的cache大家可以参考此链接:https://www.kernel.org/doc/documentation/filesystems/caching/ (内核文件系统cache详细文档)
fs-cache 配置文件解析:
############################################################################### # # copyright (c) 2006,2010 red hat, inc. all rights reserved. # written by david howells (dhowells@redhat.com) # # this program is free software; you can redistribute it and/or # modify it under the terms of the gnu general public license # as published by the free software foundation; either version # 2 of the license, or (at your option) any later version. # ############################################################################### dir /var/cache/fscache # 自定义缓存目录 tag mycache # 标签,用于区分多个缓存 brun 10% # 剩余空间大于这个设置值时,自动进行缓存 bcull 7% # 剩余空间大于这个设置值时,开始自动删除使用频率最低的缓存 bstop 3% # 剩余空间小于这个设置值时,缓存功能关闭 # 开头的参数则是按照文件数来计算%, 其原理与根据block数(剩余空间)计算是一样的。 frun 10% fcull 7% fstop 3% # assuming you're using selinux with the default security policy included in # this package secctx system_u:system_r:cachefiles_kernel_t:s0
brun n% (percentage of blocks) , frun n% (percentage of files) if the amount of free space and the number of available files in the cache rises above both these limits, then culling is turned off. bcull n% (percentage of blocks), fcull n% (percentage of files) if the amount of available space or the number of files in the cache falls below either of these limits, then culling is started. bstop n% (percentage of blocks), fstop n% (percentage of files) if the amount of available space or the number of available files in the cache falls below either of these limits, then no further allocation of disk space or files is permitted until culling has raised things above these limits again.
三对参数应该满足的关系:
0 ≤ bstop < bcull < brun < 100
0 ≤ fstop < fcull < frun < 100
注意:culling depends on both bxxx and fxxx pairs simultaneously; they can not be treated separately.
其他参考地址:/usr/share/doc/kernel-doc-version/documentation/filesystems/caching/fscache.txt
关于nfs fsc 选项的说明(fsc选项):
阅读摘要:
- yum install cachefilesd;
- 挂载命令:直接mount服务端共享的目录到本地的/mnt目录,必须使用-o fsc参数选项;
- all access to files under /mount/point will go through the cache, unless the file is opened for direct i/o or writing;
- opening a file from a shared file system for direct i/o automatically bypasses the cache. this is because this type of access must be direct to the server.
-
to avoid coherency management problems between superblocks, all nfs superblocks that wish to cache data have unique level 2 keys. normally, two nfs mounts with same source volume and options share a superblock, and thus share the caching, even if they mount different directories within that volume.
- opening a file from a shared file system for writing will not work on nfs version 2 and 3. 因为没有足够的维持并发写的一致性信息;
-
furthermore, this release of fs-cache only caches regular nfs files. fs-cache will not cache directories, symlinks, device files, fifos and sockets. 其只对文件数据进行cache的操作。
保持更新,资源来源自网络,此文章主要是用来索引,如果您有相关问题,请关注cnblogs.com/xuyaowen;
# 更新 12.3.2019
- cachefiles 为 fscache的后端;cachefs也是 fscache的后端;
- cachefiles 和 fscache都集成到了linux 内核中;作为单独的模块;好像 cachefs没有继承到内核之中,说明cachefiles较为常用,已经合并到内核之中,说明该功能模块,较为稳定。
- 对应的linux内核模块为 cachefiles.ko 和 fscache.ko,在 /lib/modules/内核版本/kernel/fs/之中;
- 同理,我们在相应的内核模块目录中,可以查看fuse的内核模块:cuse.ko; 使用modprobe -v 可以加载;rmmod和inmod 可以卸载和安装内核模块;具体其他操作,可以查找相应的手册;
推荐阅读
-
黑龙江省委常委、哈尔滨市委书记参观调研优易数据哈尔滨基地
-
全国政协副主席领导 一行莅临景安参观调研|景安
-
广东省委副秘书长张劲松一行莅临海云数据参观调研
-
四款Zen3处理器销量调研:12核锐龙9 5900X完胜
-
人民日报调研利迅达机器人
-
中国建博葵花奖调研团莅临好易点 揭秘火爆增长背后的秘密
-
科技部高新司永川调研机器人产业
-
全新美图手机明年发布 林斌微博为新机调研
-
NCCL(Nvidia Collective multi-GPU Communication Library) Nvidia英伟达的Multi-GPU多卡通信框架NCCL 学习;PCIe 速率调研;
-
武进区:开展机器人产业调研诊断工作