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

add stats for ancient bytes_from_newest_storages #1802

Merged
merged 3 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1956,6 +1956,7 @@ pub(crate) struct ShrinkAncientStats {
pub(crate) bytes_ancient_created: AtomicU64,
pub(crate) bytes_from_must_shrink: AtomicU64,
pub(crate) bytes_from_smallest_storages: AtomicU64,
pub(crate) bytes_from_newest_storages: AtomicU64,
pub(crate) many_ref_slots_skipped: AtomicU64,
pub(crate) slots_cannot_move_count: AtomicU64,
pub(crate) many_refs_old_alive: AtomicU64,
Expand Down Expand Up @@ -2258,6 +2259,11 @@ impl ShrinkAncientStats {
self.bytes_from_smallest_storages.swap(0, Ordering::Relaxed) as i64,
i64
),
(
"bytes_from_newest_storages",
self.bytes_from_newest_storages.swap(0, Ordering::Relaxed) as i64,
i64
),
(
"many_ref_slots_skipped",
self.many_ref_slots_skipped.swap(0, Ordering::Relaxed),
Expand Down
6 changes: 6 additions & 0 deletions accounts-db/src/ancient_append_vecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ impl AncientSlotInfos {
let low_threshold = tuning.max_ancient_slots * 50 / 100;
let mut bytes_from_must_shrink = 0;
let mut bytes_from_smallest_storages = 0;
let mut bytes_from_newest_storages = 0;
for (i, info) in self.all_infos.iter().enumerate() {
cumulative_bytes += info.alive_bytes;
let ancient_storages_required =
Expand All @@ -235,6 +236,8 @@ impl AncientSlotInfos {
}
if info.should_shrink {
bytes_from_must_shrink += info.alive_bytes;
} else if info.is_high_slot {
bytes_from_newest_storages += info.alive_bytes;
} else {
bytes_from_smallest_storages += info.alive_bytes;
}
Expand All @@ -245,6 +248,9 @@ impl AncientSlotInfos {
stats
.bytes_from_smallest_storages
.fetch_add(bytes_from_smallest_storages, Ordering::Relaxed);
stats
.bytes_from_newest_storages
.fetch_add(bytes_from_newest_storages, Ordering::Relaxed);
}

/// remove entries from 'all_infos' such that combining
Expand Down