fastes way to write to disk (mmap, write, ...)
- From: Klaus Klingenbusch <mcm57@xxxxxx>
- Date: Thu, 24 Jan 2008 06:57:52 -0800 (PST)
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
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()
-) private buffereing in memory and writing all data using open() with
-) 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
- Prev by Date: msync/fsync - block process or thread ?
- Next by Date: How to generate Linux version flag at compile time, run time, from rpm spec.
- Previous by thread: msync/fsync - block process or thread ?
- Next by thread: How to generate Linux version flag at compile time, run time, from rpm spec.