Skip to content

Commit e2956d3

Browse files
committed
Multi-tier allocator patch
Part 2. ---------------------------- This patch introduces tryEvictToNextMemoryTier and some additional multi-tier tests. We can consider merging tryEvictToNextMemoryTier with the initial implementation and seperating the tests into a seperate patch. Per tier pool stats (multi-tier patch part 3.) -------------------- This introduces per tier stats this can go with multi-tier patch part 2. Fix token creation and stats (#79) (multi-tier patch 4.) --------------------------------- This patch can go after we implement tryEvictToNextMemoryTier (or multi-tier part 2) and should be combined as such. * Fix issue with token creation * Do not increment evictFail* stats if evictFailConcurrentFill were incremented correct handling for expired items in eviction (#86) (multi-tier patch 5.) ----------------------------------------------------- This can be merged with patches that fix token creation and probably squashed into multi-tier patch 2. - we first check if an item is expired under mmContainer lock and if so mark it for eviction so it is recycled back up to allocateInternalTier.
1 parent aa02c05 commit e2956d3

File tree

13 files changed

+800
-151
lines changed

13 files changed

+800
-151
lines changed

cachelib/allocator/Cache.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ void CacheBase::updateGlobalCacheStats(const std::string& statPrefix) const {
244244
statPrefix + "cache.size.configured",
245245
memStats.configuredRamCacheSize + memStats.nvmCacheSize);
246246

247+
//TODO: add specific per-tier counters
247248
const auto stats = getGlobalCacheStats();
248249

249250
// Eviction Stats
@@ -253,7 +254,8 @@ void CacheBase::updateGlobalCacheStats(const std::string& statPrefix) const {
253254
// from both ram and nvm, this is counted as a single eviction from cache.
254255
// Ram Evictions: item evicted from ram but it can be inserted into nvm
255256
const std::string ramEvictionKey = statPrefix + "ram.evictions";
256-
counters_.updateDelta(ramEvictionKey, stats.numEvictions);
257+
counters_.updateDelta(ramEvictionKey,
258+
std::accumulate(stats.numEvictions.begin(), stats.numEvictions.end(), 0));
257259
// Nvm Evictions: item evicted from nvm but it can be still in ram
258260
const std::string nvmEvictionKey = statPrefix + "nvm.evictions";
259261
counters_.updateDelta(nvmEvictionKey, stats.numNvmEvictions);
@@ -295,11 +297,11 @@ void CacheBase::updateGlobalCacheStats(const std::string& statPrefix) const {
295297
}
296298

297299
counters_.updateDelta(statPrefix + "cache.alloc_attempts",
298-
stats.allocAttempts);
300+
std::accumulate(stats.allocAttempts.begin(), stats.allocAttempts.end(),0));
299301
counters_.updateDelta(statPrefix + "cache.eviction_attempts",
300-
stats.evictionAttempts);
302+
std::accumulate(stats.evictionAttempts.begin(),stats.evictionAttempts.end(),0));
301303
counters_.updateDelta(statPrefix + "cache.alloc_failures",
302-
stats.allocFailures);
304+
std::accumulate(stats.allocFailures.begin(),stats.allocFailures.end(),0));
303305
counters_.updateDelta(statPrefix + "cache.invalid_allocs",
304306
stats.invalidAllocs);
305307

0 commit comments

Comments
 (0)