mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 09:58:50 +08:00
Reenable GlobalTagThrottler_GotClientRate trace events
This commit is contained in:
parent
f197314cb5
commit
8a18fa23cf
@ -405,7 +405,16 @@ class GlobalTagThrottlerImpl {
|
||||
}
|
||||
}
|
||||
|
||||
Optional<double> getTargetTps(TransactionTag tag, bool& isReadBusy, bool& isWriteBusy) const {
|
||||
public:
|
||||
GlobalTagThrottlerImpl(Database db, UID id) : db(db), id(id) {}
|
||||
Future<Void> monitorThrottlingChanges() { return monitorThrottlingChanges(this); }
|
||||
void addRequests(TransactionTag tag, int count) { tagStatistics[tag].addTransactions(count); }
|
||||
uint64_t getThrottledTagChangeId() const { return throttledTagChangeId; }
|
||||
PrioritizedTransactionTagMap<ClientTagThrottleLimits> getClientRates() {
|
||||
PrioritizedTransactionTagMap<ClientTagThrottleLimits> result;
|
||||
lastBusyReadTagCount = lastBusyWriteTagCount = 0;
|
||||
for (auto& [tag, stats] : tagStatistics) {
|
||||
// Currently there is no differentiation between batch priority and default priority transactions
|
||||
auto const readLimitingTps = getLimitingTps(tag, OpType::READ);
|
||||
auto const writeLimitingTps = getLimitingTps(tag, OpType::WRITE);
|
||||
Optional<double> limitingTps;
|
||||
@ -431,14 +440,14 @@ class GlobalTagThrottlerImpl {
|
||||
}
|
||||
|
||||
if (!desiredTps.present()) {
|
||||
return {};
|
||||
continue;
|
||||
}
|
||||
|
||||
if (readLimitingTps.present() && readLimitingTps.get() < readDesiredTps.orDefault(0)) {
|
||||
isReadBusy = true;
|
||||
++lastBusyReadTagCount;
|
||||
}
|
||||
if (writeLimitingTps.present() && writeLimitingTps.get() < writeDesiredTps.orDefault(0)) {
|
||||
isWriteBusy = true;
|
||||
++lastBusyWriteTagCount;
|
||||
}
|
||||
|
||||
auto const readReservedTps = getReservedTps(tag, OpType::READ, averageTransactionReadCost);
|
||||
@ -459,35 +468,10 @@ class GlobalTagThrottlerImpl {
|
||||
if (reservedTps.present()) {
|
||||
targetTps = std::max(targetTps, reservedTps.get());
|
||||
}
|
||||
return targetTps;
|
||||
}
|
||||
|
||||
public:
|
||||
GlobalTagThrottlerImpl(Database db, UID id) : db(db), id(id) {}
|
||||
Future<Void> monitorThrottlingChanges() { return monitorThrottlingChanges(this); }
|
||||
void addRequests(TransactionTag tag, int count) { tagStatistics[tag].addTransactions(count); }
|
||||
uint64_t getThrottledTagChangeId() const { return throttledTagChangeId; }
|
||||
PrioritizedTransactionTagMap<ClientTagThrottleLimits> getClientRates() {
|
||||
PrioritizedTransactionTagMap<ClientTagThrottleLimits> result;
|
||||
lastBusyReadTagCount = lastBusyWriteTagCount = 0;
|
||||
for (auto& [tag, stats] : tagStatistics) {
|
||||
// Currently there is no differentiation between batch priority and default priority transactions
|
||||
auto isReadBusy = false;
|
||||
auto isWriteBusy = false;
|
||||
auto const targetTps = getTargetTps(tag, isReadBusy, isWriteBusy);
|
||||
if (isReadBusy) {
|
||||
++lastBusyReadTagCount;
|
||||
}
|
||||
if (isWriteBusy) {
|
||||
++lastBusyWriteTagCount;
|
||||
}
|
||||
if (!targetTps.present()) {
|
||||
continue;
|
||||
}
|
||||
auto const clientRate = stats.updateAndGetPerClientLimit(targetTps.get());
|
||||
auto const clientRate = stats.updateAndGetPerClientLimit(targetTps);
|
||||
result[TransactionPriority::BATCH][tag] = result[TransactionPriority::DEFAULT][tag] = clientRate;
|
||||
|
||||
/*
|
||||
TraceEvent("GlobalTagThrottler_GotClientRate", id)
|
||||
.detail("Tag", printable(tag))
|
||||
.detail("TargetTps", targetTps)
|
||||
@ -498,10 +482,10 @@ public:
|
||||
.detail("ReservedTps", reservedTps)
|
||||
.detail("DesiredTps", desiredTps)
|
||||
.detail("NumStorageServers", throughput.size());
|
||||
*/
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int64_t autoThrottleCount() const {
|
||||
int64_t result{ 0 };
|
||||
for (const auto& [tag, stats] : tagStatistics) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user