Closed byrnedj closed 1 year ago
Can we add some tests for per-tier stats?
In general looks good. Can you paste here some example output with those stats?
cachelib/allocator/Cache.cpp
line 239 at r1 (raw file):
//TODO: per-tier const auto stats = getGlobalCacheStats();
Does this change mean currently these starts are only aggregated for tier 0 ?
cachelib/allocator/CacheAllocator-inl.h
line 2799 at r1 (raw file):
MMContainerStat mmContainerStats; for (TierId tid = 0; tid < getNumTiers(); tid++) { allocAttempts += (*stats_.allocAttempts)[tid][poolId][cid].get();
Just wondering is it possible to implement a + operator override for these stats ? I'm thinking about the scenario where we add more stats - it would make the code cleaner since that operator would be within the class.
cachelib/allocator/CacheAllocator-inl.h
line 2799 at r1 (raw file):
Just wondering is it possible to implement a + operator override for these stats ? I'm thinking about the scenario where we add more stats - it would make the code cleaner since that operator would be within the class.
Or maybe std::accumulate() ?
cachelib/allocator/CacheStats.h
line 454 at r1 (raw file):
// size of itemRemoved_ hash set in nvm uint64_t numNvmItemRemovedSetSize{0};
Minor: Instead of having vectors for all per-tier stats, I think it would be cleaner to encapsulate those as one class and a vector object for that class inside global cache stats.
Can we add some tests for per-tier stats?
I have added in my latest commit.
In general looks good. Can you paste here some example output with those stats?
This PR adds per tier statistics to the pool stats. We also introduce a new statistic called
writebacks
which counts the number of successfully moved items to the next tier.Cachebench now outputs per tier hit ratios and per tier item counts so we can get a better idea of how much data is being served from each tier.
I have verified that there is no impact to performance with this PR.
This change is