Linux – mount – Disable Linux NFS Client Caching

Loading

在 RHEL5 下的 NFS 檔案分享中,發現了網路流量有點不是很正確,通常寫入會比讀多,這到底是怎麼一回事. 點開了 Kernel 的說明,在 NFS v4 之後有一個功能 "Provide NFS client caching support" 透過他是可以增加 NFS 的效能.
kernel_nfs01
大概的概念是只要是沒有其他使用者使用這檔案, NFS 會直接讀取 Cache 上的資料不會透過網路做存取,所以就沒有真實使用到網路存取. 所以可以增加效能.在 NFS 官方網頁也有說明 http://nfs.sourceforge.net/  如下:

NFS Version 4 introduces file delegation. An NFS Version 4 server can allow an NFS Version 4 client to access and modify a file in it's own cache without sending any network requests to the server, until the server indicates via a callback that another client wishes to access a file. This reduces the amount of traffic between NFS Version 4 client and server considerably in cases where no other clients wish to access a set of files concurrently.

在我們載入 nfs 模組時會發現有幾個相依的模組 fscache, exportfs, nfs_acl, auth_rpcgss, lockd

[root@benjr ~]# modprobe nfs

其中的 fscache 就是讓 NFS 可以加速的模組.

[root@benjr ~]# lsmod |grep -i nfs
nfs                   291085 1
fscache          52385 1 nfs
nfsd                  287081 17
exportfs            38849 1 nfsd
nfs_acl              36673 1 nfs,nfsd
auth_rpcgss     81889 1 nfsd
lockd                 101297 2 nfs,nfsd
sunrpc               198537 14 nfs,nfsd,nfs_acl,auth_rpcgss,lockd

但是問題來了!!如果我不想要這功能是不是要重新編譯核心還是可以透過參數的方式來做呢!! 在下面的部落格說到可以透過 mount -o forcedirectio 的方式來做. http://www.cyberciti.biz/tips/disable-caching-on-the-cifs-nfs-client.html

但是我的問題是我在 RHEL5 上面使用 #mount -o forcedirectio 系統卻回應我 "Unsupported nfs mount option: forcediredtio"  恩!!我又走進一個死胡同了!! 在 Redhat 官方網站也提到類似的問題.
https://www.redhat.com/archives/linux-cachefs/2010-February/msg00022.html

沒有解決問題,試試搜尋本站其他內容

One thought on “Linux – mount – Disable Linux NFS Client Caching

  1. 雖然有看到幾個參數不過都沒用,比如在 Server 的 /etc/exports 加入 sync option. 或是在 Client 掛載時加入 -o actimeo (Only affect on caching attributes) 都無法解決 Linux NFS Client Caching 的問題.

發佈回覆給「admin」的留言 取消回覆

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料