Merge pull request #10725 from sfc-gh-tclinkenbeard/main-throttle-multiple-write-tags
Monitor multiple write tags in `StorageQueueInfo::refreshCommitCost`
This commit is contained in:
commit
3ebbe8c7a0
|
@ -1403,20 +1403,31 @@ UpdateCommitCostRequest StorageQueueInfo::refreshCommitCost(double elapsed) {
|
|||
busiestWriteTags.clear();
|
||||
TransactionTag busiestTag;
|
||||
TransactionCommitCostEstimation maxCost;
|
||||
double maxRate = 0, maxBusyness = 0;
|
||||
double maxRate = 0;
|
||||
std::priority_queue<BusyTagInfo, std::vector<BusyTagInfo>, std::greater<BusyTagInfo>> topKWriters;
|
||||
for (const auto& [tag, cost] : tagCostEst) {
|
||||
double rate = cost.getCostSum() / elapsed;
|
||||
double busyness = static_cast<double>(maxCost.getCostSum()) / totalWriteCosts;
|
||||
if (rate < SERVER_KNOBS->MIN_TAG_WRITE_PAGES_RATE * CLIENT_KNOBS->TAG_THROTTLING_PAGE_SIZE) {
|
||||
continue;
|
||||
}
|
||||
if (topKWriters.size() < SERVER_KNOBS->SS_THROTTLE_TAGS_TRACKED) {
|
||||
topKWriters.emplace(tag, rate, busyness);
|
||||
} else if (topKWriters.top().rate < rate) {
|
||||
topKWriters.pop();
|
||||
topKWriters.emplace(tag, rate, busyness);
|
||||
}
|
||||
|
||||
if (rate > maxRate) {
|
||||
busiestTag = tag;
|
||||
maxRate = rate;
|
||||
maxCost = cost;
|
||||
}
|
||||
}
|
||||
if (maxRate > SERVER_KNOBS->MIN_TAG_WRITE_PAGES_RATE * CLIENT_KNOBS->TAG_THROTTLING_PAGE_SIZE) {
|
||||
// TraceEvent("RefreshSSCommitCost").detail("TotalWriteCost", totalWriteCost).detail("TotalWriteOps",totalWriteOps);
|
||||
ASSERT_GT(totalWriteCosts, 0);
|
||||
maxBusyness = double(maxCost.getCostSum()) / totalWriteCosts;
|
||||
busiestWriteTags.emplace_back(busiestTag, maxRate, maxBusyness);
|
||||
|
||||
while (!topKWriters.empty()) {
|
||||
busiestWriteTags.push_back(std::move(topKWriters.top()));
|
||||
topKWriters.pop();
|
||||
}
|
||||
|
||||
UpdateCommitCostRequest updateCommitCostRequest{ ratekeeperID,
|
||||
|
|
Loading…
Reference in New Issue