-
Notifications
You must be signed in to change notification settings - Fork 970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add eviction cycle metrics #4144
Conversation
src/bucket/BucketManagerImpl.cpp
Outdated
mBytesScannedForEviction, | ||
mIncompleteBucketScans); | ||
mBucketList->scanForEviction( | ||
mApp, ltx, ledgerSeq, mEntriesEvicted, mBytesScannedForEviction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make these metrics live in Bucketlist instead of passing them here? They don't seem to be used outside of Bucketlist anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the standard interface we use for all BucketList related metrics. The BucketList itself is a very light weight class (the only member is std::vector<BucketLevel> mLevels;
). We could do this, but we would also have to change the BucketList constructor from BucketList()
to BucketList(Application)
, which would be annoying for tests and a bit of a refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I flagged this because this function signature is getting a bit out of hand. Could we use a struct here?
if (metrics.has_value()) | ||
{ | ||
++metrics->numEntriesEvicted; | ||
metrics->evictedEntriesAgeSum += |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to sum it up like this? we could use a histrogram (that would live inside Bucket
), and update it every time we evict a single entry instead of manually aggregating evictions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually don't want a histogram and specifically want the per-cycle aggregation. A histogram for this metric is misleading. Given the nature of the eviction scan, entries evicted in level 8 will almost certainly be "older" than entries evicted in level 6. Within a given cycle, the number of evicted entries is very noisy from level to level. We want to abstract away that noise. We only care if the average age increases cycle-to-cycle. This would be pretty involved to graph in Grafana if we use a histogram, as the cycle length itself is variable. This seemed significantly easier, as it logs the only metric we actually care about (average cycle-to-cycle) in a way that is easy to analyze in Grafana.
src/bucket/BucketList.h
Outdated
{ | ||
// Evicted entry "age" is the delta between its liveUntilLedger and the | ||
// ledger when the entry is actually evicted | ||
uint64_t evictedEntriesAgeSum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uninitialized variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(also see my other comment regarding average age, I think you can remove this struct completely, and only keep evictionCycleStartLedger)
ccbc81e
to
7d6b26b
Compare
7d6b26b
to
407d836
Compare
r+ 407d836 |
Description
Resolves #4137
Adds additional metrics for eviction scans. Specifically, records the period of eviction scans in ledgers and the average amount of time it takes for an entry to get evicted after expiring.
Checklist
clang-format
v8.0.0 (viamake format
or the Visual Studio extension)