1
0
Fork 0

Increased default size for RocksDB block cache.

This commit is contained in:
Dan Larkin 2017-05-12 08:46:16 -04:00
parent d37d32b4e7
commit 024fccf82e
2 changed files with 16 additions and 6 deletions

View File

@ -103,13 +103,15 @@ setting this equal to `max-background-compactions`. Default: 1.
`--rocksdb.block-cache-size`
This is the size of the block cache in bytes. Increasing this may improve
performance. Default: 8MB.
performance. If there is less than 4GB of RAM on the system, the default value
is 256MB. If there is more, the default is `(system RAM size - 2GB) * 0.3`.
`--rocksdb.block-cache-shard-bits`
The number of bits used to shard the block cache to allow concurrent operations.
To keep individual shards at a reasonable size (i.e. at least 512KB), keep this
value to at most `block-cache-shard-bits / 512KB`. Default: 4.
value to at most `block-cache-shard-bits / 512KB`. Default: `block-cache-size /
2^19`.
`--rocksdb.recycle-log-file-num` (Hidden)

View File

@ -24,6 +24,7 @@
#include "RocksDBOptionFeature.h"
#include "Basics/Exceptions.h"
#include "Basics/FileUtils.h"
#include "Basics/process-utils.h"
#include "Basics/tri-strings.h"
#include "Logger/Logger.h"
#include "ProgramOptions/ProgramOptions.h"
@ -59,8 +60,10 @@ RocksDBOptionFeature::RocksDBOptionFeature(
_maxFlushes(rocksDBDefaults.max_background_flushes),
_numThreadsHigh(rocksDBDefaults.max_background_flushes),
_numThreadsLow(rocksDBDefaults.max_background_compactions),
_blockCacheSize(8 * 1024 * 1024),
_blockCacheShardBits(4),
_blockCacheSize((TRI_PhysicalMemory >= (static_cast<uint64_t>(4) << 30))
? ((TRI_PhysicalMemory - (static_cast<uint64_t>(2) << 30)) * 0.3)
: (256 << 20)),
_blockCacheShardBits(0),
_recycleLogFileNum(rocksDBDefaults.recycle_log_file_num),
_compactionReadaheadSize(rocksDBDefaults.compaction_readahead_size),
_verifyChecksumsInCompaction(
@ -70,11 +73,16 @@ RocksDBOptionFeature::RocksDBOptionFeature(
_useDirectWrites(rocksDBDefaults.use_direct_writes),
_useFSync(rocksDBDefaults.use_fsync),
_skipCorrupted(false) {
uint64_t testSize = _blockCacheSize >> 19;
while (testSize > 0) {
_blockCacheShardBits++;
testSize >>= 1;
}
setOptional(true);
requiresElevatedPrivileges(false);
startsAfter("DatabasePath");
// increase parallelism and re-fetch the number of threads
rocksDBDefaults.IncreaseParallelism(std::thread::hardware_concurrency());
_numThreadsHigh = rocksDBDefaults.max_background_flushes;