Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c0c90d2
Run centos and debian workflows on push and PR
igchor Nov 2, 2021
dbe3fda
Adds createPutToken and switches findEviction
byrnedj Feb 4, 2023
9afcd64
Add memory usage statistics for allocation classes
igchor Jul 6, 2022
eca7d8c
Initial multi-tier support implementation
igchor Sep 28, 2021
664da8d
AC stats multi-tier
byrnedj Jan 17, 2023
3b7bb0c
Tests and fix tier sizing
byrnedj Feb 8, 2023
58e825b
This is the additional multi-tier support needed
guptask Nov 14, 2022
9fc705f
Rolling average alloc latency
guptask Jul 21, 2022
ce0e38a
Rolling average class latency
guptask Jul 21, 2022
e0a8006
MM2Q promotion iterator
byrnedj Aug 9, 2022
bcb2ae2
Multi-tier allocator patch
byrnedj Feb 7, 2023
d4cf1d4
basic multi-tier test based on numa bindings
igchor Dec 30, 2021
6d2fbef
Aadding new configs to hit_ratio/graph_cache_leader_fobj
vinser52 Jan 27, 2022
5bfa1ff
Background data movement for the tiers
byrnedj Oct 21, 2022
1593291
dummy change to trigger container image rebuild
guptask Mar 28, 2023
a171f38
Updated the docker gcc version to 12 (#83)
guptask May 9, 2023
35a17e4
NUMA bindigs support for private memory (#82)
vinser52 May 17, 2023
46d168c
Do not run cachelib-centos-8-5 on PRs (#85)
igchor Jun 6, 2023
7d06531
Add option to insert items to first free tier (#87)
igchor Jun 8, 2023
1521efe
Chained item movement between tiers - sync on the parent item (#84)
byrnedj Jun 28, 2023
3328e4e
edit dockerfile
byrnedj Jul 24, 2023
3c87c49
Track latency of per item eviction/promotion between memory tiers
guptask Jul 28, 2023
795f85b
Update dependencies (#95)
igchor Aug 23, 2023
96d948f
enable DTO build without memcpy changes to cachebench
byrnedj Feb 28, 2024
47d5034
Bckground eviction for multi-tier
byrnedj Feb 28, 2024
efea480
no online eviction option patch
byrnedj Feb 28, 2024
ebfca17
fixes cmake in latest test removal (upstream test build fails - need …
byrnedj May 20, 2024
52618b5
fixes commit for now (should drop once https://github.com/facebook/Ca…
byrnedj May 28, 2024
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
Rolling average class latency
Part 2. (multi-tier support)
--------------------------------------
There is also an introduction to kMaxTiers in Cache.h
- this should probably be split from this commit.

added per tier pool class rolling average latency (based on upstream PR)
  • Loading branch information
guptask authored and byrnedj committed May 20, 2024
commit ce0e38aa22d31ceac765a510ba1a04f28591bec7
3 changes: 3 additions & 0 deletions cachelib/allocator/Cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ class CacheBase {
CacheBase(CacheBase&&) = default;
CacheBase& operator=(CacheBase&&) = default;

// TODO: come up with some reasonable number
static constexpr unsigned kMaxTiers = 2;

// Get a string referring to the cache name for this cache
virtual const std::string getCacheName() const = 0;

Expand Down
6 changes: 3 additions & 3 deletions cachelib/allocator/CacheAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -2783,7 +2783,7 @@ CacheAllocator<CacheTrait>::allocateInternalTier(TierId tid,
// the allocation class in our memory allocator.
const auto cid = allocator_[tid]->getAllocationClassId(pid, requiredSize);
util::RollingLatencyTracker rollTracker{
(*stats_.classAllocLatency)[pid][cid]};
(*stats_.classAllocLatency)[tid][pid][cid]};

// TODO: per-tier
(*stats_.allocAttempts)[pid][cid].inc();
Expand Down Expand Up @@ -2895,7 +2895,7 @@ CacheAllocator<CacheTrait>::allocateChainedItemInternal(const Item& parent,
// TODO: per-tier? Right now stats_ are not used in any public periodic
// worker
util::RollingLatencyTracker rollTracker{
(*stats_.classAllocLatency)[pid][cid]};
(*stats_.classAllocLatency)[tid][pid][cid]};

(*stats_.allocAttempts)[pid][cid].inc();

Expand Down Expand Up @@ -4918,7 +4918,7 @@ ACStats CacheAllocator<CacheTrait>::getACStats(TierId tid,
const auto& pool = allocator_[tid]->getPool(poolId);
const auto& ac = pool.getAllocationClass(classId);
auto stats = ac.getStats();
stats.allocLatencyNs = (*stats_.classAllocLatency)[poolId][classId];
stats.allocLatencyNs = (*stats_.classAllocLatency)[tid][poolId][classId];
return stats;
}

Expand Down
2 changes: 1 addition & 1 deletion cachelib/allocator/CacheStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void Stats::init() {
initToZero(*chainedItemEvictions);
initToZero(*regularItemEvictions);

classAllocLatency = std::make_unique<PerPoolClassRollingStats>();
classAllocLatency = std::make_unique<PerTierPoolClassRollingStats>();
}

template <int>
Expand Down
1 change: 1 addition & 0 deletions cachelib/allocator/CacheStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "cachelib/allocator/memory/Slab.h"
#include "cachelib/common/FastStats.h"
#include "cachelib/common/PercentileStats.h"
#include "cachelib/common/RollingStats.h"
#include "cachelib/common/Time.h"

namespace facebook {
Expand Down
7 changes: 4 additions & 3 deletions cachelib/allocator/CacheStatsInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,13 @@ struct Stats {
std::unique_ptr<PerPoolClassAtomicCounters> chainedItemEvictions{};
std::unique_ptr<PerPoolClassAtomicCounters> regularItemEvictions{};

using PerPoolClassRollingStats =
using PerTierPoolClassRollingStats = std::array<
std::array<std::array<util::RollingStats, MemoryAllocator::kMaxClasses>,
MemoryPoolManager::kMaxPools>;
MemoryPoolManager::kMaxPools>,
CacheBase::kMaxTiers>;

// rolling latency tracking for every alloc class in every pool
std::unique_ptr<PerPoolClassRollingStats> classAllocLatency{};
std::unique_ptr<PerTierPoolClassRollingStats> classAllocLatency{};

// Eviction failures due to parent cannot be removed from access container
AtomicCounter evictFailParentAC{0};
Expand Down
11 changes: 3 additions & 8 deletions cachelib/cachebench/cache/CacheStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,11 @@ struct Stats {
}
};


foreachAC([&](auto tid, auto pid, auto cid, auto stats) {
auto [allocSizeSuffix, allocSize] = formatMemory(stats.allocSize);
auto [memorySizeSuffix, memorySize] =
formatMemory(stats.totalAllocatedSize());
out << folly::sformat("tid{:2} pid{:2} cid{:4} {:8.2f}{} memorySize: {:8.2f}{}",
tid, pid, cid, allocSize, allocSizeSuffix, memorySize,
memorySizeSuffix)
<< std::endl;
});

foreachAC([&](auto tid, auto pid, auto cid, auto stats) {
auto [allocSizeSuffix, allocSize] = formatMemory(stats.allocSize);

// 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.
Expand All @@ -224,8 +217,10 @@ struct Stats {

out << folly::sformat(
"tid{:2} pid{:2} cid{:4} {:8.2f}{} usageFraction: {:4.2f} "
"memorySize: {:8.2f}{} "
"rollingAvgAllocLatency: {:8.2f}ns",
tid, pid, cid, allocSize, allocSizeSuffix, acUsageFraction,
memorySize, memorySizeSuffix,
stats.allocLatencyNs.estimate())
<< std::endl;
});
Expand Down