最近需要使用到 FSCache,今天调研一下FS-Cache,主要记录一些索引,方便以后查阅:

RedHat 文档:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/ch-fscache (此文档讲解较为详细)

内核社区文档: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 https://blog.csdn.net/luckytanggu/article/details/78476634 (此篇文章较为实践,我也进行了相同的测试,显示fscache起作用,大家可以参考)

关于linux内核中对文件系统的cache大家可以参考此链接:https://www.kernel.org/doc/Documentation/filesystems/caching/ (内核文件系统cache详细文档)

FS-Cache 配置文件解析:

###############################################################################
#
# Copyright (C) , 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
# of the License, or (at your option) any later version.
#
############################################################################### dir /var/cache/fscache # 自定义缓存目录
tag mycache # 标签,用于区分多个缓存
brun % # 剩余空间大于这个设置值时,自动进行缓存
bcull % # 剩余空间大于这个设置值时,开始自动删除使用频率最低的缓存
bstop % # 剩余空间小于这个设置值时,缓存功能关闭 # 开头的参数则是按照文件数来计算%, 其原理与根据block数(剩余空间)计算是一样的。
frun %
fcull %
fstop % # 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.

cachefiles参数说明

三对参数应该满足的关系:

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 可以卸载和安装内核模块;具体其他操作,可以查找相应的手册;

FS-Cache 调研的更多相关文章

  1. vxWorks6.6 N270 D525 cpu的bsp配置总结

    对硬盘的操作 使用SATA硬盘,分区,引导区(VxC:)必须格式化为FAT(FAT16)格式,所以该分区大小有限制,不能超过4G(4G大小带测试),设置C:为"活动的": 主机上安 ...

  2. Linux云计算运维-MySQL

    0.建初心 优秀DBA的素质 1.人品,不做某些事情2.严谨,运行命令前深思熟虑,三思而后行,即使是依据select3.细心,严格按照步骤一步一步执行,减少出错4.心态,遇到灾难,首先要稳住,不慌张, ...

  3. linux分析、诊断及调优的必备“杀器”之一

    下面分别列出linux分析.诊断及调优时用到的工具,并分别进行说明,以方便自己和其他同学参考学习,禁止转载. 1.top top - 02:06:59 up 4 days, 17:14, 2 user ...

  4. ES内存持续上升问题定位

      https://discuss.elastic.co/t/memory-usage-of-the-machine-with-es-is-continuously-increasing/23537/ ...

  5. linux I/O stack cache 强制刷新

    linux 存储子系统作为最为复杂的子系统之一,拥有很深的模块栈(如图),其中很多模块又有自己的缓存功能(如下图).实际应用中,用户下发的数据停留在哪个缓存中,是否已经写入磁盘,这些操作对用户来说是个 ...

  6. LINUX内核参数FS与VM相关

    文件系统相关 fs.aio-nr = 0 当前aio请求数 fs.aio-max-nr = 1048576 最大允许的aio请求数 fs.file-nr = 3456 0 94159 已分配的文件ha ...

  7. Solr调研总结

    http://wiki.apache.org/solr/ Solr调研总结 开发类型 全文检索相关开发 Solr版本 4.2 文件内容 本文介绍solr的功能使用及相关注意事项;主要包括以下内容:环境 ...

  8. Operating System Memory Management、Page Fault Exception、Cache Replacement Strategy Learning、LRU Algorithm

    目录 . 引言 . 页表 . 结构化内存管理 . 物理内存的管理 . SLAB分配器 . 处理器高速缓存和TLB控制 . 内存管理的概念 . 内存覆盖与内存交换 . 内存连续分配管理方式 . 内存非连 ...

  9. Linux Cache Mechanism Summary(undone)

    目录 . 缓存机制简介 . 内核缓存机制 . 内存缓存机制 . 文件缓存机制 . 数据库缓存机制 1. 缓存机制简介 0x1: 什么是缓存cache 在计算机整个领域中,缓存(cache)这个词是一个 ...

随机推荐

  1. HDU3896 Greatest TC(双联通分量+倍增)

    Problem Description TC (Tian Chao) is magical place, as you all know...The railways and the rail-sta ...

  2. 一位资深程序员面试Python工程师的岗位心得和历程【新手必须】

    前言本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理.作者:程序员阿牛说一些面试的心得体会: 1.简历制作我做了两份简历,用两个手机 ...

  3. Everspin非易失性MRAM切换技术

    切换MRAM技术 切换MRAM使用1个晶体管,1个MTJ单元来提供简单的高密度存储器.Everspin使用获得专利的Toggle电池设计,可提供高可靠性.数据在温度下20年始终是非易失性的. 在读取期 ...

  4. Kubernetes基本概念和术语之《Master和Node》

    Kubernetes中的大部分概念如Node.Pod.Replication Controller.Service等都可以看作一种“资源对象”,几乎所有的资源对象都可以通过Kubernetes提供的k ...

  5. Soc常见问题

    SOC常见问题解答 1.SOC FPGA中的ARM是软核还是硬核?ARM核的外设是软核还是硬核? SOC FPGA 中的ARM核是硬核.所以简称HPS,Hardware Processor Syste ...

  6. webpack学习2.3webpack核心概念

    核心概念(四个) Entry(入口) Output(出口) Loaders()来处理其他类型的资源文件 Plugins(插件) 1.入口(Entry) 作用:代码的入口,打包的入口,单个或多个, 示例 ...

  7. 使用Power BI API 向流数据集推送实时数据并在仪表板可视化

    使用Power BI 实现实时数据的可视化是大家比较关心的一个话题,在仪表盘上实现推送数据的展示,可以在诸如指挥大屏等场景下使用. 本视频实战内容如下: https://v.qq.com/x/page ...

  8. VS2019 开发Django(四)------models

    导航:VS2019开发Django系列 继上篇我们匆匆迁移数据库成功之后,又花了一个晚上研究了Django的模型,这里的模型其实就是ORM模型中的Entity,.Net里边用的比较多的有Entity ...

  9. Spring Boot启动提示:org.apache.catalina.LifecycleException: A child container failed during start

    一.问题回顾 最近在做一个新项目,从git上下载导入idea后,启动项目,但是报了如下错误: java.util.concurrent.ExecutionException: org.apache.c ...

  10. js实现弹出框跟随鼠标移动

    又是新的一天网上冲浪,在bing的搜索页面下看到这样一个效果: 即弹出框随着鼠标的移动而移动.思路大概为: 调用onmousemove函数,将鼠标的当前位置赋予弹出框即可 //html <div ...