Writing to file delayed with Linux 2.6.10 & NFS

May 19, 2008 4 Replies

After porting our application from Linux 2.4.26 to Linux 2.6.10, I am seeing it taking 35 seconds to write to a file when using NFS.



Here is the code I am using to write to the file:



fprintf(fileHandle, "%s\n", msg_p); fflush(fileHandle);



If I put a printf statement right after this code, I see it immediately on the screen.



When I run out of flash with Linux 2.6.10, there is no delay in writing to the file. When using NFS with Linux 2.4.26, there is no delay either.



Is there anything in 2.6.10 that causes a delay in writing to a file with NFS?


How do you see this ? Does it take 35 seconds to perform the write, or does it take 35 seconds to see the data arrive on the server ? Are you verifying the new data on the NFS server or are you observing through another mounted NFS client on the same export ?

Could it be that your NFS server is exporting in async mode ?

:wq ^X^Cy^K^X^C^C^C^C

I do tail -f on the log file and see that it takes about 35 seconds to be written to. I can see using tcpdump that the data does arrive at the server immediately.

How do I check if my "NFS server is exporting in async mode?"

Could it be, just sync

solves the problem ?

rds

Yes, but where (on which machine) are you running the 'tail -f'? On the file server, or on the client that is writing to the file ?

That's good, but the server can choose not to write the changes to disk right away for performance purposes, i.e. running in asynchrone mode.

Check the /etc/exports file and the 'nfs' man page on your machine.

:wq ^X^Cy^K^X^C^C^C^C

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required