From f73ea1b48672d28fc295751a2de646c2a0f7b990 Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Wed, 29 Sep 2021 12:33:37 -0700 Subject: [PATCH] get_object_impl(): log number of chunks in byte stream (#469) In ObjectAccess::get_object_impl(), log the number of Bytes instances in the ByteStream that we receive. FYI, this seems to average around 8-12KB per chunk. --- cmd/zfs_object_agent/zettaobject/src/object_access.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/zfs_object_agent/zettaobject/src/object_access.rs b/cmd/zfs_object_agent/zettaobject/src/object_access.rs index 65819e07c885..111086a29981 100644 --- a/cmd/zfs_object_agent/zettaobject/src/object_access.rs +++ b/cmd/zfs_object_agent/zettaobject/src/object_access.rs @@ -264,11 +264,13 @@ impl ObjectAccess { let begin = Instant::now(); let mut v = Vec::with_capacity(usize::try_from(output.content_length.unwrap_or(0)).unwrap()); + let mut count = 0; match output .body .unwrap() .try_for_each(|b| { v.extend_from_slice(&b); + count += 1; future::ready(Ok(())) }) .await @@ -279,9 +281,10 @@ impl ObjectAccess { } Ok(_) => { debug!( - "{}: got {} bytes of data in {}ms", + "{}: got {} bytes of data in {} chunks in {}ms", msg, v.len(), + count, begin.elapsed().as_millis() ); Ok(v)