Fix default options

This commit is contained in:
Andrea Cavalli 2022-05-29 23:48:40 +02:00
parent 23d70e55bd
commit e1bd57c837

View File

@ -924,22 +924,22 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
compressedCache = null; compressedCache = null;
} }
if (databaseOptions.spinning()) {
options
// method documentation
.setCompactionReadaheadSize(16 * SizeUnit.MB)
// guessed
.setWritableFileMaxBufferSize(16 * SizeUnit.MB);
}
if (databaseOptions.useDirectIO()) { if (databaseOptions.useDirectIO()) {
options options
// Option to enable readahead in compaction // Option to enable readahead in compaction
// If not set, it will be set to 2MB internally // If not set, it will be set to 2MB internally
.setCompactionReadaheadSize(2 * SizeUnit.MB) // recommend at least 2MB .setCompactionReadaheadSize(2 * SizeUnit.MB) // recommend at least 2MB
// Option to tune write buffer for direct writes // Option to tune write buffer for direct writes
.setWritableFileMaxBufferSize(2 * SizeUnit.MB) .setWritableFileMaxBufferSize(SizeUnit.MB)
; ;
} }
if (databaseOptions.spinning()) {
options
// method documentation
.setCompactionReadaheadSize(4 * SizeUnit.MB)
// guessed
.setWritableFileMaxBufferSize(2 * SizeUnit.MB);
}
} else { } else {
// HIGH MEMORY // HIGH MEMORY
options options
@ -965,11 +965,18 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
options options
// Option to enable readahead in compaction // Option to enable readahead in compaction
// If not set, it will be set to 2MB internally // If not set, it will be set to 2MB internally
.setCompactionReadaheadSize(4 * 1024 * 1024) // recommend at least 2MB .setCompactionReadaheadSize(4 * SizeUnit.MB) // recommend at least 2MB
// Option to tune write buffer for direct writes // Option to tune write buffer for direct writes
.setWritableFileMaxBufferSize(4 * 1024 * 1024) .setWritableFileMaxBufferSize(2 * SizeUnit.MB)
; ;
} }
if (databaseOptions.spinning()) {
options
// method documentation
.setCompactionReadaheadSize(16 * SizeUnit.MB)
// guessed
.setWritableFileMaxBufferSize(8 * SizeUnit.MB);
}
options.setIncreaseParallelism(Runtime.getRuntime().availableProcessors()); options.setIncreaseParallelism(Runtime.getRuntime().availableProcessors());
} }
@ -977,6 +984,8 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
var writeBufferManager = new WriteBufferManager(writeBufferManagerSize, blockCache, false); var writeBufferManager = new WriteBufferManager(writeBufferManagerSize, blockCache, false);
refs.track(writeBufferManager); refs.track(writeBufferManager);
options.setWriteBufferManager(writeBufferManager); options.setWriteBufferManager(writeBufferManager);
} else {
options.setWriteBufferManager(null);
} }
if (databaseOptions.useDirectIO()) { if (databaseOptions.useDirectIO()) {
@ -991,7 +1000,7 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
.setAllowMmapWrites(databaseOptions.allowMemoryMapping()); .setAllowMmapWrites(databaseOptions.allowMemoryMapping());
} }
if (!databaseOptions.allowMemoryMapping()) { if (databaseOptions.useDirectIO() || !databaseOptions.allowMemoryMapping()) {
options.setUseDirectIoForFlushAndCompaction(true); options.setUseDirectIoForFlushAndCompaction(true);
} }