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

Don't store blocks in database #4630

Closed
4 tasks done
erikgrinaker opened this issue Apr 2, 2020 · 5 comments
Closed
4 tasks done

Don't store blocks in database #4630

erikgrinaker opened this issue Apr 2, 2020 · 5 comments
Labels
stale for use by stalebot T:breaking Type: Breaking Change T:perf Type: Performance

Comments

@erikgrinaker
Copy link
Contributor

The block store currently stores blocks in a database, typically LevelDB. This is suboptimal, since these databases usually aren't optimized for storage of BLOBs, operations like LSM-tree compaction becomes prohibitively expensive, and contents can't be streamed. Blocks should instead be stored in the filesystem, with metadata and a checksum in the LevelDB database.

When fixing this, we should fix #4567 as well.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@erikgrinaker erikgrinaker added T:perf Type: Performance S:proposal Status: Proposal labels Apr 2, 2020
@erikgrinaker erikgrinaker added the T:breaking Type: Breaking Change label Apr 22, 2020
@melekes melekes added S:proposal Status: Proposal and removed S:proposal Status: Proposal labels Apr 30, 2020
@melekes
Copy link
Contributor

melekes commented Sep 15, 2020

@erikgrinaker do u remember why this wasn't accepted? I would like to tackle this if possible.

@erikgrinaker
Copy link
Contributor Author

It's accepted, just a bit tricker than I first though. Tendermint primarily uses block parts, not whole blocks - I think it's too expensive to store block parts as separate files (e.g. due to inode usage and half-full filesystem blocks), so we'll need to maintain an index for each block's part offsets.

@melekes melekes self-assigned this Sep 15, 2020
@melekes melekes removed the S:proposal Status: Proposal label Sep 15, 2020
@tac0turtle
Copy link
Contributor

I think it's too expensive to store block parts as separate files (e.g. due to inode usage and half-full filesystem blocks)

We could look into removing block parts from various parts of the codebase as it pertains to consensus primarily. According to this issue tendermint/spec#78 it is "an unfortunate artifact". It may make sense to tackle the removal in places instead of putting a bandaid on it, although this will require a greater refactor.

@melekes
Copy link
Contributor

melekes commented Sep 15, 2020

We'll still have to store erasure-coded chunks somewhere, so I wouldn't say it's a bandaid

@erikgrinaker
Copy link
Contributor Author

erikgrinaker commented Sep 15, 2020

So the reason why I abandoned this last time was because if we end up needing to maintain a bunch of indexes, randomly access block parts, and storing temporary data and stuff, then I'm not sure that storing blocks as files makes much sense anymore. A better approach might be to use e.g. a B-tree based store (like BoltDB) which doesn't need to do compaction all the time (which I think is what kills LevelDB performance for blocks).

Would be interesting to see some performance figures, and maybe do a proof of concept implementation to get a sense of the complexity of doing all of this stuff ourselves.

melekes added a commit that referenced this issue Sep 15, 2020
@melekes melekes removed their assignment Dec 23, 2020
@tychoish tychoish self-assigned this Apr 20, 2021
@tychoish tychoish removed their assignment Mar 13, 2023
@github-actions github-actions bot added the stale for use by stalebot label Aug 24, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale for use by stalebot T:breaking Type: Breaking Change T:perf Type: Performance
Projects
None yet
Development

No branches or pull requests

4 participants