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

Manually compact during bootstrapping iteration #3040

Closed
wants to merge 5 commits into from

Conversation

StephenButtolph
Copy link
Contributor

@StephenButtolph StephenButtolph commented May 22, 2024

Why this should be merged

When introducing the interval tree into bootstrapping, the database was designed to support iteration rather than random reads to improve querying performance. However, it appears that holding the the iterator prevents compaction from occurring in a timely manner. Over time (after executing > 1M blocks) the iteration starts to slow down significantly. By manually compacting the database periodically, we manage to avoid this slowdown.

How this works

Periodically calls Compact every 128 iterator releases.

How this was tested

  • CI
  • Syncing mainnet P-chain with this code finished execution in ~6h. Running master executed 9.1M of the blocks (out of 13.7M) in 30h 22m

@StephenButtolph StephenButtolph self-assigned this May 22, 2024
@StephenButtolph StephenButtolph added consensus This involves consensus storage This involves storage primitives labels May 22, 2024
@StephenButtolph StephenButtolph added this to the v1.11.6 milestone May 22, 2024
@StephenButtolph StephenButtolph marked this pull request as ready for review May 22, 2024 17:27
@@ -206,8 +210,22 @@ func execute(
return err
}

lastProcessedKey := iterator.Key()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: update comment on lines 200/201 to mention that we don't just reduce memory pressure but we also compact?

@StephenButtolph
Copy link
Contributor Author

Closing in favor of #3045

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus This involves consensus storage This involves storage primitives
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants