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

Enable BucketListDB by default in captive-core #4710

Closed
SirTyson opened this issue Dec 14, 2022 · 0 comments
Closed

Enable BucketListDB by default in captive-core #4710

SirTyson opened this issue Dec 14, 2022 · 0 comments
Labels

Comments

@SirTyson
Copy link
Contributor

What problem does your feature solve?

Recently, core added the EXPERIMENTAL_BUCKETLIST_DB flag. When this flag is set, stellar-core uses the BucketList for key value lookup for most queries instead of a SQL database. This reduces disk usage by over 50% since state does not need to be duplicated between a SQL database and the BucketList. BucketListDB also has up to 4x lookup performance compared to SQL. Finally, startup is significantly faster. Because we query buckets directly, we can skip most BucketApply logic since we no longer need to apply buckets to a SQL database.

While this feature is still hidden behind an experimental flag, we think it's ready to be turned on by default when captive-core is using on disk mode. BucketListDB is not currently compatible in in-memory mode.

What would you like to see?

We would like to add EXPERIMENTAL_BUCKETLIST_DB=true to the default captive-core configuration when Horizon is run with the --captive-core-use-db flag. In addition to enabling BucketListDB, we will also need to tune some low-level optimization parameters for captive-core. There are two configuration parameters we will need to tune to the Horizon SKU, EXPERIMENTAL_BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT and EXPERIMENTAL_BUCKETLIST_DB_INDEX_CUTOFF. EXPERIMENTAL_BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT should be set to the machine storage device's physical page size. Currently, the default page size is 16KB, which is the optimal value for AWS NVMe storage. If Horizon nodes typically use a different storage class like EBS, this value will have to be changed. Unfortunately, during testing we found that page sizes reported by the OS are incorrect on AWS. The best way to figure out this value is just by trial and error with our microbenchmarking tool Tracy.
EXPERIMENTAL_BUCKETLIST_DB_INDEX_CUTOFF controls how much memory BucketListDB uses. A higher EXPERIMENTAL_BUCKETLIST_DB_INDEX_CUTOFF means more RAM usage but faster lookup performance.

I'm currently working on getting a Horizon SKU test machine running where I can fine tune these values. In the mean time, I'll put out a PR so anyone else can also run a captive-core test, but it should not be merged until we find the optimal configuration settings.

@jcx120 jcx120 moved this to Backlog in Platform Scrum Dec 15, 2022
@jcx120 jcx120 added the horizon label Dec 15, 2022
@jcx120 jcx120 moved this from Backlog to Next Sprint Proposal in Platform Scrum Dec 15, 2022
@mollykarcher mollykarcher moved this from Next Sprint Proposal to Backlog in Platform Scrum Jan 5, 2023
@jcx120 jcx120 moved this from Backlog to Next Sprint Proposal in Platform Scrum Jan 19, 2023
@jcx120 jcx120 moved this from Next Sprint Proposal to Needs Review in Platform Scrum Jan 23, 2023
@mollykarcher mollykarcher moved this from Needs Review to Done in Platform Scrum Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

3 participants