Skip to content
Snippets Groups Projects
Commit a3d219e4 authored by 🥺's avatar 🥺 :transgender_flag:
Browse files

tweak rocksdb, use direct io


Signed-off-by: default avatargirlbossceo <june@girlboss.ceo>
parent c223f828
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ fn db_options(max_open_files: i32, rocksdb_cache: &rocksdb::Cache) -> rocksdb::O ...@@ -26,7 +26,7 @@ fn db_options(max_open_files: i32, rocksdb_cache: &rocksdb::Cache) -> rocksdb::O
// "Difference of spinning disk" // "Difference of spinning disk"
// https://zhangyuchi.gitbooks.io/rocksdbbook/content/RocksDB-Tuning-Guide.html // https://zhangyuchi.gitbooks.io/rocksdbbook/content/RocksDB-Tuning-Guide.html
block_based_options.set_block_size(4 * 1024); block_based_options.set_block_size(64 * 1024);
block_based_options.set_cache_index_and_filter_blocks(true); block_based_options.set_cache_index_and_filter_blocks(true);
let mut db_opts = rocksdb::Options::default(); let mut db_opts = rocksdb::Options::default();
...@@ -35,9 +35,12 @@ fn db_options(max_open_files: i32, rocksdb_cache: &rocksdb::Cache) -> rocksdb::O ...@@ -35,9 +35,12 @@ fn db_options(max_open_files: i32, rocksdb_cache: &rocksdb::Cache) -> rocksdb::O
db_opts.set_skip_stats_update_on_db_open(true); db_opts.set_skip_stats_update_on_db_open(true);
db_opts.set_level_compaction_dynamic_level_bytes(true); db_opts.set_level_compaction_dynamic_level_bytes(true);
db_opts.set_target_file_size_base(256 * 1024 * 1024); db_opts.set_target_file_size_base(256 * 1024 * 1024);
// defaults to 1MB
//db_opts.set_writable_file_max_buffer_size(1024 * 1024);
// defaults to 2MB now
//db_opts.set_compaction_readahead_size(2 * 1024 * 1024); //db_opts.set_compaction_readahead_size(2 * 1024 * 1024);
//db_opts.set_use_direct_reads(true); db_opts.set_use_direct_reads(true);
//db_opts.set_use_direct_io_for_flush_and_compaction(true); db_opts.set_use_direct_io_for_flush_and_compaction(true);
db_opts.create_if_missing(true); db_opts.create_if_missing(true);
db_opts.increase_parallelism(num_cpus::get() as i32); db_opts.increase_parallelism(num_cpus::get() as i32);
db_opts.set_max_open_files(max_open_files); db_opts.set_max_open_files(max_open_files);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment