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

Historical block / state pruning #6869

Open
nflaig opened this issue Jun 10, 2024 · 3 comments
Open

Historical block / state pruning #6869

nflaig opened this issue Jun 10, 2024 · 3 comments
Labels
meta-feature-request Issues to track feature requests. prio-medium Resolve this some time soon (tm). scope-performance Performance issue and ideas to improve performance.

Comments

@nflaig
Copy link
Member

nflaig commented Jun 10, 2024

Problem description

Right now, the longer a user is running Lodestar, the more storage is required. This is not ideal and the only way right now to free up space is by deleting the db and checkpoint sync.

Ideally, we want to clean up historical blocks after a certain time period (e.g MIN_EPOCHS_FOR_BLOCK_REQUESTS = ~5 months) to keep storage requirements constant and at the same time be able to serve historical blocks to the network (required by range sync).

This will become even more relevant once we enable backfill sync.

Solution description

Clean up historical blocks after certain time period. We might wanna consider putting this behind a feature flag as nodes that are intentionally synced from genesis (or earlier checkpoint) do not want that data to be pruned.

Additional context

Discord discussion

@nflaig nflaig added the meta-feature-request Issues to track feature requests. label Jun 10, 2024
@wemeetagain
Copy link
Member

also pruning old states which (depending on configuration) may be equal or greater source of disk usage

@nflaig
Copy link
Member Author

nflaig commented Jun 10, 2024

also pruning old states which (depending on configuration) may be equal or greater source of disk usage

Can apply the same to states but I think we prune most of these already and store them very sparsely

const statesSlotsToDelete = computeStateSlotsToDelete(storedStateSlots, archiveStateEpochFrequency);
if (statesSlotsToDelete.length > 0) {
await this.db.stateArchive.batchDelete(statesSlotsToDelete);
}

We might wanna get some metrics on this, could be done via db.approximateSize by passing the corresponding range

@nflaig nflaig changed the title Historical block pruning Historical block / state pruning Jun 27, 2024
@twoeths
Copy link
Contributor

twoeths commented Aug 4, 2024

regarding pruning old state, if we follow the design to only store state diff instead of state to disk then it becomes really lightweight and we don't need to think about this anymore, see https://github.com/dapplion/tree-states-review-guide/blob/main/persisted_hdiff.md

also it'll help with the historical state regen as stated in #6033 (comment)

we should prioritize that work instead imo

@philknows philknows added prio-medium Resolve this some time soon (tm). scope-performance Performance issue and ideas to improve performance. labels Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta-feature-request Issues to track feature requests. prio-medium Resolve this some time soon (tm). scope-performance Performance issue and ideas to improve performance.
Projects
None yet
Development

No branches or pull requests

4 participants