Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a93f01f
Run centos and debian workflows on push and PR
igchor Nov 2, 2021
2a8fa60
Adds createPutToken and switches findEviction
byrnedj Feb 4, 2023
c3a4db9
Add memory usage statistics for allocation classes
igchor Jul 6, 2022
2529f0a
Initial multi-tier support implementation (rebased with NUMA and cs p…
igchor Sep 28, 2021
3cc41bd
AC stats multi-tier
byrnedj Jan 17, 2023
bf4c244
This commit contains the additional memory tiers tests
byrnedj Feb 8, 2023
c432df6
This is the additional multi-tier support needed
guptask Nov 14, 2022
4cefc44
added per pool class rolling average latency (upstream PR version)
guptask Jul 21, 2022
1f62a63
added per tier pool class rolling average latency (based on upstream PR)
guptask Jul 21, 2022
489ef20
MM2Q promotion iterators (#1)
byrnedj Aug 9, 2022
048c809
CS Patch Part 2 for mulit-tier cachelib:
byrnedj Feb 7, 2023
ed7b70f
basic multi-tier test based on numa bindings
igchor Dec 30, 2021
94c4974
Aadding new configs to hit_ratio/graph_cache_leader_fobj
vinser52 Jan 27, 2022
afd1456
Do not block reader if a child item is moving
igchor Dec 19, 2022
4f8f425
Background data movement (#20)
byrnedj Oct 21, 2022
6203a95
fix race in moveRegularItemWith sync where insertOrReplace can cause …
byrnedj Feb 16, 2023
6abb498
Fix race in acquire (#68)
igchor Mar 16, 2023
add2e5f
Per tier pool stats (#70)
byrnedj Mar 23, 2023
aedaf97
dummy change to trigger container image rebuild
guptask Mar 28, 2023
1f21fce
Fix token creation and stats (#79)
igchor Apr 27, 2023
9e27d35
Updated the docker gcc version to 12 (#83)
guptask May 9, 2023
da7a6bb
NUMA bindigs support for private memory (#82)
vinser52 May 17, 2023
b5ac462
Do not run cachelib-centos-8-5 on PRs (#85)
igchor Jun 6, 2023
50d3ae5
correct handling for expired items in eviction (#86)
byrnedj Jun 6, 2023
5632d18
Add option to insert items to first free tier (#87)
igchor Jun 8, 2023
09d7bab
Chained item movement between tiers - sync on the parent item (#84)
byrnedj Jun 28, 2023
08d8f33
edit dockerfile
byrnedj Jul 24, 2023
316133c
these submodules work
byrnedj Jul 25, 2023
8d2c390
Track latency of per item eviction/promotion between memory tiers
guptask Jul 28, 2023
b99f2b3
Merge pull request #91 from guptask/tier_eviction_latency
guptask Jul 31, 2023
ff44c3c
Update dependencies (#95)
igchor Aug 23, 2023
307a412
Added Intel Data Movers Library to cachelib dependencies
guptask Nov 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add memory usage statistics for allocation classes
This includes printing:
- allocSize
- allocated memory size
- memory usage fraction
  • Loading branch information
igchor authored and byrnedj committed Jul 23, 2023
commit c3a4db97a631a1e36fd4548f97320c2c6c1d29b7
6 changes: 6 additions & 0 deletions cachelib/allocator/Cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ class CacheBase {
// @param poolId the pool id
virtual PoolStats getPoolStats(PoolId poolId) const = 0;

// Get Allocation Class specific stats.
//
// @param poolId the pool id
// @param classId the class id
virtual ACStats getACStats(PoolId poolId, ClassId classId) const = 0;

// @param poolId the pool id
virtual AllSlabReleaseEvents getAllSlabReleaseEvents(PoolId poolId) const = 0;

Expand Down
8 changes: 8 additions & 0 deletions cachelib/allocator/CacheAllocator-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,14 @@ PoolStats CacheAllocator<CacheTrait>::getPoolStats(PoolId poolId) const {
return ret;
}

template <typename CacheTrait>
ACStats CacheAllocator<CacheTrait>::getACStats(PoolId poolId,
ClassId classId) const {
const auto& pool = allocator_->getPool(poolId);
const auto& ac = pool.getAllocationClass(classId);
return ac.getStats();
}

template <typename CacheTrait>
PoolEvictionAgeStats CacheAllocator<CacheTrait>::getPoolEvictionAgeStats(
PoolId pid, unsigned int slabProjectionLength) const {
Expand Down
3 changes: 3 additions & 0 deletions cachelib/allocator/CacheAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,9 @@ class CacheAllocator : public CacheBase {
// return cache's memory usage stats
CacheMemoryStats getCacheMemoryStats() const override final;

// return stats for Allocation Class
ACStats getACStats(PoolId pid, ClassId cid) const override final;

// return the nvm cache stats map
util::StatsMap getNvmCacheStatsMap() const override final;

Expand Down
11 changes: 11 additions & 0 deletions cachelib/allocator/memory/MemoryAllocatorStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ struct ACStats {
constexpr size_t getTotalFreeMemory() const noexcept {
return Slab::kSize * freeSlabs + freeAllocs * allocSize;
}

constexpr double usageFraction() const noexcept {
if (usedSlabs == 0)
return 0.0;

return activeAllocs / (usedSlabs * allocsPerSlab);
}

constexpr size_t totalAllocatedSize() const noexcept {
return activeAllocs * allocSize;
}
};

// structure to query stats corresponding to a MemoryPool
Expand Down
1 change: 1 addition & 0 deletions cachelib/allocator/tests/CacheBaseTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class CacheBaseTest : public CacheBase, public SlabAllocatorTestBase {
bool isObjectCache() const override { return false; }
const MemoryPool& getPool(PoolId) const override { return memoryPool_; }
PoolStats getPoolStats(PoolId) const override { return PoolStats(); }
ACStats getACStats(PoolId, ClassId) const { return ACStats(); };
AllSlabReleaseEvents getAllSlabReleaseEvents(PoolId) const override {
return AllSlabReleaseEvents{};
}
Expand Down
4 changes: 4 additions & 0 deletions cachelib/cachebench/cache/Cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ class Cache {
// return the stats for the pool.
PoolStats getPoolStats(PoolId pid) const { return cache_->getPoolStats(pid); }

ACStats getACStats(PoolId pid, ClassId cid) const {
return cache_->getACStats(pid, cid);
}

// return the total number of inconsistent operations detected since start.
unsigned int getInconsistencyCount() const {
return inconsistencyCount_.load(std::memory_order_relaxed);
Expand Down
14 changes: 4 additions & 10 deletions cachelib/cachebench/cache/CacheStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ struct Stats {
foreachAC([&](auto pid, auto cid, auto stats) {
auto [allocSizeSuffix, allocSize] = formatMemory(stats.allocSize);
auto [memorySizeSuffix, memorySize] =
formatMemory(stats.activeAllocs * stats.allocSize);
formatMemory(stats.totalAllocatedSize());
out << folly::sformat("pid{:2} cid{:4} {:8.2f}{} memorySize: {:8.2f}{}",
pid, cid, allocSize, allocSizeSuffix, memorySize,
memorySizeSuffix)
Expand All @@ -177,15 +177,9 @@ struct Stats {

// If the pool is not full, extrapolate usageFraction for AC assuming it
// will grow at the same rate. This value will be the same for all ACs.
double acUsageFraction;
if (poolUsageFraction[pid] < 1.0) {
acUsageFraction = poolUsageFraction[pid];
} else if (stats.usedSlabs == 0) {
acUsageFraction = 0.0;
} else {
acUsageFraction =
stats.activeAllocs / (stats.usedSlabs * stats.allocsPerSlab);
}
auto acUsageFraction = (poolUsageFraction[pid] < 1.0)
? poolUsageFraction[pid]
: stats.usageFraction();

out << folly::sformat(
"pid{:2} cid{:4} {:8.2f}{} usageFraction: {:4.2f}", pid, cid,
Expand Down