Skip to content

Commit

Permalink
Expose rocksdb feature of disabling OS page cache (vesoft-inc#3890)
Browse files Browse the repository at this point in the history
* add support for direct io

* set for read only

Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com>
  • Loading branch information
wenhaocs and Sophie-Xie authored Feb 21, 2022
1 parent fdcaa0a commit c31b6bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions conf/nebula-storaged.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,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

0 comments on commit c31b6bf

Please sign in to comment.