Hacker News new | past | comments | ask | show | jobs | submit login

Correct me if I'm wrong, but O_SYNC is the equivalent of calling fsync() after every single write, so even if you manage to omit one fsync() you're going to come out ahead.



Semantically it's the same, but maybe it is somewhat optimized? Testing right now...

Edit: indeed it's different, this is the result:

    ...
    Write in 219 microseconds
    Write in 253 microseconds
    Write in 264 microseconds
    Write in 271 microseconds
    Write in 246 microseconds
    ...
250 us instead of 13, but no big stops. So much better indeed... Even summing the times, every 10 writes this take 2500 us compared to 40000 us of fsync().

Definitely an improvement.

p.s. all this, in ext4 FS.


its not the same on filesystems like ext3 with ordered data mode (the default).

fsync on those kind of filesystems will flush everything, not just a single file, though I believe there has been some more recent work in 2.6 to improve this behavior.


> recent work in 2.6

So, since 2003?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: