Move lastBusiestCommitTagPick field back to Ratekeeper

This commit is contained in:
sfc-gh-tclinkenbeard 2022-02-14 16:15:51 -08:00
parent 00f12687c6
commit 796249e99d
3 changed files with 9 additions and 11 deletions

View File

@ -462,7 +462,8 @@ Ratekeeper::Ratekeeper(UID id, Database db)
SERVER_KNOBS->TARGET_BYTES_PER_TLOG_BATCH,
SERVER_KNOBS->SPRING_BYTES_TLOG_BATCH,
SERVER_KNOBS->MAX_TL_SS_VERSION_DIFFERENCE_BATCH,
SERVER_KNOBS->TARGET_DURABILITY_LAG_VERSIONS_BATCH) {
SERVER_KNOBS->TARGET_DURABILITY_LAG_VERSIONS_BATCH),
lastBusiestCommitTagPick(0.0) {
tagThrottler = std::make_unique<TagThrottler>(this);
expiredTagThrottleCleanup = recurring([this]() { ThrottleApi::expire(this->db.getReference()); },
SERVER_KNOBS->TAG_THROTTLE_EXPIRED_CLEANUP_INTERVAL);
@ -964,11 +965,11 @@ void Ratekeeper::updateRate(RatekeeperLimits* limits) {
}
Future<Void> Ratekeeper::refreshStorageServerCommitCost() {
if (tagThrottler->getLastBusiestCommitTagPick() == 0) { // the first call should be skipped
tagThrottler->updateLastBusiestCommitTagPick();
if (lastBusiestCommitTagPick == 0) { // the first call should be skipped
lastBusiestCommitTagPick = now();
return Void();
}
double elapsed = now() - tagThrottler->getLastBusiestCommitTagPick();
double elapsed = now() - lastBusiestCommitTagPick;
// for each SS, select the busiest commit tag from ssTrTagCommitCost
for (auto it = storageQueueInfo.begin(); it != storageQueueInfo.end(); ++it) {
it->value.busiestWriteTag.reset();
@ -1006,7 +1007,7 @@ Future<Void> Ratekeeper::refreshStorageServerCommitCost() {
it->value.totalWriteOps = 0;
it->value.totalWriteCosts = 0;
}
tagThrottler->updateLastBusiestCommitTagPick();
lastBusiestCommitTagPick = now();
return Void();
}

View File

@ -181,6 +181,8 @@ struct Ratekeeper {
Future<Void> expiredTagThrottleCleanup;
double lastBusiestCommitTagPick;
Ratekeeper(UID id, Database db);
Future<Void> configurationMonitor();

View File

@ -386,11 +386,10 @@ class TagThrottler {
Ratekeeper* ratekeeper;
RkTagThrottleCollection throttledTags;
uint64_t throttledTagChangeId{ 0 };
double lastBusiestCommitTagPick;
bool autoThrottlingEnabled{ false };
public:
TagThrottler(Ratekeeper* ratekeeper) : ratekeeper(ratekeeper), lastBusiestCommitTagPick(0.0) {}
TagThrottler(Ratekeeper* ratekeeper) : ratekeeper(ratekeeper) {}
Future<Void> monitorThrottlingChanges();
void addRequests(TransactionTag tag, int count) { throttledTags.addRequests(tag, count); }
uint64_t getThrottledTagChangeId() const { return throttledTagChangeId; }
@ -405,8 +404,4 @@ public:
Optional<double> autoThrottleTag(UID id, TransactionTag tag, double busyness) {
return throttledTags.autoThrottleTag(id, tag, busyness);
}
void updateLastBusiestCommitTagPick() { lastBusiestCommitTagPick = now(); }
double getLastBusiestCommitTagPick() const { return lastBusiestCommitTagPick; }
};