Create GLOBAL_TAG_THROTTLING_MIN_TPS knob

This commit is contained in:
sfc-gh-tclinkenbeard 2023-01-24 10:56:48 -08:00 committed by Trevor Clinkenbeard
parent 7f9ec344db
commit dd2ba18d45
3 changed files with 9 additions and 3 deletions

View File

@ -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 );

View File

@ -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;

View File

@ -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<double>(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<double>(CLIENT_KNOBS->TAG_THROTTLING_PAGE_SIZE), cost / transactionRate);