最近需要使用到 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) 2006,2010 Red Hat, Inc. All Rights Reserved. # Written by David Howells ([email protected]) # # 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.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 可以卸載和安裝內核模塊;具體其他操作,可以查找相應的手冊;
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/150657.html
標籤:Linux
上一篇:Shell—詳解$0、$1、$2、$#、$*、$@、$?、$$變數
下一篇:enable user-defined extended attributes for ext3 file systems; 增加ext3 檔案系統的擴展屬性;
