move OPERATION_COST_BYTE_FACTOR to CLIENT_KNOB; skip the first call of refreshBusiestTag.

This commit is contained in:
Xiaoxi Wang 2020-08-14 21:33:21 +00:00
parent 548ba06510
commit ffa1973242
5 changed files with 7 additions and 7 deletions

View File

@ -218,7 +218,7 @@ public:
int MAX_TRANSACTION_TAG_LENGTH;
int MAX_TAGS_PER_TRANSACTION;
int COMMIT_SAMPLE_COST; // The expectation of sampling is every COMMIT_SAMPLE_COST sample once
int OPERATION_COST_BYTE_FACTOR; // The same value as SERVER_KNOBS->OPERATION_COST_BYTE_FACTOR
int OPERATION_COST_BYTE_FACTOR;
int INCOMPLETE_SHARD_PLUS; // The size of (possible) incomplete shard when estimate clear range
double READ_TAG_SAMPLE_RATE; // Communicated to clients from cluster
double TAG_THROTTLE_SMOOTHING_WINDOW;

View File

@ -557,7 +557,6 @@ void ServerKnobs::initialize(bool randomize, ClientKnobs* clientKnobs, bool isSi
init( WAIT_METRICS_WRONG_SHARD_CHANCE, isSimulated ? 1.0 : 0.1 );
init( MIN_TAG_PAGES_RATE, 1.0e4 ); if( randomize && BUGGIFY ) MIN_TAG_PAGES_RATE = 0;
init( TAG_MEASUREMENT_INTERVAL, 30.0 ); if( randomize && BUGGIFY ) TAG_MEASUREMENT_INTERVAL = 1.0;
init( OPERATION_COST_BYTE_FACTOR, 16384 ); if( randomize && BUGGIFY ) OPERATION_COST_BYTE_FACTOR = 4096;
init( PREFIX_COMPRESS_KVS_MEM_SNAPSHOTS, true ); if( randomize && BUGGIFY ) PREFIX_COMPRESS_KVS_MEM_SNAPSHOTS = false;
//Wait Failure
@ -662,7 +661,6 @@ void ServerKnobs::initialize(bool randomize, ClientKnobs* clientKnobs, bool isSi
clientKnobs->IS_ACCEPTABLE_DELAY *
std::min(MAX_READ_TRANSACTION_LIFE_VERSIONS, MAX_WRITE_TRANSACTION_LIFE_VERSIONS) /
(5.0 * VERSIONS_PER_SECOND);
clientKnobs->OPERATION_COST_BYTE_FACTOR = OPERATION_COST_BYTE_FACTOR;
clientKnobs->INIT_MID_SHARD_BYTES = MIN_SHARD_BYTES;
}
}

View File

@ -486,7 +486,6 @@ public:
double WAIT_METRICS_WRONG_SHARD_CHANCE;
int64_t MIN_TAG_PAGES_RATE;
double TAG_MEASUREMENT_INTERVAL;
int64_t OPERATION_COST_BYTE_FACTOR;
bool PREFIX_COMPRESS_KVS_MEM_SNAPSHOTS;
//Wait Failure

View File

@ -570,7 +570,7 @@ struct RatekeeperData {
smoothBatchReleasedTransactions(SERVER_KNOBS->SMOOTHING_AMOUNT),
smoothTotalDurableBytes(SERVER_KNOBS->SLOW_SMOOTHING_AMOUNT),
actualTpsMetric(LiteralStringRef("Ratekeeper.ActualTPS")), lastWarning(0), lastSSListFetchedTimestamp(now()),
throttledTagChangeId(0), lastBusiestCommitTagPick(now()),
throttledTagChangeId(0), lastBusiestCommitTagPick(0),
normalLimits(TransactionPriority::DEFAULT, "", SERVER_KNOBS->TARGET_BYTES_PER_STORAGE_SERVER,
SERVER_KNOBS->SPRING_BYTES_STORAGE_SERVER, SERVER_KNOBS->TARGET_BYTES_PER_TLOG,
SERVER_KNOBS->SPRING_BYTES_TLOG, SERVER_KNOBS->MAX_TL_SS_VERSION_DIFFERENCE,
@ -846,8 +846,11 @@ ACTOR Future<Void> monitorThrottlingChanges(RatekeeperData *self) {
}
Future<Void> refreshStorageServerCommitCost(RatekeeperData *self) {
if(self->lastBusiestCommitTagPick == 0) { // the first call should be skipped
self->lastBusiestCommitTagPick = now();
return Void();
}
double elapsed = now() - self->lastBusiestCommitTagPick;
if(elapsed <= 0) return Void();
// for each SS, select the busiest commit tag from ssTagCommitCost
for(auto it = self->storageQueueInfo.begin(); it != self->storageQueueInfo.end(); ++it) {
it->value.busiestWriteTag.reset();

View File

@ -477,7 +477,7 @@ public:
Optional<TagInfo> previousBusiestTag;
int64_t costFunction(int64_t bytes) {
return bytes / SERVER_KNOBS->OPERATION_COST_BYTE_FACTOR + 1;
return bytes / CLIENT_KNOBS->OPERATION_COST_BYTE_FACTOR + 1;
}
void addRequest(Optional<TagSet> const& tags, int64_t bytes) {