Improve performance

This commit is contained in:
Andrea Cavalli 2021-03-17 01:02:02 +01:00
parent fd4f8e77d6
commit 9fc58eae2b
3 changed files with 9 additions and 3 deletions

View File

@ -42,7 +42,10 @@ public class LLLocalKeyPrefixReactiveRocksIterator {
return Flux
.generate(() -> {
var readOptions = new ReadOptions(this.readOptions);
readOptions.setFillCache(range.hasMin() && range.hasMax());
if (!range.hasMin() || !range.hasMax()) {
readOptions.setReadaheadSize(2 * 1024 * 1024);
readOptions.setFillCache(false);
}
Slice sliceMin;
Slice sliceMax;
if (range.hasMin()) {

View File

@ -82,7 +82,7 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
if (lowMemory) {
this.dbScheduler = lowMemorySupplier.get();
} else {
this.dbScheduler = Schedulers.newBoundedElastic(Runtime.getRuntime().availableProcessors(),
this.dbScheduler = Schedulers.newBoundedElastic(Schedulers.DEFAULT_BOUNDED_ELASTIC_SIZE,
Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE,
"db-" + name,
60,

View File

@ -37,7 +37,10 @@ public abstract class LLLocalReactiveRocksIterator<T> {
return Flux
.generate(() -> {
var readOptions = new ReadOptions(this.readOptions);
readOptions.setFillCache(range.hasMin() && range.hasMax());
if (!range.hasMin() || !range.hasMax()) {
readOptions.setReadaheadSize(2 * 1024 * 1024);
readOptions.setFillCache(false);
}
Slice sliceMin;
Slice sliceMax;
if (range.hasMin()) {