Move lastBusiestCommitTagPick field back to Ratekeeper
This commit is contained in:
parent
00f12687c6
commit
796249e99d
|
@ -462,7 +462,8 @@ Ratekeeper::Ratekeeper(UID id, Database db)
|
||||||
SERVER_KNOBS->TARGET_BYTES_PER_TLOG_BATCH,
|
SERVER_KNOBS->TARGET_BYTES_PER_TLOG_BATCH,
|
||||||
SERVER_KNOBS->SPRING_BYTES_TLOG_BATCH,
|
SERVER_KNOBS->SPRING_BYTES_TLOG_BATCH,
|
||||||
SERVER_KNOBS->MAX_TL_SS_VERSION_DIFFERENCE_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);
|
tagThrottler = std::make_unique<TagThrottler>(this);
|
||||||
expiredTagThrottleCleanup = recurring([this]() { ThrottleApi::expire(this->db.getReference()); },
|
expiredTagThrottleCleanup = recurring([this]() { ThrottleApi::expire(this->db.getReference()); },
|
||||||
SERVER_KNOBS->TAG_THROTTLE_EXPIRED_CLEANUP_INTERVAL);
|
SERVER_KNOBS->TAG_THROTTLE_EXPIRED_CLEANUP_INTERVAL);
|
||||||
|
@ -964,11 +965,11 @@ void Ratekeeper::updateRate(RatekeeperLimits* limits) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Void> Ratekeeper::refreshStorageServerCommitCost() {
|
Future<Void> Ratekeeper::refreshStorageServerCommitCost() {
|
||||||
if (tagThrottler->getLastBusiestCommitTagPick() == 0) { // the first call should be skipped
|
if (lastBusiestCommitTagPick == 0) { // the first call should be skipped
|
||||||
tagThrottler->updateLastBusiestCommitTagPick();
|
lastBusiestCommitTagPick = now();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
double elapsed = now() - tagThrottler->getLastBusiestCommitTagPick();
|
double elapsed = now() - lastBusiestCommitTagPick;
|
||||||
// for each SS, select the busiest commit tag from ssTrTagCommitCost
|
// for each SS, select the busiest commit tag from ssTrTagCommitCost
|
||||||
for (auto it = storageQueueInfo.begin(); it != storageQueueInfo.end(); ++it) {
|
for (auto it = storageQueueInfo.begin(); it != storageQueueInfo.end(); ++it) {
|
||||||
it->value.busiestWriteTag.reset();
|
it->value.busiestWriteTag.reset();
|
||||||
|
@ -1006,7 +1007,7 @@ Future<Void> Ratekeeper::refreshStorageServerCommitCost() {
|
||||||
it->value.totalWriteOps = 0;
|
it->value.totalWriteOps = 0;
|
||||||
it->value.totalWriteCosts = 0;
|
it->value.totalWriteCosts = 0;
|
||||||
}
|
}
|
||||||
tagThrottler->updateLastBusiestCommitTagPick();
|
lastBusiestCommitTagPick = now();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,8 @@ struct Ratekeeper {
|
||||||
|
|
||||||
Future<Void> expiredTagThrottleCleanup;
|
Future<Void> expiredTagThrottleCleanup;
|
||||||
|
|
||||||
|
double lastBusiestCommitTagPick;
|
||||||
|
|
||||||
Ratekeeper(UID id, Database db);
|
Ratekeeper(UID id, Database db);
|
||||||
|
|
||||||
Future<Void> configurationMonitor();
|
Future<Void> configurationMonitor();
|
||||||
|
|
|
@ -386,11 +386,10 @@ class TagThrottler {
|
||||||
Ratekeeper* ratekeeper;
|
Ratekeeper* ratekeeper;
|
||||||
RkTagThrottleCollection throttledTags;
|
RkTagThrottleCollection throttledTags;
|
||||||
uint64_t throttledTagChangeId{ 0 };
|
uint64_t throttledTagChangeId{ 0 };
|
||||||
double lastBusiestCommitTagPick;
|
|
||||||
bool autoThrottlingEnabled{ false };
|
bool autoThrottlingEnabled{ false };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TagThrottler(Ratekeeper* ratekeeper) : ratekeeper(ratekeeper), lastBusiestCommitTagPick(0.0) {}
|
TagThrottler(Ratekeeper* ratekeeper) : ratekeeper(ratekeeper) {}
|
||||||
Future<Void> monitorThrottlingChanges();
|
Future<Void> monitorThrottlingChanges();
|
||||||
void addRequests(TransactionTag tag, int count) { throttledTags.addRequests(tag, count); }
|
void addRequests(TransactionTag tag, int count) { throttledTags.addRequests(tag, count); }
|
||||||
uint64_t getThrottledTagChangeId() const { return throttledTagChangeId; }
|
uint64_t getThrottledTagChangeId() const { return throttledTagChangeId; }
|
||||||
|
@ -405,8 +404,4 @@ public:
|
||||||
Optional<double> autoThrottleTag(UID id, TransactionTag tag, double busyness) {
|
Optional<double> autoThrottleTag(UID id, TransactionTag tag, double busyness) {
|
||||||
return throttledTags.autoThrottleTag(id, tag, busyness);
|
return throttledTags.autoThrottleTag(id, tag, busyness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateLastBusiestCommitTagPick() { lastBusiestCommitTagPick = now(); }
|
|
||||||
|
|
||||||
double getLastBusiestCommitTagPick() const { return lastBusiestCommitTagPick; }
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue