加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

NFS缓存问题

发布时间:2020-12-13 17:23:02 所属栏目:Linux 来源:网络整理
导读:我们遇到了在代码部署期间间歇性发生的问题. NFS在读取文件时对文件进行高速缓存,但如果在代码部署期间读取文件,则文件将保持脏状态,就像部署期间文件未更改一样.我们解决此问题的唯一方法是在部署后清除NFS缓存. 我们的Web服务器返回所有请求的空白页,直到
我们遇到了在代码部署期间间歇性发生的问题. NFS在读取文件时对文件进行高速缓存,但如果在代码部署期间读取文件,则文件将保持脏状态,就像部署期间文件未更改一样.我们解决此问题的唯一方法是在部署后清除NFS缓存.

我们的Web服务器返回所有请求的空白页,直到清除NFS缓存.

有没有设置或有没有人建议如何解决这个问题?

我们目前正在运行NFS v3.

解决方法

存在用于在NFS挂载(客户端)上缓存文件属性的不同选项:

NOAC
Use the noac mount option to achieve attribute cache coherence
among multiple clients. Almost every file system operation checks file
attribute information. The client keeps this information cached for a
period of time to reduce network and server load. When noac is in
effect,a client’s file attribute cache is disabled,so each operation
that needs to check a file’s attributes is forced to go back to the
server. This permits a client to see changes to a file very quickly,
at the cost of many extra network operations.

lookupcache=none
If the client ignores its cache and validates every
application lookup request with the server,that client can
immediately detect when a new directory entry has been either created
or removed by another client. You can specify this behavior using
lookupcache=none. The extra NFS requests needed if the client does not
cache directory entries can exact a performance penalty. Disabling
lookup caching should result in less of a performance penalty than
using noac,and has no effect on how the NFS client caches the
attributes of files.

actimeo=n
Using actimeo sets all of acregmin,acregmax,acdirmin,and acdirmax to the same value.

  • acregmin=n,The minimum time (in seconds) that the NFS client caches attributes of a regular file before it requests fresh
    attribute information from a server. If this option is not
    specified,the NFS client uses a 3-second minimum.
  • acregmax=n,The maximum time (in seconds) that the NFS client caches attributes of a regular file before it requests fresh
    attribute information from a server. If this option is not
    specified,the NFS client uses a 60-second maximum.
  • acdirmin=n,The minimum time (in seconds) that the NFS client caches attributes of a directory before it requests fresh attribute
    information from a server. If this option is not specified,the NFS
    client uses a 30-second minimum.
  • acdirmax=n,The maximum time (in seconds) that the NFS client caches attributes of a directory before it requests fresh attribute
    information from a server. If this option is not specified,the NFS
    client uses a 60-second maximum.

取自NFS man page.

我希望这有帮助.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读