From: Tony C. <dra...@as...> - 2002-02-06 09:29:11
|
Hi, A correction to my earlier's posting. fsync() actually returns only after the I/O completes. There's an alternative sync() which returns before the I/O completes. I think O_SYNC and fsync() should be pretty much the same, with fsync() doing the file I/O synchronization explicitely. Tony Bastiaan Bakker wrote: > > Tony Cheung wrote: > > >Hi Steve and others, > > > >First, the changes (if made) will be applied to OpenVMS compilations > >only. I am not sure if other platforms require the changes. > > > >For the disk caching, in order allow other users to "tail -f" on the > >application log real-time. The OS needs to flush the changes to the disk > >after each line of the logging. The caching should only be applicable to > >within a single line of logging, otherwise there would be a delay for > >the last few lines of logging to show up. BTW, the fsync() returns > >before the I/O completes. > > > >I agree it's a tradeoff between real-time feedback or better disk > >performance. > > > >Ideas? > > > >Tony > > > > This feature may be more generally useful as well. In combination with a > write cache disabled disk it can provide 'extra safe' logging. Of course > log4j/log4cpp are still 'non reliable, best effort' loggers, but this > may help a bit. > So I suggest to add this as a runtime option to FileAppender. Now for > the implementation, doe anyone have a good opion on whether to use > fdatasync() or the O_SYNC open flag? > > Bastiaan |