0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-01 13:18:58 +02:00

ircd::db: Configuration package.

This commit is contained in:
Jason Volk 2019-01-11 17:37:51 -08:00
parent cbc4ddefe4
commit 655d4e41c6

View file

@ -1069,15 +1069,20 @@ try
opts->max_total_wal_size = 16_MiB; //TODO: conf
opts->db_write_buffer_size = 16_MiB; //TODO: conf
opts->max_log_file_size = 1_MiB; //TODO: conf
//TODO: range_sync
opts->bytes_per_sync = 0;
opts->wal_bytes_per_sync = 0;
// For the write-side of a compaction process: writes will be of approx
// this size. The compaction process is composing a buffer of this size
// between those writes. Too large a buffer will hog the CPU and starve
// other ircd::ctx's. Too small a buffer will be inefficient.
opts->writable_file_max_buffer_size = 2_MiB; //TODO: conf
opts->writable_file_max_buffer_size = 4_MiB; //TODO: conf
// For the read-side of the compaction process.
opts->compaction_readahead_size = 4_MiB; //TODO: conf
opts->compaction_readahead_size = 128_KiB; //TODO: conf
// MUST be 1 (no subcompactions) or rocksdb spawns internal std::thread.
opts->max_subcompactions = 1;
@ -1088,6 +1093,7 @@ try
// Disables the timer to delete unused files; this operation occurs
// instead with our compaction operations so we don't need to complicate.
opts->delete_obsolete_files_period_micros = 0;
opts->keep_log_file_num = 16;
// These values prevent codepaths from being taken in rocksdb which may
// introduce issues for ircd::ctx. We should still fully investigate
@ -1139,10 +1145,10 @@ try
if(string_view(open_recover) == "tolerate")
opts->wal_recovery_mode = rocksdb::WALRecoveryMode::kTolerateCorruptedTailRecords;
// This prevents the creation of additional files when the DB first opens.
// It should be set to false once a comprehensive compaction system is
// implemented which can reap those files. Otherwise we'll run out of fd's.
// This prevents the creation of additional SST files and lots of I/O on
// either DB open and close.
opts->avoid_flush_during_recovery = true;
opts->avoid_flush_during_shutdown = true;
// Setup env
opts->env = env.get();
@ -1748,13 +1754,13 @@ ircd::db::database::column::column(database &d,
this->options.num_levels = 7;
this->options.write_buffer_size = 512_KiB;
this->options.max_write_buffer_number = 2;
this->options.min_write_buffer_number_to_merge = 1;
this->options.max_write_buffer_number = 8;
this->options.min_write_buffer_number_to_merge = 4;
this->options.max_write_buffer_number_to_maintain = 0;
this->options.level0_file_num_compaction_trigger = 3;
this->options.target_file_size_base = 30_MiB;
this->options.target_file_size_multiplier = 2;
this->options.max_bytes_for_level_base = 64_MiB;
this->options.level0_file_num_compaction_trigger = 2;
this->options.target_file_size_base = 32_MiB;
this->options.target_file_size_multiplier = 4;
this->options.max_bytes_for_level_base = 1_MiB;
this->options.max_bytes_for_level_multiplier = 2;
//
@ -1764,9 +1770,9 @@ ircd::db::database::column::column(database &d,
// Block based table index type.
table_opts.format_version = 3; // RocksDB >= 5.15 compat only; otherwise use 2.
table_opts.index_type = rocksdb::BlockBasedTableOptions::kTwoLevelIndexSearch;
table_opts.read_amp_bytes_per_bit = 8;
table_opts.partition_filters = true;
table_opts.use_delta_encoding = true;
table_opts.read_amp_bytes_per_bit = 8;
// Specify that index blocks should use the cache. If not, they will be
// pre-read into RAM by rocksdb internally. Because of the above
@ -1777,11 +1783,13 @@ ircd::db::database::column::column(database &d,
table_opts.pin_top_level_index_and_filter = false;
table_opts.pin_l0_filter_and_index_blocks_in_cache = false;
table_opts.enable_index_compression = false;
table_opts.index_block_restart_interval = 8;
// Setup the block size
table_opts.block_size = this->descriptor->block_size;
table_opts.metadata_block_size = this->descriptor->meta_block_size;
table_opts.block_size_deviation = 50;
table_opts.block_restart_interval = 16;
//table_opts.data_block_index_type = rocksdb::BlockBasedTableOptions::kDataBlockBinaryAndHash;
//table_opts.data_block_hash_table_util_ratio = 0.75;
@ -2873,7 +2881,7 @@ noexcept
decltype(ircd::db::database::cache::DEFAULT_SHARD_BITS)
ircd::db::database::cache::DEFAULT_SHARD_BITS
(
std::min(std::log2(size_t(db::request_pool_size)), 8.0)
std::min(std::log2(size_t(db::request_pool_size)), 16.0)
);
decltype(ircd::db::database::cache::DEFAULT_STRICT)
@ -9762,7 +9770,7 @@ ircd::db::compact(column &column,
};
rocksdb::CompactionOptions opts;
opts.output_file_size_limit = 2_GiB; //TODO: conf
opts.output_file_size_limit = 1_GiB; //TODO: conf
// RocksDB sez that setting this to Disable means that the column's
// compression options are read instead. If we don't set this here,