From 6c3a86b64f9a32b7eabe8bf1f457e491c52d705c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gell=C3=A9rt=20Peresztegi-Nagy?= Date: Mon, 24 Jun 2024 21:37:28 +0100 Subject: [PATCH] k/quotas: disable produce quota by default * Reinterpret the 0 value of `target_quota_byte_rate` as disable (this is safe as previously the minimum value was 1MB, so noone has this set to 0) * Change the default value to be disabled --- src/v/config/configuration.cc | 7 ++++--- src/v/config/configuration.h | 3 +++ src/v/kafka/server/client_quota_translator.cc | 9 +++++++-- src/v/kafka/server/tests/client_quota_translator_test.cc | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/v/config/configuration.cc b/src/v/config/configuration.cc index a81fc6311a266..da516c3aa7596 100644 --- a/src/v/config/configuration.cc +++ b/src/v/config/configuration.cc @@ -496,12 +496,13 @@ configuration::configuration() , target_quota_byte_rate( *this, "target_quota_byte_rate", - "Target request size quota byte rate (bytes per second) - 2GB default", + "Target request size quota byte rate (bytes per second) - disabled " + "default (= 0)", {.needs_restart = needs_restart::no, .example = "1073741824", .visibility = visibility::user}, - 2_GiB, - {.min = 1_MiB}) + target_produce_quota_byte_rate_default, + {.min = 0}) , target_fetch_quota_byte_rate( *this, "target_fetch_quota_byte_rate", diff --git a/src/v/config/configuration.h b/src/v/config/configuration.h index 9a252ccc93dc0..3a9195be501cb 100644 --- a/src/v/config/configuration.h +++ b/src/v/config/configuration.h @@ -46,6 +46,9 @@ namespace config { /// can not depend on any other module to prevent cyclic dependencies. struct configuration final : public config_store { + constexpr static auto target_produce_quota_byte_rate_default + = 0; // disabled + // WAL bounded_property log_segment_size; property> log_segment_size_min; diff --git a/src/v/kafka/server/client_quota_translator.cc b/src/v/kafka/server/client_quota_translator.cc index 4723c1bac1aad..cdc0d08ab8bc8 100644 --- a/src/v/kafka/server/client_quota_translator.cc +++ b/src/v/kafka/server/client_quota_translator.cc @@ -16,6 +16,8 @@ #include +#include + namespace kafka { using cluster::client_quota::entity_key; @@ -274,8 +276,11 @@ client_quota_translator::get_quota_config(client_quota_type qt) const { std::optional client_quota_translator::get_default_config(client_quota_type qt) const { switch (qt) { - case kafka::client_quota_type::produce_quota: - return _default_target_produce_tp_rate(); + case kafka::client_quota_type::produce_quota: { + auto produce_quota = _default_target_produce_tp_rate(); + return (produce_quota > 0) ? std::make_optional(produce_quota) + : std::nullopt; + } case kafka::client_quota_type::fetch_quota: return _default_target_fetch_tp_rate(); case kafka::client_quota_type::partition_mutation_quota: diff --git a/src/v/kafka/server/tests/client_quota_translator_test.cc b/src/v/kafka/server/tests/client_quota_translator_test.cc index 922a5a2684b4a..231cabecb7f62 100644 --- a/src/v/kafka/server/tests/client_quota_translator_test.cc +++ b/src/v/kafka/server/tests/client_quota_translator_test.cc @@ -87,7 +87,7 @@ SEASTAR_THREAD_TEST_CASE(quota_translator_default_test) { fixture f; auto default_limits = client_quota_limits{ - .produce_limit = scale_to_smp_count(2147483648), + .produce_limit = std::nullopt, .fetch_limit = std::nullopt, .partition_mutation_limit = std::nullopt, };