AcctIdx: with multiple bg threads, only log stats once per time interval (#19984)
This commit is contained in:
parent
4e038e94fd
commit
4089f8b06b
|
@ -100,7 +100,8 @@ impl<T: IndexValue> AccountsIndexStorage<T> {
|
||||||
wait: Arc<WaitableCondvar>,
|
wait: Arc<WaitableCondvar>,
|
||||||
) {
|
) {
|
||||||
loop {
|
loop {
|
||||||
wait.wait_timeout(Duration::from_millis(10000)); // account index stats every 10 s
|
// this will transition to waits and thread throttling
|
||||||
|
wait.wait_timeout(Duration::from_millis(10000));
|
||||||
if exit.load(Ordering::Relaxed) {
|
if exit.load(Ordering::Relaxed) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use solana_sdk::timing::AtomicInterval;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@ pub struct BucketMapHolderStats {
|
||||||
pub count_in_mem: AtomicU64,
|
pub count_in_mem: AtomicU64,
|
||||||
pub per_bucket_count: Vec<AtomicU64>,
|
pub per_bucket_count: Vec<AtomicU64>,
|
||||||
pub get_range_us: AtomicU64,
|
pub get_range_us: AtomicU64,
|
||||||
|
last_time: AtomicInterval,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BucketMapHolderStats {
|
impl BucketMapHolderStats {
|
||||||
|
@ -46,6 +48,11 @@ impl BucketMapHolderStats {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn report_stats(&self) {
|
pub fn report_stats(&self) {
|
||||||
|
// account index stats every 10 s
|
||||||
|
if !self.last_time.should_update(10_000) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let mut ct = 0;
|
let mut ct = 0;
|
||||||
let mut min = usize::MAX;
|
let mut min = usize::MAX;
|
||||||
let mut max = 0;
|
let mut max = 0;
|
||||||
|
|
Loading…
Reference in New Issue