Re:Linux's fsync() woes are getting some attention
by SamReidHughes on Tuesday March 11, 2014 @01:42AM
(#7377638)
Well even doing it on a file is bad.
It's per file, but also, it's (necessarily) the in-core state of that file, as a Linux man page says.
So if you do a write on one thread, wait for that write to complete, and then signal another thread to do an fsync, I don't really know what happens.
I believe fsync is per-file (or, really, per-file descriptor). I wasn't familiar with this specific problem, but I believe the problem is that for fsync to work, it has to issue commands to the hardware to flush hardware buffers to disk. Apparently that isn't well targeted in Linux, and has the effect that calling fsync on a file can slow down other threads and processes that happen to be writing to that same disk, even if they're writing to a different file.