From 40b6616d3d75e784ac2f7a7091700f9e5e09f38e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Tue, 10 Sep 2024 10:32:23 -0400 Subject: [PATCH] reader_concurrency_semaphore: add bottleneck self-diagnosis to diagnosis dump There are a few typical cases of bottlenecks, which can be easily identified when dumping the semaphore diagnostics. Identify and print these to fast-track investigations. --- reader_concurrency_semaphore.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/reader_concurrency_semaphore.cc b/reader_concurrency_semaphore.cc index 0d6e755a11..d28ab1db99 100644 --- a/reader_concurrency_semaphore.cc +++ b/reader_concurrency_semaphore.cc @@ -809,6 +809,21 @@ static void do_dump_reader_permit_diagnostics(std::ostream& os, const reader_con permit->get_state()); } + std::vector bottlenecks; + if (semaphore.get_stats().need_cpu_permits > 0) { + bottlenecks.push_back("CPU"); + } + if (semaphore.available_resources().memory <= 0) { + bottlenecks.push_back("memory"); + } + if (semaphore.available_resources().count <= 0) { + bottlenecks.push_back("disk"); + } + + if (!bottlenecks.empty()) { + fmt::print(os, "Identified bottleneck(s): {}\n", fmt::join(bottlenecks, ", ")); + } + fmt::print(os, "\n"); total += do_dump_reader_permit_diagnostics(os, permits, max_lines); fmt::print(os, "\n");