s3_client: track memory starvation in background filling fiber

Introduce a counter metric to monitor instances where the background
filling fiber is blocked due to insufficient memory in the S3 client.

Closes scylladb/scylladb#26466
This commit is contained in:
Ernest Zaslavsky
2025-10-09 10:01:29 +03:00
committed by Pavel Emelyanov
parent 125bf391a7
commit 413739824f
2 changed files with 8 additions and 0 deletions

View File

@@ -235,6 +235,11 @@ void client::group_client::register_metrics(std::string class_name, std::string
sm::description("Total time spend writing data to objects"), {ep_label, sg_label}),
sm::make_counter("total_read_prefetch_bytes", [this] { return prefetch_bytes; },
sm::description("Total number of bytes requested from object"), {ep_label, sg_label}),
sm::make_counter("downloads_blocked_on_memory",
[this] { return downloads_blocked_on_memory; },
sm::description("Counts the number of times S3 client downloads were delayed due to insufficient memory availability"),
{ep_label, sg_label})
});
}
@@ -1147,6 +1152,8 @@ class client::chunked_download_source final : public seastar::data_source_impl {
}
if (auto units = try_get_units(_client->_memory, _socket_buff_size); !_is_finished && !_buffers.empty() && !units) {
auto& gc = _client->find_or_create_client();
++gc.downloads_blocked_on_memory;
co_await _bg_fiber_cv.when([this] {
return _is_finished || _buffers.empty() || try_get_units(_client->_memory, _socket_buff_size);
});

View File

@@ -131,6 +131,7 @@ class client : public enable_shared_from_this<client> {
io_stats read_stats;
io_stats write_stats;
uint64_t prefetch_bytes = 0;
uint64_t downloads_blocked_on_memory = 0;
seastar::metrics::metric_groups metrics;
group_client(std::unique_ptr<http::experimental::connection_factory> f, unsigned max_conn, const aws::retry_strategy& retry_strategy);
void register_metrics(std::string class_name, std::string host);