mirror of https://gitee.com/bigwinds/arangodb
add RocksDB options `--rocksdb.allow-fallocate` and `--rocksdb.limit-open-files-at-startup` (#8492)
This commit is contained in:
parent
db7fcdce7a
commit
dbfa483374
13
CHANGELOG
13
CHANGELOG
|
@ -1,6 +1,19 @@
|
|||
v3.4.5 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* added startup option `--rocksdb.allow-fallocate`
|
||||
|
||||
When set to true, allows RocksDB to use the fallocate call. If false, fallocate
|
||||
calls are bypassed and no preallocation is done. Preallocation is turned on by
|
||||
default, but can be turned off for operating system versions that are known to
|
||||
have issues with it.
|
||||
This option only has an effect on operating systems that support fallocate.
|
||||
|
||||
* added startup option `--rocksdb.limit-open-files-at-startup`
|
||||
|
||||
If set to true, this will limit the amount of .sst files RocksDB will inspect at
|
||||
startup, which can reduce the number of IO operations performed at start.
|
||||
|
||||
* don't run compact() on a collection after a truncate() was done in the same transaction
|
||||
|
||||
running compact() in the same transaction will only increase the data size on disk due to
|
||||
|
|
|
@ -131,6 +131,18 @@ Only meaningful on Linux. If set, use `O_DIRECT` for writing files. Default: fal
|
|||
|
||||
If set, issue an `fsync` call when writing to disk (set to false to issue
|
||||
`fdatasync` only. Default: false.
|
||||
|
||||
`--rocksdb.allow-fallocate`
|
||||
|
||||
Allow RocksDB to use the fallocate call. If false, fallocate calls are bypassed
|
||||
and no preallocation is done. Preallocation is turned on by default, but can be
|
||||
turned off for operating system versions that are known to have issues with it.
|
||||
This option only has an effect on operating systems that support fallocate.
|
||||
|
||||
`--rocksdb.limit-open-files-at-startup`
|
||||
|
||||
If set to true, this will limit the amount of .sst files RocksDB will inspect at
|
||||
startup, which can reduce the number of IO operations performed at start.
|
||||
|
||||
`--rocksdb.block-align-data-blocks`
|
||||
|
||||
|
|
|
@ -395,6 +395,7 @@ void RocksDBEngine::start() {
|
|||
transactionOptions.num_stripes = TRI_numberProcessors();
|
||||
transactionOptions.transaction_lock_timeout = opts->_transactionLockTimeout;
|
||||
|
||||
_options.allow_fallocate = opts->_allowFAllocate;
|
||||
_options.enable_pipelined_write = opts->_enablePipelinedWrite;
|
||||
_options.write_buffer_size = static_cast<size_t>(opts->_writeBufferSize);
|
||||
_options.max_write_buffer_number = static_cast<int>(opts->_maxWriteBufferNumber);
|
||||
|
@ -520,7 +521,14 @@ void RocksDBEngine::start() {
|
|||
|
||||
_options.create_if_missing = true;
|
||||
_options.create_missing_column_families = true;
|
||||
_options.max_open_files = -1;
|
||||
|
||||
if (opts->_limitOpenFilesAtStartup) {
|
||||
_options.max_open_files = 16;
|
||||
_options.skip_stats_update_on_db_open = true;
|
||||
_options.avoid_flush_during_recovery = true;
|
||||
} else {
|
||||
_options.max_open_files = -1;
|
||||
}
|
||||
|
||||
// WAL_ttl_seconds needs to be bigger than the sync interval of the count
|
||||
// manager. Should be several times bigger counter_sync_seconds
|
||||
|
@ -700,6 +708,10 @@ void RocksDBEngine::start() {
|
|||
if (logger != nullptr) {
|
||||
logger->enable();
|
||||
}
|
||||
|
||||
if (opts->_limitOpenFilesAtStartup) {
|
||||
_db->SetDBOptions({{"max_open_files", "-1"}});
|
||||
}
|
||||
|
||||
if (_syncInterval > 0) {
|
||||
_syncThread.reset(new RocksDBSyncThread(this, std::chrono::milliseconds(_syncInterval)));
|
||||
|
|
|
@ -81,7 +81,9 @@ RocksDBOptionFeature::RocksDBOptionFeature(application_features::ApplicationServ
|
|||
_skipCorrupted(false),
|
||||
_dynamicLevelBytes(true),
|
||||
_enableStatistics(false),
|
||||
_useFileLogging(false) {
|
||||
_useFileLogging(false),
|
||||
_limitOpenFilesAtStartup(false),
|
||||
_allowFAllocate(true) {
|
||||
// setting the number of background jobs to
|
||||
_maxBackgroundJobs = static_cast<int32_t>(
|
||||
std::max((size_t)2, std::min(TRI_numberProcessors(), (size_t)8)));
|
||||
|
@ -306,6 +308,18 @@ void RocksDBOptionFeature::collectOptions(std::shared_ptr<ProgramOptions> option
|
|||
"skip corrupted records in WAL recovery",
|
||||
new BooleanParameter(&_skipCorrupted),
|
||||
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
|
||||
|
||||
options->addOption("--rocksdb.limit-open-files-at-startup",
|
||||
"limit the amount of .sst files RocksDB will inspect at startup, in order to startup reduce IO",
|
||||
new BooleanParameter(&_limitOpenFilesAtStartup),
|
||||
arangodb::options::makeFlags(arangodb::options::Flags::Hidden))
|
||||
.setIntroducedIn(30405).setIntroducedIn(30500);
|
||||
|
||||
options->addOption("--rocksdb.allow-fallocate",
|
||||
"if true, allow RocksDB to use fallocate calls. if false, fallocate calls are bypassed",
|
||||
new BooleanParameter(&_allowFAllocate),
|
||||
arangodb::options::makeFlags(arangodb::options::Flags::Hidden))
|
||||
.setIntroducedIn(30405).setIntroducedIn(30500);
|
||||
}
|
||||
|
||||
void RocksDBOptionFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
|
||||
|
@ -392,9 +406,11 @@ void RocksDBOptionFeature::start() {
|
|||
<< ", level0_compaction_trigger: " << _level0CompactionTrigger
|
||||
<< ", level0_slowdown_trigger: " << _level0SlowdownTrigger
|
||||
<< ", enable_pipelined_write: " << _enablePipelinedWrite
|
||||
<< ", optimize_filters_for_hits: " << _optimizeFiltersForHits
|
||||
<< ", use_direct_reads: " << _useDirectReads
|
||||
<< ", use_direct_io_for_flush_and_compaction: " << _useDirectIoForFlushAndCompaction
|
||||
<< ", use_fsync: " << _useFSync
|
||||
<< ", optimize_filters_for_hits: " << std::boolalpha << _optimizeFiltersForHits
|
||||
<< ", use_direct_reads: " << std::boolalpha << _useDirectReads
|
||||
<< ", use_direct_io_for_flush_and_compaction: " << std::boolalpha << _useDirectIoForFlushAndCompaction
|
||||
<< ", use_fsync: " << std::boolalpha << _useFSync
|
||||
<< ", allow_fallocate: " << std::boolalpha << _allowFAllocate
|
||||
<< ", max_open_files limit: " << std::boolalpha << _limitOpenFilesAtStartup
|
||||
<< ", dynamic_level_bytes: " << std::boolalpha << _dynamicLevelBytes;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,8 @@ class RocksDBOptionFeature final : public application_features::ApplicationFeatu
|
|||
bool _dynamicLevelBytes;
|
||||
bool _enableStatistics;
|
||||
bool _useFileLogging;
|
||||
bool _limitOpenFilesAtStartup;
|
||||
bool _allowFAllocate;
|
||||
};
|
||||
|
||||
} // namespace arangodb
|
||||
|
|
Loading…
Reference in New Issue