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

Support pebble #10347

Closed
6 of 8 tasks
Tracked by #10499
lidel opened this issue Feb 20, 2024 · 8 comments · Fixed by #10530
Closed
6 of 8 tasks
Tracked by #10499

Support pebble #10347

lidel opened this issue Feb 20, 2024 · 8 comments · Fixed by #10530
Assignees
Labels
effort/weeks Estimated to take multiple weeks exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/feature A new feature P1 High: Likely tackled by core team if no one steps up

Comments

@lidel
Copy link
Member

lidel commented Feb 20, 2024

Checklist

  • My issue is specific & actionable.
  • I am not suggesting a protocol enhancement.
  • I have searched on the issue tracker for my issue.

Description

Summary

Include pebble as built-in plugin.
It provides meaningful alternative to leveldb as the datastore, and may be better than badger1 as well.

Background

It is 2024, and we still only have flatfs, leveldb and necromancy-level badgerv1 (!) as datastore options.

We got positive feedback about pebble, some examples:

https://ipfscluster.io/documentation/guides/datastore/

Pebble is a high performant
backend from Cochroachdb, used by default in Cluster:

  • Proven to work well on very large pinsets.
  • Best disk-usage compared to the rest. No need to trigger GC cycles for space reclaim.
  • Performance and memory usage seems on par with Badger3, and behaves better than Badger on both counts.
  • Behaves correctly with default settings but we bump them up a bit.
  • 0-delay startup times, even with very large amounts of data.
  • Options support compression (we chose to leave it enabled by default).
  • The Pebble project is officially alive and maintained.
  • Pebble only runs on 64-bit architectures.
  • One key difference with Badger3 is that Pebble stores keys and values
    together and any lookup for a key will also read the values, while Badger3
    can store keys and values separately (i.e. keys only in the index, which can
    be loaded onto memory when small enough).

ipfs/go-ds-pebble#29:

After changing leveldb store to pebble store, the speed of GC has increased by at least dozens of times. So it's not flatfs that's to blame for slow GC, it's leveldb. I also tried leveldb and pebble as blockstore, but the CPU and memory usage is unacceptable.

Right now, to use go-ds-pebble one needs to build external plugin.

Proposed change

Include https://github.com/ipfs/go-ds-pebble in standard kubo build, just like we do with legacy badger1.

This will

  • provide meaningful alternative to leveldb and badgerd
  • allow community to use it without having to build external plugin and report back

TODO

@lidel lidel added the kind/feature A new feature label Feb 20, 2024
@lidel lidel added help wanted Seeking public contribution on this issue exp/expert Having worked on the specific codebase is important P2 Medium: Good to have, but can wait until someone steps up effort/weeks Estimated to take multiple weeks labels Feb 20, 2024
@guojidan
Copy link

guojidan commented Mar 7, 2024

hi, I want try implement this feature 😄

@lidel
Copy link
Member Author

lidel commented Jun 25, 2024

Triage note:

@lidel lidel changed the title Include go-ds-pebble as built-in plugin Support pebble Jun 25, 2024
@lidel lidel added P1 High: Likely tackled by core team if no one steps up and removed P2 Medium: Good to have, but can wait until someone steps up labels Jul 30, 2024
@lidel
Copy link
Member Author

lidel commented Jul 30, 2024

Triage notes:

  • we want to sunset badgerv1, will start warning people when they apply profile it is deprecated
  • we want to enable pebble before removing badgerv1
  • we need to figure out which pebble settings are worthy exposing via config, prior art in ipfs-cluster will likely be a good starting point
  • we want to track release verion of pebble, to avoid the state we ended up with badgerv1

@lidel lidel mentioned this issue Aug 28, 2024
34 tasks
@hsanjuan
Copy link
Contributor

hsanjuan commented Sep 3, 2024

  • we need to figure out which pebble settings are worthy exposing via config, prior art in ipfs-cluster will likely be a good starting point

Expose as much as possible because chances are defaults are never right for everyone.

gammazero added a commit that referenced this issue Oct 2, 2024
Pebble provides a high-performance alternative to leveldb as the datastore, and will serve as a replacement for badger1.

There are a number of tuning parameters available for tuning pebble's performance to your specific needs. Default values are used for any that are not configured or are set to the parameter's zero-value.

Requires ipfs/go-ds-pebble#39

Closes #10347
@gammazero
Copy link
Contributor

gammazero commented Oct 2, 2024

@hsanjuan Here is the subset of pebble options that I decided to make configurable.

This decision is based on what CockroachDB configures as pebble defaults, and based on what pebble tuning parameters were useful for optimizing IPNI's use of pebble.

@gammazero
Copy link
Contributor

gammazero commented Oct 2, 2024

@lidel I want to stop using ipfs-ds-convert. There should instead be a way to export all data from kubo instance and import it into another. This would free us from ever having to write a conversion for another datastore.

Maybe it could work something like this:

oldipfs export --repo-dir=~/.ipfs_prev --json --stdout | ipfs import --json

@lidel
Copy link
Member Author

lidel commented Oct 2, 2024

@gammazero replacing ipfs-ds-convert with ipfs repo export|import sounds very sensible, will be useful for people running custom datastores as well.

FYSA filled ipfs-inactive/ipfs-ds-convert#50 to track sunsetting ipfs-ds-convert (i'll do it shortly, taking it off our plate)

@hsanjuan
Copy link
Contributor

hsanjuan commented Nov 5, 2024

@hsanjuan Here is the subset of pebble options that I decided to make configurable.

This decision is based on what CockroachDB configures as pebble defaults, and based on what pebble tuning parameters were useful for optimizing IPNI's use of pebble.

I had a quick look. Pebble defaults are quite conservative but should be ok for home use. I had issues with FormatMajorVersion errors during pebble upgrades: https://github.com/ipfs-cluster/ipfs-cluster/pull/2019/files . When not explicit, the current default is used. Sometimes ratcheting the database after an upgrade fails if you jumped too many pebble releases in-between.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/weeks Estimated to take multiple weeks exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/feature A new feature P1 High: Likely tackled by core team if no one steps up
Projects
No open projects
Status: No status
4 participants