NFS缓存问题

前端之家收集整理的这篇文章主要介绍了NFS缓存问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们遇到了在代码部署期间间歇性发生的问题. 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.

我希望这有帮助.

原文链接:https://www.f2er.com/linux/400141.html

猜你在找的Linux相关文章