From c7b3f89b2e15482e41d445656e4828d710f4c05c Mon Sep 17 00:00:00 2001 From: Changwei Ge Date: Mon, 28 Nov 2022 10:31:40 +0800 Subject: [PATCH] metrics: rename prefetch_mr_count to prefetch_requests_count Signed-off-by: Changwei Ge --- storage/src/cache/worker.rs | 4 ++-- utils/src/metrics.rs | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/storage/src/cache/worker.rs b/storage/src/cache/worker.rs index 9335110f278..71b75fc58d4 100644 --- a/storage/src/cache/worker.rs +++ b/storage/src/cache/worker.rs @@ -356,7 +356,7 @@ impl AsyncWorkerMgr { // So the average backend merged request size will be prefetch_data_amount/prefetch_mr_count. // We can measure merging possibility by this. let metrics = mgr.metrics.clone(); - metrics.prefetch_mr_count.inc(); + metrics.prefetch_requests_count.inc(); metrics.prefetch_data_amount.add(size); if let Some(obj) = cache.get_blob_object() { @@ -414,7 +414,7 @@ impl AsyncWorkerMgr { // Record how much prefetch data is requested from storage backend. // So the average backend merged request size will be prefetch_data_amount/prefetch_mr_count. // We can measure merging possibility by this. - mgr.metrics.prefetch_mr_count.inc(); + mgr.metrics.prefetch_requests_count.inc(); mgr.metrics.prefetch_data_amount.add(blob_size); if let Some(obj) = cache.get_blob_object() { diff --git a/utils/src/metrics.rs b/utils/src/metrics.rs index bd4f888f890..beee0e335b2 100644 --- a/utils/src/metrics.rs +++ b/utils/src/metrics.rs @@ -739,13 +739,24 @@ pub struct BlobcacheMetrics { // to estimate the possibility to merge backend IOs. // In unit of Bytes pub prefetch_data_amount: BasicMetric, - pub prefetch_mr_count: BasicMetric, + // Total prefetch requests issued from storage/blobs or rafs filesystem layer for each file that needs prefetch + pub prefetch_requests_count: BasicMetric, pub prefetch_workers: AtomicUsize, pub prefetch_unmerged_chunks: BasicMetric, + // Cumulative time latencies of each prefetch request which can be handled in parallel. + // It starts when the request is born including nydusd processing and schedule and end when the chunk is downloaded and stored. + // Then the average prefetch latency can be calculated by + // `prefetch_cumulative_time_millis / prefetch_requests_count` pub prefetch_cumulative_time_millis: BasicMetric, + // The time seconds part when nydusd begins to prefetch + // We can calculate prefetch average bandwidth by + // `prefetch_data_amount / (prefetch_end_time_secs - prefetch_begin_time_secs)`. Note, it does not take milliseconds into account yet.s pub prefetch_begin_time_secs: BasicMetric, + // The time milliseconds part when nydusd begins to prefetch pub prefetch_begin_time_millis: BasicMetric, + // The time seconds part when nydusd ends prefetching pub prefetch_end_time_secs: BasicMetric, + // The time milliseconds part when nydusd ends prefetching pub prefetch_end_time_millis: BasicMetric, pub buffered_backend_size: BasicMetric, pub data_all_ready: AtomicBool,