From 56a74859982250a25ecf56b83784bbb61a3544fb Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Tue, 17 Oct 2023 14:41:23 -0700 Subject: [PATCH] log ancient stats each time we run (#33730) --- accounts-db/src/accounts_db.rs | 296 ++++++++++++------------- accounts-db/src/ancient_append_vecs.rs | 6 +- 2 files changed, 148 insertions(+), 154 deletions(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index f4d4b665c3689c..22f81f68550519 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -2157,155 +2157,153 @@ impl ShrinkStats { impl ShrinkAncientStats { pub(crate) fn report(&self) { - if self.shrink_stats.last_report.should_update(1000) { - datapoint_info!( - "shrink_ancient_stats", - ( - "num_slots_shrunk", - self.shrink_stats - .num_slots_shrunk - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "storage_read_elapsed", - self.shrink_stats - .storage_read_elapsed - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "index_read_elapsed", - self.shrink_stats - .index_read_elapsed - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "create_and_insert_store_elapsed", - self.shrink_stats - .create_and_insert_store_elapsed - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "store_accounts_elapsed", - self.shrink_stats - .store_accounts_elapsed - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "update_index_elapsed", - self.shrink_stats - .update_index_elapsed - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "handle_reclaims_elapsed", - self.shrink_stats - .handle_reclaims_elapsed - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "remove_old_stores_shrink_us", - self.shrink_stats - .remove_old_stores_shrink_us - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "rewrite_elapsed", - self.shrink_stats.rewrite_elapsed.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "unpackable_slots_count", - self.shrink_stats - .unpackable_slots_count - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "drop_storage_entries_elapsed", - self.shrink_stats - .drop_storage_entries_elapsed - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "recycle_stores_write_time", - self.shrink_stats - .recycle_stores_write_elapsed - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "accounts_removed", - self.shrink_stats - .accounts_removed - .swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "bytes_removed", - self.shrink_stats.bytes_removed.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "bytes_written", - self.shrink_stats.bytes_written.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "alive_accounts", - self.shrink_stats.alive_accounts.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "dead_accounts", - self.shrink_stats.dead_accounts.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "accounts_loaded", - self.shrink_stats.accounts_loaded.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "ancient_append_vecs_shrunk", - self.ancient_append_vecs_shrunk.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "random", - self.random_shrink.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "slots_considered", - self.slots_considered.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "ancient_scanned", - self.ancient_scanned.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "total_us", - self.total_us.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ( - "second_pass_one_ref", - self.second_pass_one_ref.swap(0, Ordering::Relaxed) as i64, - i64 - ), - ); - } + datapoint_info!( + "shrink_ancient_stats", + ( + "num_slots_shrunk", + self.shrink_stats + .num_slots_shrunk + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "storage_read_elapsed", + self.shrink_stats + .storage_read_elapsed + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "index_read_elapsed", + self.shrink_stats + .index_read_elapsed + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "create_and_insert_store_elapsed", + self.shrink_stats + .create_and_insert_store_elapsed + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "store_accounts_elapsed", + self.shrink_stats + .store_accounts_elapsed + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "update_index_elapsed", + self.shrink_stats + .update_index_elapsed + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "handle_reclaims_elapsed", + self.shrink_stats + .handle_reclaims_elapsed + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "remove_old_stores_shrink_us", + self.shrink_stats + .remove_old_stores_shrink_us + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "rewrite_elapsed", + self.shrink_stats.rewrite_elapsed.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "unpackable_slots_count", + self.shrink_stats + .unpackable_slots_count + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "drop_storage_entries_elapsed", + self.shrink_stats + .drop_storage_entries_elapsed + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "recycle_stores_write_time", + self.shrink_stats + .recycle_stores_write_elapsed + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "accounts_removed", + self.shrink_stats + .accounts_removed + .swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "bytes_removed", + self.shrink_stats.bytes_removed.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "bytes_written", + self.shrink_stats.bytes_written.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "alive_accounts", + self.shrink_stats.alive_accounts.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "dead_accounts", + self.shrink_stats.dead_accounts.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "accounts_loaded", + self.shrink_stats.accounts_loaded.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "ancient_append_vecs_shrunk", + self.ancient_append_vecs_shrunk.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "random", + self.random_shrink.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "slots_considered", + self.slots_considered.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "ancient_scanned", + self.ancient_scanned.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "total_us", + self.total_us.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ( + "second_pass_one_ref", + self.second_pass_one_ref.swap(0, Ordering::Relaxed) as i64, + i64 + ), + ); } } diff --git a/accounts-db/src/ancient_append_vecs.rs b/accounts-db/src/ancient_append_vecs.rs index f4da2f20d7944e..46e299d3eefac3 100644 --- a/accounts-db/src/ancient_append_vecs.rs +++ b/accounts-db/src/ancient_append_vecs.rs @@ -272,11 +272,7 @@ impl AccountsDb { .total_us .fetch_add(total_us, Ordering::Relaxed); - // only log when we've spent 1s total - // results will continue to accumulate otherwise - if self.shrink_ancient_stats.total_us.load(Ordering::Relaxed) > 1_000_000 { - self.shrink_ancient_stats.report(); - } + self.shrink_ancient_stats.report(); } fn combine_ancient_slots_packed_internal(