linux - NFS 时间间隔过长

标签 linux nfs

我有 2 台机器通过 NFS 交换数据:2 个大约 20 字节的不同文件。客户端写入其文件,服务器读取并删除该文件,然后写入不同的文件,服务器读取并删除该文件。等等。这两个文件始终具有相同的名称。

一切都好。他们运行Linux 2.4。现在,我添加了另一个运行 Linux 2.6 的客户端。它的工作方式相同,只是使用不同名称的文件。

问题是新客户端在写入文件后大约 40 秒看到来自服务器的文件。我可以等 4-5 秒甚至 10 秒,但不能等 40 秒。

我尝试使用 -o vers=2-o vers=3 挂载远程分区,但没有效果。 然后我尝试了 echo 3 >/proc/sys/vm/drop_caches,(参见 NFS cache-cleaning command? )没有效果。

我可以做些什么来减少时间差距?

最佳答案

您可以尝试合并监听通知方法,使用 iNotify 来监视文件系统事件。

The inotify API provides a mechanism for monitoring file system events. Inotify can be used to monitor individual files, or to monitor directories. When a directory is monitored, inotify will return events for the directory itself, and for files inside the directory

man page

Q: Can I watch sysfs (procfs, nfs...)? Simply spoken: yes, but with some limitations. These limitations vary between kernel versions and tend to get smaller. Please read information about particular filesystems.

FAQ page

这很可能会缩短时间差距。

关于linux - NFS 时间间隔过长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17717522/

相关文章:

linux - 检查目录是否已更改

linux - 此 Bash 脚本的增量输出

linux - 从 IP 地址和端口获取套接字 FD

regex - 如何修复正则表达式以匹配整个单词,而不是子字符串?

c# - 在哪里可以找到 C#/.NET NFS 实现?

php - 为什么尽管已成功将文件移动到 NFS 挂载磁盘,但 rename() 仍返回 false?

linux - 通过互联网从一台主机到另一台主机的网络共享

linux - 从未绑定(bind)的 UDP 套接字发送到

linux - 如何在 NFS 上使用扩展文件属性?

linux - ESXi 5.1 虚拟机不再能够从其他虚拟机挂载 NFS 共享