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 rocksdb read option avoid_unnecessary_blocking_io to avoid unexpected long latency #1903

Merged
merged 4 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions kvrocks.conf
Original file line number Diff line number Diff line change
Expand Up @@ -863,5 +863,11 @@ rocksdb.write_options.memtable_insert_hint_per_batch no
# Default: yes
rocksdb.rate_limiter_auto_tuned yes

# Support rocksdb `void_unnecessary_blocking_io` in iteration scenario
# if user don't care iteration slowing by pruge blocking io, mark it no
# see https://github.com/facebook/rocksdb/wiki/IO#avoid-blocking-io
# Default: yes
# rocksdb.avoid_unnecessary_blocking_io yes
wanghenshui marked this conversation as resolved.
Show resolved Hide resolved

################################ NAMESPACE #####################################
# namespace.test change.me
1 change: 1 addition & 0 deletions src/config/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ Config::Config() {
new YesNoField(&rocks_db.level_compaction_dynamic_level_bytes, false)},
{"rocksdb.max_background_jobs", false, new IntField(&rocks_db.max_background_jobs, 4, 0, 32)},
{"rocksdb.rate_limiter_auto_tuned", true, new YesNoField(&rocks_db.rate_limiter_auto_tuned, true)},
{"rocksdb.avoid_unnecessary_blocking_io", true, new YesNoField(&rocks_db.avoid_unnecessary_blocking_io, true)},

/* rocksdb write options */
{"rocksdb.write_options.sync", true, new YesNoField(&rocks_db.write_options.sync, false)},
Expand Down
1 change: 1 addition & 0 deletions src/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ struct Config {
bool level_compaction_dynamic_level_bytes;
int max_background_jobs;
bool rate_limiter_auto_tuned;
bool avoid_unnecessary_blocking_io = true;

struct WriteOptions {
bool sync;
Expand Down
3 changes: 3 additions & 0 deletions src/storage/storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ rocksdb::Options Storage::InitRocksDBOptions() {
options.level_compaction_dynamic_level_bytes = config_->rocks_db.level_compaction_dynamic_level_bytes;
options.max_background_jobs = config_->rocks_db.max_background_jobs;

// avoid blocking io on iteration
// see https://github.com/facebook/rocksdb/wiki/IO#avoid-blocking-io
options.avoid_unnecessary_blocking_io = config_->rocks_db.avoid_unnecessary_blocking_io;
return options;
}

Expand Down