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.
This commit is contained in:
Botond Dénes
2024-09-10 10:32:23 -04:00
parent 7d2b931619
commit 40b6616d3d

View File

@@ -809,6 +809,21 @@ static void do_dump_reader_permit_diagnostics(std::ostream& os, const reader_con
permit->get_state());
}
std::vector<sstring> 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");