We have two Solaris servers, let's call them Alice and Bob.
We also have a Solaris NFS server used by both of them, call it Charlie.
Alice writes to a text logfile on the NFS server, which is then read by Bob, who acts on events in that logfile.
The issue we're having is that there appears to be some delay in Bob seeing updates to the file from Alice.
For testing, I ran on Alice:
while [ 0 ]; do echo `date` | tee -a dummy_logfile; sleep 1; done
This just writes out the output from
date every second to a textfile, which is stored on the NFS server.
On Bob, I do:
tail -f dummy_logfile
I've noticed that there appears to be a delay of ~ 3 seconds for Bob seeing events. The tail -f will echo a logline, then pauses for around 3 seconds, then it spits out 3 seconds worth of log lines, then another 3 seconds of nothing, then outputs another set etc.
However, if on Bob I do:
while [ 0 ]; do cat dummy_logfile ; sleep 1; done
It repeats each line in dummy_logfile near instantaneously.
So it looks like
tail -f reading the NFS share is delayed, but cat reading over the NFS share is not. I was under the impression that
tail -f was near-instant.
Is there anything in the interaction of NFS, buffers, cache, etc. that might explain this behaviour? Does each cat somehow force an update or something?
Also, doing a
tail -f on Alice (the server generating the dummy_logfile) seems to be near-instant, so it doesn't appear to be some issue with
tail -f itself.