diff --git a/fdbserver/GlobalTagThrottler.actor.cpp b/fdbserver/GlobalTagThrottler.actor.cpp index 98df4ae1ee..05901e4661 100644 --- a/fdbserver/GlobalTagThrottler.actor.cpp +++ b/fdbserver/GlobalTagThrottler.actor.cpp @@ -437,7 +437,7 @@ public: void addRequests(TransactionTag tag, int count) { tagStatistics[tag].addTransactions(static_cast(count)); } uint64_t getThrottledTagChangeId() const { return throttledTagChangeId; } - PrioritizedTransactionTagMap getRates() { + PrioritizedTransactionTagMap getProxyRates(int numProxies) { PrioritizedTransactionTagMap result; lastBusyReadTagCount = lastBusyWriteTagCount = 0; statusReply = {}; @@ -455,7 +455,8 @@ public: } if (targetTps.present()) { auto const smoothedTargetTps = stats.updateAndGetTargetLimit(targetTps.get()); - result[TransactionPriority::BATCH][tag] = result[TransactionPriority::DEFAULT][tag] = smoothedTargetTps; + result[TransactionPriority::BATCH][tag] = result[TransactionPriority::DEFAULT][tag] = + smoothedTargetTps / numProxies; } else { te.disable(); } @@ -543,8 +544,8 @@ uint64_t GlobalTagThrottler::getThrottledTagChangeId() const { PrioritizedTransactionTagMap GlobalTagThrottler::getClientRates() { return impl->getClientRates(); } -PrioritizedTransactionTagMap GlobalTagThrottler::getRates() { - return impl->getRates(); +PrioritizedTransactionTagMap GlobalTagThrottler::getProxyRates(int numProxies) { + return impl->getProxyRates(numProxies); } int64_t GlobalTagThrottler::autoThrottleCount() const { return impl->autoThrottleCount(); @@ -728,7 +729,7 @@ bool isNear(Optional a, Optional b) { bool targetRateIsNear(GlobalTagThrottler& globalTagThrottler, TransactionTag tag, Optional expected) { Optional rate; - auto targetRates = globalTagThrottler.getRates(); + auto targetRates = globalTagThrottler.getProxyRates(1); auto it1 = targetRates.find(TransactionPriority::DEFAULT); if (it1 != targetRates.end()) { auto it2 = it1->second.find(tag); diff --git a/fdbserver/Ratekeeper.actor.cpp b/fdbserver/Ratekeeper.actor.cpp index 0570782abd..4d376340aa 100644 --- a/fdbserver/Ratekeeper.actor.cpp +++ b/fdbserver/Ratekeeper.actor.cpp @@ -324,15 +324,9 @@ public: bool returningTagsToProxy{ false }; if (SERVER_KNOBS->ENFORCE_TAG_THROTTLING_ON_PROXIES) { - reply.proxyThrottledTags = self.tagThrottler->getRates(); - if (reply.proxyThrottledTags.present()) { - for (auto& [priority, tagToRate] : reply.proxyThrottledTags.get()) { - for (auto& [tag, rate] : tagToRate) { - rate /= self.grvProxyInfo.size(); - } - } - returningTagsToProxy = reply.proxyThrottledTags.get().size() > 0; - } + reply.proxyThrottledTags = self.tagThrottler->getProxyRates(self.grvProxyInfo.size()); + returningTagsToProxy = + reply.proxyThrottledTags.present() && reply.proxyThrottledTags.get().size() > 0; } else { reply.clientThrottledTags = self.tagThrottler->getClientRates(); returningTagsToProxy = diff --git a/fdbserver/TagThrottler.actor.cpp b/fdbserver/TagThrottler.actor.cpp index 81503ecd30..93332bb310 100644 --- a/fdbserver/TagThrottler.actor.cpp +++ b/fdbserver/TagThrottler.actor.cpp @@ -175,10 +175,6 @@ public: PrioritizedTransactionTagMap getClientRates() { return throttledTags.getClientRates(autoThrottlingEnabled); } - PrioritizedTransactionTagMap getRates() const { - // TODO: Implement (currently not supported) - return {}; - } int64_t autoThrottleCount() const { return throttledTags.autoThrottleCount(); } uint32_t busyReadTagCount() const { return throttledTags.getBusyReadTagCount(); } uint32_t busyWriteTagCount() const { return throttledTags.getBusyWriteTagCount(); } @@ -224,9 +220,6 @@ uint64_t TagThrottler::getThrottledTagChangeId() const { PrioritizedTransactionTagMap TagThrottler::getClientRates() { return impl->getClientRates(); } -PrioritizedTransactionTagMap TagThrottler::getRates() { - return impl->getRates(); -} int64_t TagThrottler::autoThrottleCount() const { return impl->autoThrottleCount(); } diff --git a/fdbserver/include/fdbserver/TagThrottler.h b/fdbserver/include/fdbserver/TagThrottler.h index a757899ede..5bc5818979 100644 --- a/fdbserver/include/fdbserver/TagThrottler.h +++ b/fdbserver/include/fdbserver/TagThrottler.h @@ -42,7 +42,7 @@ public: // For each tag and priority combination, return the throughput limit for the cluster // (to be shared across all GRV proxies) - virtual PrioritizedTransactionTagMap getRates() = 0; + virtual PrioritizedTransactionTagMap getProxyRates(int numProxies) = 0; virtual int64_t autoThrottleCount() const = 0; virtual uint32_t busyReadTagCount() const = 0; @@ -68,7 +68,7 @@ public: void addRequests(TransactionTag tag, int count) override; uint64_t getThrottledTagChangeId() const override; PrioritizedTransactionTagMap getClientRates() override; - PrioritizedTransactionTagMap getRates() override; + PrioritizedTransactionTagMap getProxyRates(int numProxies) override { throw not_implemented(); } int64_t autoThrottleCount() const override; uint32_t busyReadTagCount() const override; uint32_t busyWriteTagCount() const override; @@ -97,7 +97,7 @@ public: Future tryUpdateAutoThrottling(StorageQueueInfo const&) override; PrioritizedTransactionTagMap getClientRates() override; - PrioritizedTransactionTagMap getRates() override; + PrioritizedTransactionTagMap getProxyRates(int numProxies) override; GlobalTagThrottlerStatusReply getGlobalTagThrottlerStatusReply() const override;