1
0
Fork 0

Bug fix 3.3/rocksdb block cache shard bits adjustment (#4304)

make the default value of `--rocksdb.block-cache-shard-bits` use the RocksDB
default value. This will mostly mean the default number block cache shard
bits is lower than before, allowing each shard to store more data and cause
less evictions from block cache
This commit is contained in:
Jan 2018-01-15 22:45:49 +01:00 committed by GitHub
parent 589bc68957
commit 53b9633ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,11 @@
v3.3.3 (XXXX-XX-XX)
-------------------
* make the default value of `--rocksdb.block-cache-shard-bits` use the RocksDB
default value. This will mostly mean the default number block cache shard
bits is lower than before, allowing each shard to store more data and cause
less evictions from block cache
* fixed issue #4255: AQL SORT consuming too much memory

View File

@ -63,7 +63,7 @@ RocksDBOptionFeature::RocksDBOptionFeature(
_blockCacheSize((TRI_PhysicalMemory >= (static_cast<uint64_t>(4) << 30))
? static_cast<uint64_t>(((TRI_PhysicalMemory - (static_cast<uint64_t>(2) << 30)) * 0.3))
: (256 << 20)),
_blockCacheShardBits(0),
_blockCacheShardBits(-1),
_tableBlockSize(std::max(rocksDBTableOptionsDefaults.block_size, static_cast<decltype(rocksDBTableOptionsDefaults.block_size)>(16 * 1024))),
_recycleLogFileNum(rocksDBDefaults.recycle_log_file_num),
_compactionReadaheadSize(2 * 1024 * 1024),//rocksDBDefaults.compaction_readahead_size
@ -78,11 +78,6 @@ RocksDBOptionFeature::RocksDBOptionFeature(
_skipCorrupted(false),
_dynamicLevelBytes(true),
_enableStatistics(false) {
uint64_t testSize = _blockCacheSize >> 19;
while (testSize > 0) {
_blockCacheShardBits++;
testSize >>= 1;
}
// setting the number of background jobs to
_maxBackgroundJobs = static_cast<int32_t>(std::max((size_t)2,
std::min(TRI_numberProcessors(), (size_t)8)));
@ -91,7 +86,7 @@ RocksDBOptionFeature::RocksDBOptionFeature(
// compactions. Therefore it is possible for rocksdb to use all
// CPU time on compactions. Essential network communications can be lost.
// Save one CPU for ArangoDB network and other activities.
if (2<_maxBackgroundJobs) {
if (2 < _maxBackgroundJobs) {
--_maxBackgroundJobs;
} // if
#endif
@ -244,8 +239,8 @@ void RocksDBOptionFeature::collectOptions(
new UInt64Parameter(&_blockCacheSize));
options->addOption("--rocksdb.block-cache-shard-bits",
"number of shard bits to use for block cache",
new UInt64Parameter(&_blockCacheShardBits));
"number of shard bits to use for block cache (use -1 for default value)",
new Int64Parameter(&_blockCacheShardBits));
options->addOption("--rocksdb.table-block-size",
"approximate size (in bytes) of user data packed per block",
@ -306,7 +301,8 @@ void RocksDBOptionFeature::validateOptions(
if (_maxSubcompactions > _numThreadsLow) {
_maxSubcompactions = _numThreadsLow;
}
if (_blockCacheShardBits > 32) {
if (_blockCacheShardBits >= 20 || _blockCacheShardBits < -1) {
// -1 is RocksDB default value, but anything less is invalid
LOG_TOPIC(FATAL, arangodb::Logger::FIXME)
<< "invalid value for '--rocksdb.block-cache-shard-bits'";
FATAL_ERROR_EXIT();

View File

@ -63,7 +63,7 @@ class RocksDBOptionFeature final
uint32_t _numThreadsHigh;
uint32_t _numThreadsLow;
uint64_t _blockCacheSize;
uint64_t _blockCacheShardBits;
int64_t _blockCacheShardBits;
uint64_t _tableBlockSize;
uint64_t _recycleLogFileNum;
uint64_t _compactionReadaheadSize;