We have an application which needs to write data at a rather continuous rate (a few MB/s)
to a big storage on an NFS server. We have tested the NFS performance and we know that
we can achieve an average sustained rate of more than 20 MB/s. However, when this application
is active we see that once every 1 or 2 minutes the I/O is blocked for a few seconds.
This is a problem, because we miss some data from the acquisition system during these seconds.
We monitored the client system and we discovered that during this time there is a lot of network
traffic going to the NFS server.
When writing to a file on a local disk, this behavior is not seen and the application can write at a
more continuous rate.

I have read a few documents about NFS and the Linux file caching. I have the impression that this
behavior is explained in the following way:
The NFS clients keeps the data written by the application in its local file cache. This cache grows
to a size of several 100MB size. Then suddenly it decides to write the whole cache to the NFS
server. This takes a few seconds, during which further writing to the file by the application is
I can imaging that the developers of the NFS took this strategy to reduce the overhead and increase
the average performance. However, for us not the maximum I/O speed is the most important goal,
but a continuous writing speed.

Up to now I have not found ways to change this behavior.
I have experimented a bit with the sync function, but when this function is used at short intervals it
creates a large overhead, which reduces the writing speed too much and when used at longer intervals
it has the same disadvantage as when not using it al all: it blocks the writing too long. I have been
looking for a way that the NFS client continuously updates the file on the NFS server, without blocking
the application, but I cannot find such options for the NFS server or the NFS client.
This would mean that the application needs its own buffer management, so that the data is buffered
during the few seconds that file writing is blocked. This would require a major change, creating a
multiple threads, or asynchronous I/O, but I would like to avoid such changes to the application.
Therefore I would like to have some more support for my diagnosis.
Can anyone confirm that this is impossible to write at a continuous rate with NFS, or else tell me how
a more continuous writing speed can be achieved? Is it possible to turn on some sort of write-through