revert the mvccStorageBytes for write sample change and mark it with FIXME

This commit is contained in:
Xiaoxi Wang 2022-11-09 13:15:46 -08:00
parent 62b88a0772
commit 3fb12680e3
3 changed files with 15 additions and 9 deletions

View File

@ -634,7 +634,7 @@ struct GetShardStateRequest {
struct StorageMetrics {
constexpr static FileIdentifier file_identifier = 13622226;
int64_t bytes = 0; // total storage
int64_t writeBytesPerKSecond = 0; // network bandwidth (average over 10s) == write bandwidth through any IO devices
int64_t writeBytesPerKSecond = 0; // bytes write to SQ
// FIXME: currently, iosPerKSecond is not used in DataDistribution calculations.
int64_t iosPerKSecond = 0;
@ -1180,4 +1180,13 @@ struct StorageQueuingMetricsRequest {
}
};
// Memory size for storing mutation in the mutation log and the versioned map.
inline int mvccStorageBytes(int mutationBytes) {
// Why * 2:
// - 1 insertion into version map costs 2 nodes in avg;
// - The mutation will be stored in both mutation log and versioned map;
return VersionedMap<KeyRef, ValueOrClearToRef>::overheadPerItem * 2 +
(mutationBytes + MutationRef::OVERHEAD_BYTES) * 2;
}
#endif

View File

@ -401,7 +401,8 @@ void MockStorageServer::clearRangeTotalBytes(KeyRangeRef const& range, int64_t b
void MockStorageServer::notifyWriteMetrics(KeyRef const& key, int64_t size) {
// update write bandwidth and iops as mock the cost of writing a mutation
StorageMetrics s;
s.writeBytesPerKSecond = size + MutationRef::OVERHEAD_BYTES;
// FIXME: remove the / 2 and double the related knobs.
s.writeBytesPerKSecond = mvccStorageBytes(size) / 2;
s.iosPerKSecond = 1;
metrics.notify(key, s);
}
@ -1000,7 +1001,6 @@ TEST_CASE("/MockGlobalState/MockStorageServer/DataOpsSet") {
// If sampled
ASSERT_EQ(res.first.get().bytes, testSize);
ASSERT_GT(res.first.get().writeBytesPerKSecond, 0);
ASSERT_GT(res.first.get().iosPerKSecond, 0);
}
}
return Void();

View File

@ -534,12 +534,8 @@ const int VERSION_OVERHEAD =
// createNewVersion(version+1) ], 64b
// overhead for map
// Memory size for storing mutation in the mutation log and the versioned map.
static int mvccStorageBytes(MutationRef const& m) {
// Why * 2:
// - 1 insertion into version map costs 2 nodes in avg;
// - The mutation will be stored in both mutation log and versioned map;
return VersionedMap<KeyRef, ValueOrClearToRef>::overheadPerItem * 2 + m.totalSize() * 2;
return mvccStorageBytes(m.param1.size() + m.param2.size());
}
struct FetchInjectionInfo {
@ -5616,7 +5612,8 @@ void applyMutation(StorageServer* self,
// m is expected to be in arena already
// Clear split keys are added to arena
StorageMetrics metrics;
metrics.writeBytesPerKSecond = m.totalSize(); // comparable to counter.mutationBytes
// FIXME: remove the / 2 and double the related knobs.
metrics.writeBytesPerKSecond = mvccStorageBytes(m) / 2; // comparable to counter.bytesInput / 2
metrics.iosPerKSecond = 1;
self->metrics.notify(m.param1, metrics);