大网数据广告活动
服务器运维问答

NFS Caching Issue

· 52CE 我爱测

We are having an issue that happens intermittently during a code deployment. NFS caches the files as they are read, but if a file is read during a code deploy it stays in a dirty state as if the file wasn't changed during the dep…

问题原文

原帖链接 · Michael · CC BY-SA 3.0

We are having an issue that happens intermittently during a code deployment. NFS caches the files as they are read, but if a file is read during a code deploy it stays in a dirty state as if the file wasn't changed during the deploy. The only way we can alleviate this issue is by clearing the NFS cache after the deploy.

Our webserver returns blank pages for all requests until the NFS cache is cleared.

Is there a setting or does anyone have a suggestion on how to fix this?

We are running NFS v3 at the moment.

社区高分解答

原帖链接 · Federico Sierra · CC BY-SA 3.0

Exists different options to cache file attribute on a NFS mount (client side):

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.

Taken from the NFS man page.

I hope this help.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-10-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。