Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

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 #

@jeffwashington jeffwashington force-pushed the oc13 branch 3 times, most recently from fb35ac2 to ccbf033 Compare October 21, 2023 18:12
@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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants