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

ancient pack: add low water mark #33785

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

jeffwashington
Copy link
Contributor

Problem

When we disable rewrites, we will accumulate old append vecs & slots. We use ancient append vec packing to combine those.
It is more efficient to pack a larger range of slots at a time instead of a small amount each call.

Summary of Changes

Add a low water mark. By default, when there are more than 10k ancient slots, the algorithm will pack down to 5k ancient slots. Then, the algorithm will do nothing until 10k is exceeded again.

Fixes #

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

Merging #33785 (0d511d7) into master (6fd0dcb) will increase coverage by 0.0%.
Report is 5 commits behind head on master.
The diff coverage is 100.0%.

@@           Coverage Diff           @@
##           master   #33785   +/-   ##
=======================================
  Coverage    81.8%    81.8%           
=======================================
  Files         806      806           
  Lines      217428   217438   +10     
=======================================
+ Hits       178056   178075   +19     
+ Misses      39372    39363    -9     

@jeffwashington jeffwashington marked this pull request as ready for review October 23, 2023 14:23
Copy link
Contributor

@HaoranYi HaoranYi left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -182,15 +182,17 @@ impl AncientSlotInfos {
self.shrink_indexes.clear();
let total_storages = self.all_infos.len();
let mut cumulative_bytes = 0u64;
let low_threshold = max_storages * 50 / 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the current impl preferred over a divide by two?

Suggested change
let low_threshold = max_storages * 50 / 100;
let low_threshold = max_storages / 2;

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps, introduce a const variable for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking this is more tunable than /2. 80%, 20%, etc. Ultimately we might make this a tuning parameter? Even a cli argument? This choice seems sufficient for the moment based on mnb monitoring. And it beats the current 100 slots at a time impl.

@jeffwashington jeffwashington merged commit 54b796f into solana-labs:master Oct 23, 2023
32 checks passed
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.

3 participants