Address review comments

This commit is contained in:
Xin Dong 2019-09-12 10:17:12 -07:00
parent 6b0f771cc0
commit cd4757b06c
4 changed files with 19 additions and 7 deletions

View File

@ -201,12 +201,14 @@ ACTOR Future<Void> trackShardBytes(DataDistributionTracker* self, KeyRange keys,
}
if (newReadBandwithStatus == ReadBandwithStatusNormal) {
TEST(true);
bounds.max.bytesReadPerKSecond = SERVER_KNOBS->SHARD_MAX_BYTES_READ_PER_KSEC * 1.1;
bounds.max.bytesReadPerKSecond = SERVER_KNOBS->SHARD_MAX_BYTES_READ_PER_KSEC *
(1.0 + SERVER_KNOBS->SHARD_MAX_BYTES_READ_PER_KSEC_JITTER);
bounds.min.bytesReadPerKSecond = 0;
} else if (newReadBandwithStatus == ReadBandwithStatusHigh) {
TEST(true);
bounds.max.bytesReadPerKSecond = bounds.max.infinity;
bounds.min.bytesReadPerKSecond = SERVER_KNOBS->SHARD_MAX_BYTES_READ_PER_KSEC * 0.9;
bounds.min.bytesReadPerKSecond = SERVER_KNOBS->SHARD_MAX_BYTES_READ_PER_KSEC *
(1.0 - SERVER_KNOBS->SHARD_MAX_BYTES_READ_PER_KSEC_JITTER);
} else {
ASSERT(false);
}

View File

@ -118,6 +118,7 @@ ServerKnobs::ServerKnobs(bool randomize, ClientKnobs* clientKnobs) {
bool buggifySmallBandwidthSplit = randomize && BUGGIFY;
init( SHARD_MAX_BYTES_PER_KSEC, 1LL*1000000*1000 ); if( buggifySmallBandwidthSplit ) SHARD_MAX_BYTES_PER_KSEC = 10LL*1000*1000;
init( SHARD_MAX_BYTES_READ_PER_KSEC, 1LL*1000000*1000 ); if( buggifySmallBandwidthSplit ) SHARD_MAX_BYTES_READ_PER_KSEC = 10LL*1000*1000;
init( SHARD_MAX_BYTES_READ_PER_KSEC_JITTER, 0.1 );
/* 10*1MB/sec * 1000sec/ksec
Shards with more than this bandwidth will be split immediately.
For a large shard (100MB), splitting it costs ~100MB of work or about 10MB/sec over a 10 sec sampling window.

View File

@ -114,6 +114,7 @@ public:
SHARD_MIN_BYTES_PER_KSEC, // Shards with more than this bandwidth will not be merged
SHARD_SPLIT_BYTES_PER_KSEC; // When splitting a shard, it is split into pieces with less than this bandwidth
int64_t SHARD_MAX_BYTES_READ_PER_KSEC;
double SHARD_MAX_BYTES_READ_PER_KSEC_JITTER;
double STORAGE_METRIC_TIMEOUT;
double METRIC_DELAY;
double ALL_DATA_REMOVED_DELAY;

View File

@ -890,9 +890,9 @@ ACTOR Future<Void> getValueQ( StorageServer* data, GetValueRequest req ) {
}
StorageMetrics metrics;
metrics.bytesReadPerKSecond = v.present()
? std::max((int64_t)v.get().size(), SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE)
: SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE;
metrics.bytesReadPerKSecond = v.present() ? std::max((int64_t)(req.key.size() + v.get().size()),
SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE)
: SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE;
metrics.iosPerKSecond = 1;
data->metrics.notify(req.key, metrics);
@ -1095,6 +1095,7 @@ ACTOR Future<GetKeyValuesReply> readRange( StorageServer* data, Version version,
state KeyRef readEnd;
state Key readBeginTemp;
state int vCount;
state int64_t readSize;
//state UID rrid = deterministicRandom()->randomUniqueID();
//state int originalLimit = limit;
//state int originalLimitBytes = *pLimitBytes;
@ -1163,8 +1164,10 @@ ACTOR Future<GetKeyValuesReply> readRange( StorageServer* data, Version version,
merge( result.arena, result.data, atStorageVersion, vStart, vEnd, vCount, limit, more, *pLimitBytes );
limit -= result.data.size() - prevSize;
for (auto i = &result.data[prevSize]; i != result.data.end(); i++)
for (auto i = &result.data[prevSize]; i != result.data.end(); i++) {
*pLimitBytes -= sizeof(KeyValueRef) + i->expectedSize();
readSize += sizeof(KeyValueRef) + i->expectedSize();
}
// Setup for the next iteration
if (more) { // if there might be more data, begin reading right after what we already found to find out
@ -1251,8 +1254,10 @@ ACTOR Future<GetKeyValuesReply> readRange( StorageServer* data, Version version,
merge( result.arena, result.data, atStorageVersion, vStart, vEnd, vCount, limit, false, *pLimitBytes );
limit += result.data.size() - prevSize;
for (auto i = &result.data[prevSize]; i != result.data.end(); i++)
for (auto i = &result.data[prevSize]; i != result.data.end(); i++) {
*pLimitBytes -= sizeof(KeyValueRef) + i->expectedSize();
readSize += sizeof(KeyValueRef) + i->expectedSize();
}
vStart = vEnd;
readEnd = readBegin;
@ -1266,6 +1271,9 @@ ACTOR Future<GetKeyValuesReply> readRange( StorageServer* data, Version version,
}
result.more = limit == 0 || *pLimitBytes<=0; // FIXME: Does this have to be exact?
result.version = version;
StorageMetrics metrics;
metrics.bytesReadPerKSecond = std::max(readSize, SERVER_KNOBS->BYTES_READ_UNITS_PER_SAMPLE);
data->metrics.notify(limit >= 0 ? range.begin : range.end, metrics);
return result;
}