Skip to content

Commit

Permalink
Set max WAL size for both rocksdb instances.
Browse files Browse the repository at this point in the history
Increase block cache size.
  • Loading branch information
aalda committed Apr 2, 2019
1 parent a941df5 commit 9ac5a54
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion raftwal/raftrocks/rocksdb_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func New(options Options) (*RocksDBStore, error) {
globalOpts := rocksdb.NewDefaultOptions()
globalOpts.SetCreateIfMissing(true)
globalOpts.SetCreateIfMissingColumnFamilies(true)
globalOpts.SetMaxTotalWalSize(3 * 256 * 1024 * 1024) // write_buffer_size (256MB) * 3

// stable store options
stableBbto := rocksdb.NewDefaultBlockBasedTableOptions()
Expand Down Expand Up @@ -132,7 +133,7 @@ func New(options Options) (*RocksDBStore, error) {
logOpts.SetLevel0FileNumCompactionTrigger(8)
logOpts.SetLevel0SlowdownWritesTrigger(17)
logOpts.SetLevel0StopWritesTrigger(24)
logOpts.SetMaxWriteBufferNumber(25)
logOpts.SetMaxWriteBufferNumber(5)
logOpts.SetNumLevels(7)
// MaxBytesForLevelBase is the total size of L1, should be close to
// the size of L0
Expand Down
2 changes: 1 addition & 1 deletion rocksdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func (db *DB) NewIteratorCF(ro *ReadOptions, cf *ColumnFamilyHandle) *Iterator {
return NewNativeIterator(unsafe.Pointer(cIter))
}

// Flush triggers a manuel flush for the database.
// Flush triggers a manual flush for the database.
func (db *DB) Flush(fo *FlushOptions) error {
var cErr *C.char
C.rocksdb_flush(db.c, fo.c, &cErr)
Expand Down
3 changes: 2 additions & 1 deletion storage/rocks/rocksdb_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ func NewRocksDBStoreOpts(opts *Options) (*RocksDBStore, error) {
globalOpts := rocksdb.NewDefaultOptions()
globalOpts.SetCreateIfMissing(true)
globalOpts.SetCreateIfMissingColumnFamilies(true)
globalOpts.SetMaxTotalWalSize(3 * 256 * 1024 * 1024) // 256MB * 3
//globalOpts.SetMaxOpenFiles()
globalOpts.SetEnv(env)
blockCache := rocksdb.NewDefaultLRUCache(512 * 1024 * 1024) // 512MB
blockCache := rocksdb.NewDefaultLRUCache(6 * 1024 * 1024 * 1024) // 6GB
var stats *rocksdb.Statistics
if opts.EnableStatistics {
stats = rocksdb.NewStatistics()
Expand Down

0 comments on commit 9ac5a54

Please sign in to comment.