Open
Description
Hello...
I modified the simple server example code to use the HybridCache. I set it up for being a Block cache. My test code inserts 5 large objects (256MB in size apiece), and then tries to retrieve them back. I have two questions:
- The cache pool is configured to 1G in size. While the inserts succeed, retrieval fails. After the 5 inserts, when I start reading the keys back, only the last one is in cache. What is the relationship between the cache pool size and the HybridCache?
- What triggers data migration from RAM to SSD? I don't see any writes being sent to the SSD.
Can you please help me?
Here is my updated initialization:
void initializeNVMCache(uint64_t cacheSize_gb, const std::string& navy_file_name) {
CacheConfig lruConfig;
NVMCacheConfig nvmConfig;
// assuming caching 20 million items
AccessConfig accessConfig({25 /* bucket power */, 10 /* lock power */});
nvmConfig.navyConfig.setBlockSize(4096);
//readerThreads, writerThreads, maxNumReads, maxNumWrites, stackSizeKB);
nvmConfig.navyConfig.setReaderAndWriterThreads(4, 4, 64, 32, 64);
nvmConfig.navyConfig.setMaxParcelMemoryMB(5 * 1024); // 5G
nvmConfig.navyConfig.setDeviceMaxWriteSize(1 << 20);
nvmConfig.navyConfig.setSimpleFile(navy_file_name,
cacheSize_gb * (1 << 30), /*fileSize*/
false /*truncateFile*/);
nvmConfig.navyConfig.blockCache().setRegionSize(32 << 20);
lruConfig.enableNvmCache(nvmConfig);
lruConfig.setAccessConfig(accessConfig);
lruConfig.configureChainedItems(accessConfig);
lruConfig.validate();
gCache_ = std::make_unique<Cache>(lruConfig);
XLOG(INFO) << "Using the following navy config"
<< folly::toPrettyJson(
folly::toDynamic(nvmConfig.navyConfig.serialize()));
std::cout << "RAM cache size: " << gCache_->getCacheMemoryStats().ramCacheSize << std::endl;
defaultPool_ =
gCache_->addPool("default", gCache_->getCacheMemoryStats().ramCacheSize);
}
The cache config:
Using the following navy config{
"navyConfig::QDepth": "16",
"navyConfig::admissionPolicy": "random",
"navyConfig::admissionProbBaseSize": "0",
"navyConfig::admissionProbFactorLowerBound": "0",
"navyConfig::admissionProbFactorUpperBound": "0",
"navyConfig::admissionProbability": "0.9",
"navyConfig::admissionSuffixLen": "0",
"navyConfig::admissionWriteRate": "0",
"navyConfig::bigHashBucketBfSize": "8",
"navyConfig::bigHashBucketSize": "4096",
"navyConfig::bigHashSizePct": "0",
"navyConfig::bigHashSmallItemMaxSize": "0",
"navyConfig::blockCacheCleanRegionThreads": "1",
"navyConfig::blockCacheCleanRegions": "1",
"navyConfig::blockCacheDataChecksum": "true",
"navyConfig::blockCacheLru": "true",
"navyConfig::blockCacheNumInMemBuffers": "2",
"navyConfig::blockCacheRegionSize": "33554432",
"navyConfig::blockCacheReinsertionHitsThreshold": "0",
"navyConfig::blockCacheReinsertionPctThreshold": "0",
"navyConfig::blockCacheSegmentedFifoSegmentRatio": "",
"navyConfig::blockSize": "4096",
"navyConfig::deviceMaxWriteSize": "1048576",
"navyConfig::deviceMetadataSize": "0",
"navyConfig::enableFDP": "0",
"navyConfig::fileName": "/nvme/Testing/cache-file",
"navyConfig::fileSize": "53687091200",
"navyConfig::ioEngine": "io_uring",
"navyConfig::maxConcurrentInserts": "1000000",
"navyConfig::maxNumReads": "64",
"navyConfig::maxNumWrites": "32",
"navyConfig::maxParcelMemoryMB": "5120",
"navyConfig::maxWriteRate": "0",
"navyConfig::navyReqOrderingShards": "20",
"navyConfig::raidPaths": "",
"navyConfig::readerThreads": "4",
"navyConfig::stackSize": "65536",
"navyConfig::truncateFile": "false",
"navyConfig::writerThreads": "4"
}
Metadata
Metadata
Assignees
Labels
No labels