AcctIdx: report disk bucket stats (#20120)
This commit is contained in:
parent
f7eebadbed
commit
476124de50
|
@ -251,7 +251,7 @@ impl BucketStorage {
|
|||
capacity_pow2: u8,
|
||||
stats: &mut Arc<BucketStats>,
|
||||
) -> (MmapMut, PathBuf) {
|
||||
let mut m0 = Measure::start("");
|
||||
let mut measure_new_file = Measure::start("measure_new_file");
|
||||
let capacity = 1u64 << capacity_pow2;
|
||||
let r = thread_rng().gen_range(0, drives.len());
|
||||
let drive = &drives[r];
|
||||
|
@ -280,16 +280,22 @@ impl BucketStorage {
|
|||
.unwrap();
|
||||
data.write_all(&[0]).unwrap();
|
||||
data.seek(SeekFrom::Start(0)).unwrap();
|
||||
m0.stop();
|
||||
let mut m1 = Measure::start("");
|
||||
measure_new_file.stop();
|
||||
let mut measure_flush = Measure::start("measure_flush");
|
||||
data.flush().unwrap(); // can we skip this?
|
||||
m1.stop();
|
||||
let mut m2 = Measure::start("");
|
||||
measure_flush.stop();
|
||||
let mut measure_mmap = Measure::start("measure_mmap");
|
||||
let res = (unsafe { MmapMut::map_mut(&data).unwrap() }, file);
|
||||
m2.stop();
|
||||
stats.new_file_us.fetch_add(m0.as_us(), Ordering::Relaxed);
|
||||
stats.flush_file_us.fetch_add(m0.as_us(), Ordering::Relaxed);
|
||||
stats.mmap_us.fetch_add(m0.as_us(), Ordering::Relaxed);
|
||||
measure_mmap.stop();
|
||||
stats
|
||||
.new_file_us
|
||||
.fetch_add(measure_new_file.as_us(), Ordering::Relaxed);
|
||||
stats
|
||||
.flush_file_us
|
||||
.fetch_add(measure_flush.as_us(), Ordering::Relaxed);
|
||||
stats
|
||||
.mmap_us
|
||||
.fetch_add(measure_mmap.as_us(), Ordering::Relaxed);
|
||||
res
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,8 @@ impl BucketMapHolderStats {
|
|||
max = std::cmp::max(max, d);
|
||||
}
|
||||
|
||||
let disk = storage.disk.as_ref();
|
||||
|
||||
datapoint_info!(
|
||||
"accounts_index",
|
||||
(
|
||||
|
@ -181,6 +183,88 @@ impl BucketMapHolderStats {
|
|||
self.flush_remove_us.swap(0, Ordering::Relaxed),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_index_resizes",
|
||||
disk.map(|disk| disk.stats.index.resizes.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_index_max_size",
|
||||
disk.map(|disk| {
|
||||
let mut lock = disk.stats.index.max_size.lock().unwrap();
|
||||
let value = *lock;
|
||||
*lock = 0;
|
||||
value
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_index_new_file_us",
|
||||
disk.map(|disk| disk.stats.index.new_file_us.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_index_resize_us",
|
||||
disk.map(|disk| disk.stats.index.resize_us.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_index_flush_file_us",
|
||||
disk.map(|disk| disk.stats.index.flush_file_us.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_index_flush_mmap_us",
|
||||
disk.map(|disk| disk.stats.index.mmap_us.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_data_resizes",
|
||||
disk.map(|disk| disk.stats.data.resizes.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_data_max_size",
|
||||
disk.map(|disk| {
|
||||
let mut lock = disk.stats.data.max_size.lock().unwrap();
|
||||
let value = *lock;
|
||||
*lock = 0;
|
||||
value
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_data_new_file_us",
|
||||
disk.map(|disk| disk.stats.data.new_file_us.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_data_resize_us",
|
||||
disk.map(|disk| disk.stats.data.resize_us.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_data_flush_file_us",
|
||||
disk.map(|disk| disk.stats.data.flush_file_us.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"disk_data_flush_mmap_us",
|
||||
disk.map(|disk| disk.stats.data.mmap_us.swap(0, Ordering::Relaxed))
|
||||
.unwrap_or_default(),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"flush_entries_updated_on_disk",
|
||||
self.flush_entries_updated_on_disk
|
||||
|
|
Loading…
Reference in New Issue