mirror of
https://github.com/apple/foundationdb.git
synced 2025-06-02 19:25:52 +08:00
Resolve review comments
This commit is contained in:
parent
c95fa062b2
commit
8a9be14171
@ -238,6 +238,23 @@ struct StorageServerMetrics {
|
||||
}
|
||||
}
|
||||
|
||||
// Due to the fact that read sampling will be called on all reads, use this specialized function to avoid overhead
|
||||
// around branch misses and unnecessary stack allocation which eventually addes up under heavy load.
|
||||
void notifyBytesReadPerKSecond(KeyRef key, int64_t in) {
|
||||
double expire = now() + SERVER_KNOBS->STORAGE_METRICS_AVERAGE_INTERVAL;
|
||||
int64_t bytesReadPerKSecond =
|
||||
bytesReadSample.addAndExpire(key, in, expire) * SERVER_KNOBS->STORAGE_METRICS_AVERAGE_INTERVAL_PER_KSECONDS;
|
||||
if (bytesReadPerKSecond > 0) {
|
||||
StorageMetrics notifyMetrics;
|
||||
notifyMetrics.bytesReadPerKSecond = bytesReadPerKSecond;
|
||||
auto& v = waitMetricsMap[key];
|
||||
for (int i = 0; i < v.size(); i++) {
|
||||
TEST(true); // ShardNotifyMetrics
|
||||
v[i].send(notifyMetrics);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called by StorageServerDisk when the size of a key in byteSample changes, to notify WaitMetricsRequest
|
||||
// Should not be called for keys past allKeys.end
|
||||
void notifyBytes( RangeMap<Key, std::vector<PromiseStream<StorageMetrics>>, KeyRangeRef>::Iterator shard, int64_t bytes ) {
|
||||
@ -271,23 +288,6 @@ struct StorageServerMetrics {
|
||||
}
|
||||
}
|
||||
|
||||
// Due to the fact that read sampling will be called on all reads, use this specialized function to avoid overhead
|
||||
// around branch misses and unnecessary stack allocation which eventually addes up under heavy load.
|
||||
void notifyBytesReadPerKSecond(KeyRef key, int64_t in) {
|
||||
double expire = now() + SERVER_KNOBS->STORAGE_METRICS_AVERAGE_INTERVAL;
|
||||
int64_t bytesReadPerKSecond =
|
||||
bytesReadSample.addAndExpire(key, in, expire) * SERVER_KNOBS->STORAGE_METRICS_AVERAGE_INTERVAL_PER_KSECONDS;
|
||||
if (bytesReadPerKSecond > 0) {
|
||||
StorageMetrics notifyMetrics;
|
||||
notifyMetrics.bytesReadPerKSecond = bytesReadPerKSecond;
|
||||
auto& v = waitMetricsMap[key];
|
||||
for (int i = 0; i < v.size(); i++) {
|
||||
TEST(true); // ShardNotifyMetrics
|
||||
v[i].send(notifyMetrics);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called periodically (~1 sec intervals) to remove older IOs from the averages
|
||||
// Removes old entries from metricsAverageQueue, updates metricsSampleMap accordingly, and notifies
|
||||
// WaitMetricsRequests through waitMetricsMap.
|
||||
|
Loading…
x
Reference in New Issue
Block a user