On 12/18/06, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:if you want truely really smooth writes you'll have to work for it,
since "bumpy" writes tend to be better for performance so naturally the
kernel will favor those.
to get smooth writes you'll need to do a threaded setup where you do an
msync/fdatasync/sync_file_range on a frequent-but-regular interval from
a thread. Be aware that this is quite likely to give you lower maximum
performance than the batching behavior though.
Thanks...
That's correct. But it doesn't put your write at the head of any queue, it just doesn't buffer it for you.
But isn't O_DIRECT supposed to bypass buffering in Kernel?
Doesn't it directly write to disk?Also correct, when it's your turn to write to disk...
I tried to put fdatasync() at regular intervals but there was noQuite honestly, the main place I have found O_DIRECT useful is in keeping programs doing large i/o quantities from blowing the buffers and making the other applications run like crap. If you application is running alone, unless you are very short of CPU or memory avoiding the copy to an o/s buffer will be down in the measurement noise.
visible effect.