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

BucketListDB in-memory Buckets #4630

Merged
merged 4 commits into from
Feb 1, 2025
Merged

Conversation

SirTyson
Copy link
Contributor

Description

Partially resolves #3696

This change refactors the BucketIndex parts of BucketListDB to be more friendly towards the Hot Archive BucketList. This includes cleanups to metrics, which previously only tracked metrics for the main thread access of the BucketList. Now, both BucketList types and background threads record metrics properly.

Additionally, this change removes the IndividualIndex and instead caches small Buckets entirely in-memory so we never read from disk. RangeIndex is largely unchanged but has been renamed to DiskIndex.

A follow up PR will add a random eviction cache to the DiskIndex. I tried to break this up as much as possible, but it was easiest to do the refactor + in-memory buckets at the same time so I didn't have to refactor IndividualIndex.

The BUCKETLIST_DB_INDEX_CUTOFF config setting determines the maximum size at which we keep bucket in-memory. I've set this to 250 MB, which is approximately the first 4-5 levels of the BucketList. This increases total memory consumption of stellar-core from 2.2 GB to 3 GB. This seems reasonable, and we could probably go even higher, but I'm holding off for now as the random eviction cache will further increase memory requirements.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

src/bucket/SearchableBucketList.cpp Show resolved Hide resolved
src/bucket/BucketManager.cpp Show resolved Hide resolved
src/bucket/HotArchiveBucketIndex.cpp Outdated Show resolved Hide resolved
src/bucket/BucketIndexUtils.h Outdated Show resolved Hide resolved
src/bucket/BucketIndexUtils.h Outdated Show resolved Hide resolved
src/bucket/InMemoryIndex.h Outdated Show resolved Hide resolved
@SirTyson SirTyson added this pull request to the merge queue Jan 31, 2025
@SirTyson SirTyson removed this pull request from the merge queue due to a manual request Jan 31, 2025
@SirTyson SirTyson enabled auto-merge January 31, 2025 22:17
@SirTyson SirTyson added this pull request to the merge queue Jan 31, 2025
Merged via the queue into stellar:master with commit 96a822e Feb 1, 2025
13 checks passed
@SirTyson SirTyson deleted the bl-cache-2 branch February 1, 2025 00:58
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.

Add persistent cache to BucketListDB
2 participants