Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsqd:use fdatasync in diskqueue for efficiency in *nix os. #212

Closed
hardPass opened this issue May 28, 2013 · 3 comments
Closed

nsqd:use fdatasync in diskqueue for efficiency in *nix os. #212

hardPass opened this issue May 28, 2013 · 3 comments
Labels

Comments

@hardPass
Copy link

As I know, fdatasync is more efficient than fsync which used in *os.File.Sync().
Because fdatasync don't update metadata of file if unnecessary.
And there is no direct func in *os.File, just use syscall.Fdatasync().
And the way to write to file in diskqueue should be rewrite a lot for fixing metadata of file first.

Besides, I love to do this work, but it's awkward that I'am just stuck in how to create a file with the size being set at the same time.

@hardPass
Copy link
Author

Ok, I mean in some extremely biz-logic situation, Sync file every time you write data to it, should use fdatasync. But apparently, bitly just Sync file after syncEvery times writing opertions. ThissyncEvery could be 1000, in which case, there is no difference between fdatasync and fsync . And I think, there is no need to synchronize file too. why not just use the autoflush mechanism of os itself?

@mreiferson
Copy link
Member

@hardPass we did this to give some control to the user to configure the flushing behavior. we should actually have another config option to bound it by time, too.

@mreiferson
Copy link
Member

see #214 for some updates, I'm going to close (feel free to re-open or discuss in #214)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants