Thursday 15 March 2012

Writing or flushing a file to asynchronous NFS with c++ ofstreams -



Writing or flushing a file to asynchronous NFS with c++ ofstreams -

we have project multiple nodes writes info file in sequence , file resides on nfs.

we using synchronous nfs before flush file streams worked fine. have asynchronous nfs , not working. not working in sense caching comes image , other nodes doesnt see changes made particular node.

i wanted know if there way forcefully flush info cache disk. know not efficient things working until real solution in place.

i've had similar problem using nfs vxworks. after experimentation i've found way certainly flush info device:

int fd; fd = open("/ata0a/test.dat", o_rdwr | o_create); write(fd, "hallo", 5); /* info having great time in buffers... */ ioctl(fd, fiosync, 0); // <-- may lastly quite while... /* info flushed file */

i've never worked ofstreams neither know if os provides similar code shown above...

but 1 thing seek close file. cause buffers flushed. aware there may time between closing file , info beingness flushed application not see since "close" phone call may homecoming before info written. additionally creates lot of overhead since have re-open file afterwards.

if no alternative can write much "dummy-data" after info cause buffers fill up. result in info beingness written file. may waste lot of disk space depending on size of data.

c++ asynchronous nfs ofstream

No comments:

Post a Comment