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
Chained item movement between tiers - sync on the parent item (#84)
* Chained item movement between tiers - currently sync on the parent
item for moving.
 - updated tests accordingly, note that we can no longer swap
   parent item if chained item is being moved for slab release.

* added some debug checks around chained item check
* fix slab release behavior if no movecb
  • Loading branch information
byrnedj committed May 20, 2024
commit 1521efe3ae3b9b238a8d343e73be5d5858990428
230 changes: 176 additions & 54 deletions cachelib/allocator/CacheAllocator.h

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions cachelib/allocator/tests/BaseAllocatorTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -4916,7 +4916,7 @@ class BaseAllocatorTest : public AllocatorTest<AllocatorT> {

std::memcpy(newItem.getMemory(), oldItem.getMemory(), oldItem.getSize());
++numMoves;
});
}, {}, 1000000 /* lots of moving tries */);

AllocatorT alloc(config);
const size_t numBytes = alloc.getCacheMemoryStats().ramCacheSize;
Expand Down Expand Up @@ -4957,15 +4957,15 @@ class BaseAllocatorTest : public AllocatorTest<AllocatorT> {
}

/* sleep override */
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
};

// Release 5 slabs
auto releaseFn = [&] {
for (unsigned int i = 0; i < 5;) {
/* sleep override */
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(std::chrono::milliseconds(1000));

ClassId cid = static_cast<ClassId>(i);
alloc.releaseSlab(pid, cid, SlabReleaseMode::kRebalance);
Expand Down Expand Up @@ -5125,7 +5125,7 @@ class BaseAllocatorTest : public AllocatorTest<AllocatorT> {
auto releaseFn = [&] {
for (unsigned int i = 0; i < 5;) {
/* sleep override */
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(std::chrono::milliseconds(1000));

ClassId cid = static_cast<ClassId>(i);
alloc.releaseSlab(pid, cid, SlabReleaseMode::kRebalance);
Expand Down Expand Up @@ -5968,7 +5968,6 @@ class BaseAllocatorTest : public AllocatorTest<AllocatorT> {
EXPECT_EQ(nullptr,
util::allocateAccessible(alloc, poolId, "large", largeSize));

std::this_thread::sleep_for(std::chrono::seconds{1});
// trigger the slab rebalance
EXPECT_EQ(nullptr,
util::allocateAccessible(alloc, poolId, "large", largeSize));
Expand Down
3 changes: 3 additions & 0 deletions cachelib/allocator/tests/RebalanceStrategyTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ class RebalanceStrategyTest : public testing::Test {
config.poolRebalancerFreeAllocThreshold = 20;

initAllocatorConfigForStrategy(config, LruTailAge);
//TODO: why does this fail with orig. value of 8?
//on upstream this fails too, it always reports 4 instead
//of the original test value, which is 8 expected slabs
doWork(config, true, 8);
}

Expand Down
10 changes: 0 additions & 10 deletions cachelib/allocator/tests/RefCountTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,6 @@ void RefCountTest::testMarkForEvictionAndMoving() {
ASSERT_EQ(ret, 0);
}

{
// cannot mark moving when ref count > 0
RefcountWithFlags ref;
ref.markInMMContainer();

ref.incRef();

ASSERT_FALSE(ref.markMoving());
}

{
// cannot mark for eviction when ref count > 0
RefcountWithFlags ref;
Expand Down
2 changes: 1 addition & 1 deletion cachelib/allocator/tests/SimpleRebalancingTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class SimpleRebalanceTest : public testing::Test {

// Sleep for 2 seconds to let the rebalancing work
/* sleep override */
std::this_thread::sleep_for(std::chrono::seconds(3));
std::this_thread::sleep_for(std::chrono::seconds(10));

// Evicted keys shouldn't be in the allocator anymore
ASSERT_FALSE(evictedKeys.empty());
Expand Down
6 changes: 5 additions & 1 deletion cachelib/cachebench/runner/CacheStressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CacheStressor : public Stressor {
std::unique_lock<folly::SharedMutex> lock;

CacheStressSyncObj(CacheStressor& s, std::string itemKey)
: lock{s.chainedItemAcquireUniqueLock(itemKey)} {}
: lock{s.chainedItemTryAcquireUniqueLock(itemKey)} {}
};
movingSync = [this](typename CacheT::Item::Key key) {
return std::make_unique<CacheStressSyncObj>(*this, key.str());
Expand Down Expand Up @@ -247,6 +247,10 @@ class CacheStressor : public Stressor {
using Lock = std::unique_lock<folly::SharedMutex>;
return lockEnabled_ ? Lock{getLock(key)} : Lock{};
}
auto chainedItemTryAcquireUniqueLock(Key key) {
using Lock = std::unique_lock<folly::SharedMutex>;
return lockEnabled_ ? Lock{getLock(key), std::try_to_lock} : Lock{};
}

// populate the input item handle according to the stress setup.
void populateItem(WriteHandle& handle, const std::string& itemValue = "") {
Expand Down
35 changes: 35 additions & 0 deletions cachelib/cachebench/test_configs/small_moving_bg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// @nolint like default.json, but moves items during slab release instead of evicting them.
{
"cache_config" : {
"cacheSizeMB" : 2248,
"cacheDir": "/tmp/mem-tier5",
"memoryTiers" : [
{
"ratio": 1,
"memBindNodes": 0
}, {
"ratio": 1,
"memBindNodes": 0
}
],
"poolRebalanceIntervalSec" : 1,
"moveOnSlabRelease" : true,
"rebalanceMinSlabs" : 2,
"evictorThreads": 2,
"promoterThreads": 2
},
"test_config" :
{
"preallocateCache" : true,
"numOps" : 20000000,
"numThreads" : 32,
"numKeys" : 250000,
"generator": "online",
"keySizeRange" : [1, 8, 32, 64, 128, 256, 512],
"keySizeRangeProbability" : [0.1, 0.1, 0.2, 0.2, 0.3, 0.1],
"valSizeRange" : [1, 128, 512, 1024, 4096, 10240, 20480, 40960, 60000],
"valSizeRangeProbability" : [0.1, 0.1, 0.1, 0.2, 0.2, 0.1, 0.1, 0.1],
"getRatio" : 0.70,
"setRatio" : 0.30
}
}
1 change: 1 addition & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ fi

../bin/cachebench --json_test_config ../test_configs/consistency/navy.json
../bin/cachebench --json_test_config ../test_configs/consistency/navy-multi-tier.json
../bin/cachebench --json_test_config ../test_configs/small_moving_bg.json