Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the CacheLibWrapper class as a RocksDB Plugin #184

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

mrambacher
Copy link

Took the existing code and got it to compile, build, and pass the tests as a RocksDB Plugin. Wrote a README with instructions on how to use and enable it.

In addition to verifying that the class could be created via the customizable_test, I built and executed the unit test (requires changes to the build as outlined in the README). I also verified via db_bench (command "./db_bench --secondary_cache_uri="id=RocksCachelibWrapper;size=256M;cachename=db_bench;filename=/tmp/db_bench_cache") that the secondary cache could be created.

I am not sure how to validate that the SecondaryCache is doing the right thing, but the test works without failures. A db_bench with readrandom appears to be slower with the SecondaryCache than without:
./db_bench --compression_type=none --num=1000000 --benchmarks=fillseq,readrandom
fillseq : 32.053 micros/op 31198 ops/sec 32.053 seconds 1000000 operations; 3.5 MB/s
DB path: [/tmp/rocksdbtest-1000/dbbench]
readrandom : 51.583 micros/op 19386 ops/sec 51.583 seconds 1000000 operations; 2.1 MB/s (1000000 of 1000000 found)

./db_bench --secondary_cache_uri="id=RocksCachelibWrapper;size=256M;cachename=db_bench;filename=/tmp/db_bench_cache" --compression_type=none --num=1000000 --benchmarks=fillseq,readrandom
fillseq : 32.136 micros/op 31118 ops/sec 32.136 seconds 1000000 operations; 3.4 MB/s
DB path: [/tmp/rocksdbtest-1000/dbbench]
readrandom : 67.078 micros/op 14907 ops/sec 67.078 seconds 1000000 operations; 1.6 MB/s (1000000 of 1000000 found)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 23, 2022
@jaesoo-fb jaesoo-fb requested a review from anand1976 December 27, 2022 18:01
Copy link
Contributor

@anand1976 anand1976 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!!

delete cache;
}
}

bool RocksCachelibWrapper::UpdateMaxWriteRateForDynamicRandom(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this not be supported anymore? Internally, we need this API.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anand1976 This is a feature that is internal to Facebook/Meta. The header file that is required for this is not part of the public API.

defaultPool =
cache->addPool("default", cache->getCacheMemoryStats().cacheSize);

if (opts.fb303Stats) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is CacheAdmin for stats not supported?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anand1976 This is another piece that is internal to Facebook/Meta and is not in the public API.

```
This will allow RocksDB to find and build the CacheLib plugin code.

Next, under the RocksDB build directory, instruct RocksDB to build and include the cachelib plugin:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, how is the folly dependency handled? Should the user do this first - https://github.com/facebook/rocksdb/wiki/RocksDB-Contribution-Guide#build-rocksdb-with-folly-integration-enabled?

@zhangyy91
Copy link

Is this the official open-source secondary cache implementation mentioned in the paper Disaggregating RocksDB: A Production Experience?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants