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

Expose rocksdb feature of disabling OS page cache #3890

Merged
merged 4 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
3 changes: 3 additions & 0 deletions conf/nebula-storaged.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
# The default block cache size used in BlockBasedTable. (MB)
# recommend: 1/3 of all memory
--rocksdb_block_cache=4096
# Disable page cache to better control memory used by rocksdb.
# Caution: Make sure to allocate enough block cache if disabling page cache!
--disable_page_cache=false

# Compression algorithm, options: no,snappy,lz4,lz4hc,zlib,bzip2,zstd
# For the sake of binary compatibility, the default value is snappy.
Expand Down
8 changes: 8 additions & 0 deletions src/kvstore/RocksEngineConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ DEFINE_int64(rocksdb_block_cache,
1024,
"The default block cache size used in BlockBasedTable. The unit is MB");

DEFINE_bool(disable_page_cache,
false,
"Disable page cache to better control memory used by rocksdb.");

DEFINE_int32(rocksdb_row_cache_num, 16 * 1000 * 1000, "Total keys inside the cache");

DEFINE_int32(cache_bucket_exp, 8, "Total buckets number is 1 << cache_bucket_exp");
Expand Down Expand Up @@ -273,6 +277,10 @@ rocksdb::Status initRocksdbOptions(rocksdb::Options& baseOpts,
return s;
}

if (FLAGS_disable_page_cache) {
baseOpts.use_direct_reads = true;
}

if (FLAGS_num_compaction_threads > 0) {
static std::shared_ptr<rocksdb::ConcurrentTaskLimiter> compaction_thread_limiter{
rocksdb::NewConcurrentTaskLimiter("compaction", FLAGS_num_compaction_threads)};
Expand Down