Skip to content
Merged
Changes from all 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
11 changes: 11 additions & 0 deletions crates/storage/provider/src/providers/rocksdb/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ const DEFAULT_BLOCK_SIZE: usize = 16 * 1024;
/// Default max background jobs for `RocksDB` compaction and flushing.
const DEFAULT_MAX_BACKGROUND_JOBS: i32 = 6;

/// Default max open file descriptors for `RocksDB`.
///
/// Caps the number of SST file handles `RocksDB` keeps open simultaneously.
/// Set to 512 to stay within the common default OS `ulimit -n` of 1024,
/// leaving headroom for MDBX, static files, and other I/O.
/// `RocksDB` uses an internal table cache and re-opens files on demand,
/// so this has negligible performance impact on read-heavy workloads.
const DEFAULT_MAX_OPEN_FILES: i32 = 512;

/// Default bytes per sync for `RocksDB` WAL writes (1 MB).
const DEFAULT_BYTES_PER_SYNC: u64 = 1_048_576;

Expand Down Expand Up @@ -203,6 +212,8 @@ impl RocksDBBuilder {

options.set_log_level(log_level);

options.set_max_open_files(DEFAULT_MAX_OPEN_FILES);

// Delete obsolete WAL files immediately after all column families have flushed.
// Both set to 0 means "delete ASAP, no archival".
options.set_wal_ttl_seconds(0);
Expand Down
Loading