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

Increase the maximum of ancient slots allowed to be not combined #3205

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dmakarov
Copy link

Problem

Large files containing ancient slots are expensive to update when the contained account data is being overwritten in more recent slots.

Summary of Changes

We increase the value of the tuning parameter max_ancient_slots to allow more ancient slots to remain in their individual storages instead of being combined into larger files. The smaller files are faster to update at the expense of the validator using more file handles.

@dmakarov
Copy link
Author

I'm working on adding an option to set this parameter on the validator's command line.

@jeffwashington
Copy link

I suggest coupling this change with:
ANCIENT_APPEND_VEC_DEFAULT_OFFSET = 100_000

This keeps the overall 'ancient' range at 100k max, and the overall storage range at 432k, so we are at status quo relative today regarding # slots and # file handles.

HaoranYi
HaoranYi previously approved these changes Oct 17, 2024
Copy link

@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.

max file handle = 430K + 100K + 100K = 630K.
not too bad.
lgtm!

@jeffwashington
Copy link

max file handle = 430K + 100K + 100K = 630K. not too bad. lgtm!

I think 100k means move it into the 432k. I think -10k moves it past the end (so max of 432k - - 10k = 442k.

I'm proposing 432k - 100k + 100k = 432k total.

@HaoranYi
Copy link

Ah. I see.

So we will update this in the next PR?

const ANCIENT_APPEND_VEC_DEFAULT_OFFSET: Option<i64> = Some(-10_000);

@jeffwashington
Copy link

Ah. I see.

So we will update this in the next PR?

const ANCIENT_APPEND_VEC_DEFAULT_OFFSET: Option<i64> = Some(-10_000);

I wanted that done IN this pr:

#3205 (comment)

I guess I could've been more clear.

@dmakarov
Copy link
Author

Ah. I see.

So we will update this in the next PR?

const ANCIENT_APPEND_VEC_DEFAULT_OFFSET: Option<i64> = Some(-10_000);

in this one.

@@ -595,7 +595,7 @@ pub struct AccountsAddRootTiming {

/// if negative, this many accounts older than # slots in epoch are still treated as modern (ie. non-ancient).
/// Slots older than # slots in epoch - this # are then treated as ancient and subject to packing.
const ANCIENT_APPEND_VEC_DEFAULT_OFFSET: Option<i64> = Some(-10_000);
const ANCIENT_APPEND_VEC_DEFAULT_OFFSET: Option<i64> = Some(-100_000);

Choose a reason for hiding this comment

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

i think this is + 100_000

Copy link
Author

Choose a reason for hiding this comment

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

shouldn't it be an offset to smaller slot numbers? if the offset is positive, the logic of several tests has to be adjusted at least, maybe some logic in the algorithms as well. let me figure this out.

@jeffwashington
Copy link

we definitely need to start a skipping rewrites version of this and it needs to run more than an epoch. Skipping rewrites is still opt-in and the current master behavior is unacceptable, so even if this isn't completely right, the risk is low at the moment.

@dmakarov
Copy link
Author

maybe I should merge #3206, rebase this on new master, and then start a skipping rewrites validator? so that all tweaks are included...

@jeffwashington
Copy link

maybe I should merge #3206, rebase this on new master, and then start a skipping rewrites validator? so that all tweaks are included...

@dmakarov yes, I just tracked these down. 3206 is approved. I say merge it.

/// slots in epoch are still treated as modern (ie. non-ancient).
/// | older |<- abs(offset) ->|<- slots in an epoch ->| max root
/// | ancient | modern |
const ANCIENT_APPEND_VEC_DEFAULT_OFFSET: Option<i64> = Some(100_000);

Choose a reason for hiding this comment

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

Should MAX_ANCIENT_SLOTS_DEFAULT be used here?

Suggested change
const ANCIENT_APPEND_VEC_DEFAULT_OFFSET: Option<i64> = Some(100_000);
const ANCIENT_APPEND_VEC_DEFAULT_OFFSET: Option<i64> = Some(MAX_ANCIENT_SLOTS_DEFAULT);

Do we need two constants?

Copy link
Author

Choose a reason for hiding this comment

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

i think they may have different values, in theory...

Choose a reason for hiding this comment

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

Ok, I think I'm fine with two constants. I still think that by default we probably want the offset to be the same as the max number of ancient slots.

Copy link
Author

Choose a reason for hiding this comment

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

i believe they’re not related, that is changing one value shouldn’t affect the other. otherwise why should there be two constants, instead of one? Perhaps, follow up changes should reconsider the tuning parameters altogether.

Choose a reason for hiding this comment

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

Yeah, that's fair. I guess I was under the impression that by setting the offset to a positive value, and setting the max number of ancient slots be the same value, that we were implicitly trying to communicate that we wanted a maximum number of storages to be about the number of slots per epoch.

Choose a reason for hiding this comment

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

Can we include the discussion here in the code comments, i.e. document the relationship between these two constants?

Copy link
Author

Choose a reason for hiding this comment

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

by the way max_ancient_slots seems to be a misnomer, because the value designates the number of storage files, not slots (there are in general accounts data from more slots packed into this number of storage files, if I understand correctly).

/// slots in epoch are still treated as modern (ie. non-ancient).
/// | older |<- abs(offset) ->|<- slots in an epoch ->| max root
/// | ancient | modern |
const ANCIENT_APPEND_VEC_DEFAULT_OFFSET: Option<i64> = Some(100_000);

Choose a reason for hiding this comment

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

Ok, I think I'm fine with two constants. I still think that by default we probably want the offset to be the same as the max number of ancient slots.

@@ -15877,16 +15888,19 @@ pub mod tests {
assert!(db
.get_sorted_potential_ancient_slots(oldest_non_ancient_slot)
.is_empty());
let root0 = 0;
let root0 = MAX_ANCIENT_SLOTS_DEFAULT as u64 + ancient_append_vec_offset as u64 + 1;

Choose a reason for hiding this comment

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

nit: I find it confusing to have a variable named root0 but not have a value of 0. Often we have slotX or rootX where the X is the slot number. Here we're breaking that pattern, and thus adds unexpectedness (which then I try and figure out "why"). I think we could rename the variable and bypass this issue entirely.

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.

4 participants