Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Feb 2009 11:38:14 -0500 (EST)
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        Joe7 <admin@kedvenc.hu>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: nfs delay causing broken files
Message-ID:  <Pine.GSO.4.63.0902061126100.6236@muncher.cs.uoguelph.ca>
In-Reply-To: <20090205212511.jrmipmazeo4o0c8w@www.site.hu>
References:  <20090205212511.jrmipmazeo4o0c8w@www.site.hu>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 5 Feb 2009, Joe7 wrote:

>
> Hi there,
>
> I'd like to know how to tune NFS (or related kernel) settings so the NFS 
> client writes would have NO delay?
> I'm getting application level errors as NFS client writes data, then 
> application would read the data from NFS master just 1 second later and it's 
> not there yet, so outdated data is read.
>
You will have to enable synchronous writing (which will be a big 
performance hit, but...):
- either mount with the "sync" option
OR
- have the apps open the files with O_SYNC (or O_FSYNC)

If the recent writes need to be visible on other clients (and not just the
NFS server), you will also have to bypass the client side caching for
readers. This can be done by setting nfs_directio_enable to non-zero
using sysctl and opening the files with O_DIRECT. (I think setting
acregmax=0 as a mount option should achieve the same result, if you can't
add O_DIRECT to the apps.) Again, a big performance hit, but...

As an historical aside, way back when (before NFSv3) I concocked something
callled not quite nfs, which included a cache coherency protocol, but it
didn't catch on. Cache coherency seems to have never been a priority for
the NFS crowd. Even in NFSv4, there isn't a cache coherency protocol, nor
any interest in adding one. (In fairness, coherency between multiple
clients can be achieved in NFSv4 for data by the clients putting byte
range locks on all the byte ranges.)

rick




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.63.0902061126100.6236>