diff --git a/fdbclient/ServerKnobs.cpp b/fdbclient/ServerKnobs.cpp index f6470df614..a0c967bae9 100644 --- a/fdbclient/ServerKnobs.cpp +++ b/fdbclient/ServerKnobs.cpp @@ -774,6 +774,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi init( GLOBAL_TAG_THROTTLING_TAG_EXPIRE_AFTER, 240.0 ); init( PROXY_MAX_TAG_THROTTLE_DURATION, 5.0 ); if( randomize && BUGGIFY ) PROXY_MAX_TAG_THROTTLE_DURATION = 0.5; init( GLOBAL_TAG_THROTTLING_PROXY_LOGGING_INTERVAL, 60.0 ); + init( GLOBAL_TAG_THROTTLING_MIN_TPS, 1.0 ); //Storage Metrics init( STORAGE_METRICS_AVERAGE_INTERVAL, 120.0 ); diff --git a/fdbclient/include/fdbclient/ServerKnobs.h b/fdbclient/include/fdbclient/ServerKnobs.h index 0c91172b4b..7b6e64dfc0 100644 --- a/fdbclient/include/fdbclient/ServerKnobs.h +++ b/fdbclient/include/fdbclient/ServerKnobs.h @@ -667,6 +667,11 @@ public: double PROXY_MAX_TAG_THROTTLE_DURATION; // Interval at which latency bands are logged for each tag on grv proxy double GLOBAL_TAG_THROTTLING_PROXY_LOGGING_INTERVAL; + // When the measured tps for a tag gets too low, the denominator in the + // average cost calculation gets small, resulting in an unstable calculation. + // To protect against this, we do not compute the average cost when the + // measured tps drops below a certain threshold + double GLOBAL_TAG_THROTTLING_MIN_TPS; double MAX_TRANSACTIONS_PER_BYTE; diff --git a/fdbserver/GlobalTagThrottler.actor.cpp b/fdbserver/GlobalTagThrottler.actor.cpp index 0859de9b60..373f49e2e8 100644 --- a/fdbserver/GlobalTagThrottler.actor.cpp +++ b/fdbserver/GlobalTagThrottler.actor.cpp @@ -226,9 +226,9 @@ class GlobalTagThrottlerImpl { return {}; } auto const transactionRate = stats.get().getTransactionRate(); - // If there is less than one transaction per second, we do not have enough data + // If there is less than GLOBAL_TAG_THROTTLING_MIN_TPS transactions per second, we do not have enough data // to accurately compute an average transaction cost. - if (transactionRate < 1.0) { + if (transactionRate < SERVER_KNOBS->GLOBAL_TAG_THROTTLING_MIN_TPS) { return {}; } else { return std::max(static_cast(CLIENT_KNOBS->TAG_THROTTLING_PAGE_SIZE), cost.get() / transactionRate); @@ -247,7 +247,7 @@ class GlobalTagThrottlerImpl { auto const transactionRate = stats.get().getTransactionRate(); te.detail("TransactionRate", transactionRate); te.detail("Cost", cost); - if (transactionRate < 1.0) { + if (transactionRate < SERVER_KNOBS->GLOBAL_TAG_THROTTLING_MIN_TPS) { return {}; } else { return std::max(static_cast(CLIENT_KNOBS->TAG_THROTTLING_PAGE_SIZE), cost / transactionRate);