I've written an application that heartbeats using single-block writes to disk using O_WRONLY|O_SYNC|O_DIRECT.
Is there something I need to do to disable the buffer cache for this device?
During testing there are no readers. I can simulate it as follows:
# dd of=/dev/sda1 bs=512 count=1 if=/dev/zero oflag=direct,dsync
Per "iostat 1" something is reading from the device every time I write.
The behavior does not change if I add "skip=1000", etc.
The behavior changes a little bit if I use /dev/sda or /dev/sda1:
sda:
Linux 2.6.32-431.5.1.el6.x86_64 (wiley) 07/31/2014 _x86_64_ (8 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.07 0.01 0.07 0.04 0.00 99.80
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 86.00 672.00 1.00 672 1
sda1:
sda 83.00 648.00 1.00 648 1
Aha!
raw(8) as seen here:
write:
# dd of=/dev/raw/raw1 bs=512 count=1 if=/dev/zero oflag=direct,dsync
iostat:
sda 2.00 0.00 1.00 0 1