0

I've got 2 machines that exchange data via NFS: 2 different files of about 20 bytes. The client writes its file and the server reads and deletes it then it writes its different file and the server reads and deletes. And so on. The 2 files have always the same names.

It was all ok. They run Linux 2.4. Nowadays, I've added another client which runs Linux 2.6. It works in the same way, it only uses files with different names.

The problem is that the new client sees the file from the server about 40 seconds after that it is written. I can wait 4-5 or even 10 seconds, but not 40.

I've tried to mount the remote partition with -o vers=2 or -o vers=3, but with no effects. Then I tried echo 3 > /proc/sys/vm/drop_caches, (see NFS cache-cleaning command?) no effects.

What can I do to reduce the time gap?

Community
  • 1
  • 1
asclepix
  • 7,971
  • 3
  • 31
  • 41

1 Answers1

0

You can try to incorporate listen-notify approach, using iNotify to monitor filesystem events.

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

It's very likely this will decrease the time gap.

hovanessyan
  • 30,580
  • 6
  • 55
  • 83
  • I've written a simple program using inotify, controlling the mountpoint directory and put it on the new client. The program views only the deletions and the creations made from the client but not those made by the server. – asclepix Jul 18 '13 at 16:28