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 benchmark to compare LevelDB and Badger using sync-every-pin and sync-once-per-batch #3

Closed
wants to merge 25 commits into from

Conversation

petar
Copy link

@petar petar commented Jun 28, 2021

This benchmark is intended to inform whether "sync on every pin" is a feasible solution for ipfs/kubo#8149

The results from running it:
BenchmarkSyncOnceBadger-10 1694 599379 ns/op
BenchmarkSyncEveryBadger-10 1406 859930 ns/op
BenchmarkSyncOnceLevelDB-10 18 59809635 ns/op
BenchmarkSyncEveryLevelDB-10 12 104517039 ns/op

Stebalien and others added 25 commits December 2, 2019 15:37
…es. add datastore Sync during pinner.Flush()
fix: don't hold the pin lock while updating pins
feat: store pins in datastore instead of a DAG

Adds a new `/pins` namespace to the given datastore and uses that to store pins as cbor binary, keyed by unique pin ID.

The new datastore pinner stores pins in the datastore as individual key-value items. This is faster than the dag pinner, which stored all pins in a single dag that had to be rewritten every time a pin was added or removed.

The new pinner provides a secondary indexing mechanism that can be used to index any data that a pin has. Secondary indexing logic is provided by the `dsindex` package. The new pinner currently includes indexing by CID.

Both the new datastore pinner (`dspinner` package) and the old dag pinner (`ipldpinner` package) implementations are included to support migration between the two.  Migration logic is provided by the `pinconv` package.

Other features in new pinner:
- Benchmarks are provided to compare performance of between the old and new pinners
- New pinner does not keep in-memory set of pinned CIDs, instead it relies on the datastore
- Separate recursive and direct CID indexes allow searching for pins without having to load pin data to check the mode
- New pinner can rebuild indexes on load, if saved pins appear out of sync with the indexes
* Converting from IPLD to datastore-based pins no longer requires loading all dag-storage pins (including indirect pins) into memory
* increase test coverage
1. Parallelize fetching from disk.
2. Avoid re-visiting blocks we've already checked. Adding the same data
   over and over with small changes is pretty common.
- Remove old ipld pinner code
- Remove pin conversion package
- Remove ipldpinner portion of benchmarks
Remove old ipldpinner that has been replaced by dspinner
fix: remove the rest of the pb backed pinner
sync: update CI config files
@MichaelMure
Copy link
Owner

Hi,

Could you send that PR to https://github.com/ipfs/go-ipfs-pinner/ instead? This repo is just where I initially extracted the code, I'm not actually maintaining it.

@petar petar closed this Jun 29, 2021
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.

8 participants