Prevent unbound memory growth by blockstore_processor (#12110)

* Prevent unbound memory growth by blockstore_processor

* Promote log to info! considering infrequency

* Exclude the time of freeing from interval...

* Skip not-shrinkable slots even if forced

* Add comment
This commit is contained in:
Ryo Onodera
2020-09-09 12:05:10 +09:00
committed by GitHub
parent 0abf4db82e
commit c274e26eb8
3 changed files with 37 additions and 2 deletions

View File

@ -863,7 +863,15 @@ impl AccountsDB {
alive_count += store.count();
stored_count += store.approx_stored_count();
}
if (alive_count as f32 / stored_count as f32) >= 0.80 && !forced {
if alive_count == stored_count && stores.values().len() == 1 {
trace!(
"shrink_stale_slot: not able to shrink at all{}: {} / {}",
alive_count,
stored_count,
if forced { " (forced)" } else { "" },
);
return 0;
} else if (alive_count as f32 / stored_count as f32) >= 0.80 && !forced {
trace!(
"shrink_stale_slot: not enough space to shrink: {} / {}",
alive_count,

View File

@ -1123,6 +1123,25 @@ impl Bank {
}
}
pub fn exhaustively_free_unused_resource(&self) {
let mut reclaim = Measure::start("reclaim");
self.process_dead_slots();
reclaim.stop();
let mut clean = Measure::start("clean");
self.clean_accounts();
clean.stop();
let mut shrink = Measure::start("shrink");
self.shrink_all_slots();
shrink.stop();
info!(
"exhaustively_free_unused_resource(): {} {} {}",
reclaim, clean, shrink,
);
}
pub fn epoch_schedule(&self) -> &EpochSchedule {
&self.epoch_schedule
}