fastes way to write to disk (mmap, write, ...)



I need to write to disk as fast as possible (of course who does
not :-) )

Data is available as records of app. 1kByte each

After a number of such records (ie. 100) has been written, it must be
ensured that the data is physically on the disk (or at least within
some non volatile battary backup raid controller) and no longer in any
area of the O/S System where it could be lost i.e. due to a system
crash.

The data is written sequentially (appended at eof)

I know the following ways to implement this

-) direkt write using write(), issuing fsync after every 100 writes
-) private buffereing in memory and writing all data with one write()
+ fsync()
-) private buffereing in memory and writing all data using open() with
O_SYNC
-) mmaping the output file and writeing into the mapped memory using
msync() on the paged whenever 100 "writes" occured.

Does someone know better (faster) algorithms ?
What do you think is the fastes way ?
Is there any benefit of using mmap over direkt writes for files
written only. I guess that mmaped files require the
"old" (uninitialzed data) of the preextended file to be apged in only
to be overwritten soon. This should cause unneccesray disk IO. Is this
assumption correct?

Klaus
.