-
Notifications
You must be signed in to change notification settings - Fork 65
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
Asynchronous Datastores #137
Comments
It's looking a lot like Badger on Windows only supports asynchronous writes due to issues with Golang not respecting Windows permissions. This means that until there's a fix in Golang/Badger then if we want to support Badger we should support asynchronous datastores. |
I don't know that I would add Other than that, this LGTM. Seems like something i've wanted for quite a long time. |
My main comment is that in practice, a datastore gets used by components with different reliability requirements, e.g. peerstore, IPFS repo, etc. If some some are async and others are sync, the sync ones would end up paying the cost to flush the writes from the async ones. That’s unfair. To make this model effective and fair, we’d need to use it in conjunction with if segmentation/compartmentalisation like the Namespace abstraction we already have for go-datastore. |
Note: fixing badger is much simpler. |
This sounds good! What are the next steps? Should there be a spec and design review first or move forward with a checklist and quick PoC to validate the approach? Is this simple enough to push forward and land a usable MVP this quarter (to demonstrate package manager performance improvements), or is this fix a significant chunk-o-work? |
I'd rather add it to the interface for two reasons:
|
@momack2 this should be pretty simple. |
@aschmahmann could you track any progress on this in ipfs/kubo#6523? |
Proposal
Sync(prefix Key)
function to theDatastore
interface.Sync(prefix)
guarantees that anyPut(prefix + ..., value)
calls that returned beforeSync(prefix)
was called will be observed afterSync(prefix)
returns, even if the program crashes.Sync
where appropriate (in go-ipfs and go-libp2p).Notes:
Motivation
Writing to disk synchronously has poor performance and is rarely necessary.
Poor performance:
ipfs add
performance is doubled (on linux/ext4) when badger is used and synchronous writes are turned off.Rarely necessary:
sync
after a fullipfs add
as most users have GC turned off and expect the data to be persisted anyways. However, doing this once is cheaper than doing it for every write.Alternatives
However:
@Stebalien @whyrusleeping @raulk Seem like a reasonable plan?
The text was updated successfully, but these errors were encountered: