Operating System - Linux
1753528 Members
5106 Online
108795 Solutions
New Discussion юеВ

Re: NFS - asynchronously even with "sync" option?

 
Vitaly Karasik_1
Honored Contributor

NFS - asynchronously even with "sync" option?

I noticed that whne I write a file to NFS from client A and try to read the same file from client B, it takes some time before B sees that this file exist. Is it possible to force NFS server to be 100% synchronously?

Is "wdelay" option related to this behaviour?
8 REPLIES 8
Matti_Kurkela
Honored Contributor

Re: NFS - asynchronously even with "sync" option?

Yes, "wdelay" is related.

With the "async" option, when client A writes to the NFS server, the server can reply "write completed" to client A before the write is actually committed to disk. With the "sync" option, the server can reply "write completed" only after the data is actually written to disk.

The "wdelay" option has no effect when the "async" option is set.
When the "sync" option is set, the "wdelay" option allows the server to wait a bit before committing the write operation to the disk. If another related write operation happens immediately after the first, the server can combine the two disk write operations to improve performance. But if the two NFS requests are likely to be completely unrelated to each other, the "wdelay" option can actually reduce performance.

You can use the "no_wdelay" option to switch the wdelay feature off. Sounds like your application might need this.

See "man exports" and "man nfs" for a description of all the NFS options.

MK
MK
Vitaly Karasik_1
Honored Contributor

Re: NFS - asynchronously even with "sync" option?

thank you!

>When the "sync" option is set, the "wdelay" >option allows the server to wait a bit >before committing the write operation to >the disk

but do you think that sync+wdelay may cause to client A to receive acknoledge even before file writing is finished?
Vitaly Karasik_1
Honored Contributor

Re: NFS - asynchronously even with "sync" option?

it seems that "no_wdelay" isn't related...

I tried both default and with "no_wdealy" nfs server - the ame weird thing.

My test script is

clientA> while true;do cp /tmp/kkk /nfs-mounted-dir/`date +%h%m%s%N`; ls -1 nfs-mounted-dir/Ju*|wc -l ;ssh clientB 'ls -1 /nfs-mounted-dir/Ju*|wc ';done

I see that in both cases there is small delay before clientB sees new files.
Ivan Ferreira
Honored Contributor

Re: NFS - asynchronously even with "sync" option?

>> I see that in both cases there is small delay before clientB sees new files.

├В┬┐What about the server itself? This may be realted to client caching.

A system administrator can try using the "noac" mount option to achieve attribute cache coherency among multiple clients. Almost every client operation checks file attribute information. Usually the client keeps this information cached for a period of time to reduce network and server load.

When "noac" is in effect, a client's file attribute cache is disabled, so each operation that needs to check a file's attributes is forced to go back to the server. This permits a client to see changes to a file very quickly, at the cost of many extra network operations.

Be careful not to confuse "noac" with "no data caching." The "noac" mount option will keep file attributes up-to-date with the server, but there are still races that may result in data incoherency between client and server. If you need absolute cache coherency among clients, applications can use file locking, where a client purges file data when a file is locked, and flushes changes back to the server before unlocking a file; or applications can open their files with the O_DIRECT flag to disable data caching entirely.

http://nfs.sourceforge.net/
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Steven E. Protter
Exalted Contributor

Re: NFS - asynchronously even with "sync" option?

Shalom Vitaly,

Still keeping the desk here at NDS warm.

I've seen similar behavior in my lab and it would appear that due to buffer cache on busy systems there is a delay in files becoming visible.

The severity of the delay depends on how much I/O is happening on the NFS server.

I've seen it with busy RH 4 systems, several updates.

It would appear to be a feature, not a bug and there doesn't seem to be much to do about it other than setting up a load balancing NFS cluster which might be overkill and requires shared storage to work.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Vitaly Karasik_1
Honored Contributor

Re: NFS - asynchronously even with "sync" option?

2Ivan - unfortunately, "noap" didn't help - I see the same behaviour

2Steven - nice to speak with you!
but not, my NFS server isn't under high load.
Steven E. Protter
Exalted Contributor

Re: NFS - asynchronously even with "sync" option?

Shalom,

uname -a
cat /etc/redhat-release

yum time?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Vitaly Karasik_1
Honored Contributor

Re: NFS - asynchronously even with "sync" option?


Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
Linux test 2.6.9-42.0.3.ELsmp #1 SMP Mon Sep 25 17:24:31 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux


"yum time" - what do you mean?