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

Add config option for flatfs no-sync #1963

Closed
wants to merge 1 commit into from
Closed

Conversation

rht
Copy link
Contributor

@rht rht commented Nov 13, 2015

No description provided.

@jbenet jbenet added the status/in-progress In progress label Nov 13, 2015
@whyrusleeping
Copy link
Member

oh yeah, I was gonna do that and totally forgot about it.

@whyrusleeping whyrusleeping added RFCR and removed status/in-progress In progress labels Nov 13, 2015
@rht
Copy link
Contributor Author

rht commented Nov 16, 2015

It appears that fsync is no longer the main bottleneck (particularly with no-insertnodeatpath and no-chunk-channel):

Edit: the plot below is misleading, this is because the sync flag in flatfs.New doesn't passed into Datastore object creation
sync + no-insertnodeatpath + no-chunk-channel + no-outputdagnode, 1KB each
outdata

@whyrusleeping
Copy link
Member

@rht thats interesting. I don't see any harm in having the option around for future testing though.

@@ -39,7 +39,7 @@ func openDefaultDatastore(r *FSRepo) (repo.Datastore, error) {
// including "/" from datastore.Key and 2 bytes from multihash. To
// reach a uniform 256-way split, we need approximately 4 bytes of
// prefix.
blocksDS, err := flatfs.New(path.Join(r.path, flatfsDirectory), 4)
blocksDS, err := flatfs.New(path.Join(r.path, flatfsDirectory), 4, !r.config.Datastore.NoSync)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do it like this, to avoid hard to read code:

syncfs := !r.config.Datastore.NoSync
blocksDS, err := flatfs.New(path.Join(r.path, flatfsDirectory), 4, syncfs)

@rht
Copy link
Contributor Author

rht commented Nov 17, 2015

I still haven't figured out the cause, but wish to know. One plausible explanation is because 1. each hash update of the root (and all the subroots) happens as many times as the number of folders+files it(they) contain(s), 2. each fsync is more expensive than an lstat (in this casedatastore.Has) because it has to update the cached hash.

}

var _ datastore.Datastore = (*Datastore)(nil)

func New(path string, prefixLen int) (*Datastore, error) {
func New(path string, prefixLen int, sync bool) (*Datastore, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whyrusleeping sync doesn't get passed into Datastore initialization. Ref: #1964 (comment)

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
@rht
Copy link
Contributor Author

rht commented Nov 19, 2015

This updated

@whyrusleeping
Copy link
Member

this LGTM

@whyrusleeping
Copy link
Member

merged in #1985

@jbenet jbenet removed the status/in-progress In progress label Nov 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants