@@ -4,12 +4,14 @@ import (
4
4
"context"
5
5
"errors"
6
6
"fmt"
7
+ "runtime"
7
8
"sync"
8
9
"testing"
9
10
10
11
"github.com/NethermindEth/juno/db"
11
12
"github.com/NethermindEth/juno/utils"
12
13
"github.com/cockroachdb/pebble"
14
+ "github.com/cockroachdb/pebble/bloom"
13
15
"github.com/cockroachdb/pebble/vfs"
14
16
)
15
17
@@ -46,9 +48,21 @@ func NewWithOptions(path string, cacheSizeMB uint, maxOpenFiles int, colouredLog
46
48
}
47
49
48
50
return newPebble (path , & pebble.Options {
49
- Logger : dbLog ,
50
- Cache : pebble .NewCache (int64 (cacheSizeMB * utils .Megabyte )),
51
- MaxOpenFiles : maxOpenFiles ,
51
+ Logger : dbLog ,
52
+ Cache : pebble .NewCache (int64 (cacheSizeMB * utils .Megabyte )),
53
+ MaxOpenFiles : maxOpenFiles ,
54
+ MemTableSize : uint64 (cacheSizeMB * utils .Megabyte / 2 ),
55
+ MemTableStopWritesThreshold : 2 ,
56
+ MaxConcurrentCompactions : runtime .NumCPU ,
57
+ Levels : []pebble.LevelOptions {
58
+ {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
59
+ {TargetFileSize : 4 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
60
+ {TargetFileSize : 8 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
61
+ {TargetFileSize : 16 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
62
+ {TargetFileSize : 32 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
63
+ {TargetFileSize : 64 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
64
+ {TargetFileSize : 128 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
65
+ },
52
66
})
53
67
}
54
68
0 commit comments