From 1658f43467131a3624e5f6e54ac1467e764de57c Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Thu, 19 Dec 2024 16:57:17 +0100 Subject: [PATCH] Display the channel congestion --- crates/milli/src/update/new/indexer/write.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/milli/src/update/new/indexer/write.rs b/crates/milli/src/update/new/indexer/write.rs index fc647cfa5..f910d2e7f 100644 --- a/crates/milli/src/update/new/indexer/write.rs +++ b/crates/milli/src/update/new/indexer/write.rs @@ -71,7 +71,19 @@ pub(super) fn write_to_db( &mut aligned_embedding, )?; } + write_from_bbqueue(&mut writer_receiver, index, wtxn, arroy_writers, &mut aligned_embedding)?; + + let direct_attempts = writer_receiver.sent_messages_attempts(); + let blocking_attempts = writer_receiver.blocking_sent_messages_attempts(); + let congestion_pct = (blocking_attempts as f64 / direct_attempts as f64) * 100.0; + tracing::debug!( + "Channel congestion metrics - \ + Direct send attempts: {direct_attempts}, \ + Blocking send attempts: {blocking_attempts} \ + ({congestion_pct:.1}% congestion)" + ); + Ok(()) }