diff --git a/dgraph/cmd/server/run.go b/dgraph/cmd/server/run.go index 2d2f07b88a43263104138122565670eff7234898..f98278938cdd7de2d4b277b71d882788e5d94e32 100644 --- a/dgraph/cmd/server/run.go +++ b/dgraph/cmd/server/run.go @@ -62,15 +62,16 @@ func init() { "Directory to store posting lists.") // Options around how to set up Badger. + flag.String("badger.options", defaults.BadgerOptions, + "[ssd, hdd] Specifies which Badger options to use. SSD decreases write amplification"+ + " and increases read IOPS. HDD does the opposite.") flag.String("badger.tables", defaults.BadgerTables, - "Specifies how Badger LSM tree is stored. Options are ram, mmap and "+ - "disk; which consume most to least RAM while providing best to worst read"+ + "[none, ram, mmap, disk] Specifies how Badger LSM tree is stored. "+ + "Option sequence consume most to least RAM while providing best to worst read "+ "performance respectively.") flag.String("badger.vlog", defaults.BadgerVlog, - "Specifies how Badger Value log is stored. Options are mmap and disk."+ + "[none, mmap, disk] Specifies how Badger Value log is stored."+ " mmap consumes more RAM, but provides better performance in some cases.") - flag.String("badger.options", defaults.BadgerOptions, - "Specifies which Badger options to use. Choices are default and lsmonly.") flag.StringP("wal", "w", defaults.WALDir, "Directory to store raft write-ahead logs.") diff --git a/dgraph/cmd/zero/run.go b/dgraph/cmd/zero/run.go index bcb6e0274327a67b767ac17a193b0d9bed64559e..f87f4c7d63520676748df9121b2ebcf41c37fc54 100644 --- a/dgraph/cmd/zero/run.go +++ b/dgraph/cmd/zero/run.go @@ -23,7 +23,6 @@ import ( "google.golang.org/grpc" "github.com/dgraph-io/badger" - bopts "github.com/dgraph-io/badger/options" "github.com/dgraph-io/dgraph/conn" "github.com/dgraph-io/dgraph/protos/intern" "github.com/dgraph-io/dgraph/raftwal" @@ -167,11 +166,10 @@ func run() { // Open raft write-ahead log and initialize raft node. x.Checkf(os.MkdirAll(opts.w, 0700), "Error while creating WAL dir.") - kvOpt := badger.DefaultOptions + kvOpt := badger.LSMOnlyOptions kvOpt.SyncWrites = true kvOpt.Dir = opts.w kvOpt.ValueDir = opts.w - kvOpt.ValueLogLoadingMode = bopts.FileIO kv, err := badger.Open(kvOpt) x.Checkf(err, "Error while opening WAL store") defer kv.Close() diff --git a/edgraph/config.go b/edgraph/config.go index b9f727b98022e269ae5a1eff240ffa9de67f3507..1c25c90eac076b9401c109ae25da5854bc85a582 100644 --- a/edgraph/config.go +++ b/edgraph/config.go @@ -50,8 +50,8 @@ var Config Options var DefaultConfig = Options{ PostingDir: "p", BadgerTables: "mmap", - BadgerVlog: "mmap", - BadgerOptions: "default", + BadgerVlog: "none", + BadgerOptions: "ssd", WALDir: "w", Nomutations: false, diff --git a/edgraph/server.go b/edgraph/server.go index c8c0796c4c3cbab6ff45fb0f547c031a4d1b6463..9ddad3850e2f698ee37368642f98a9c734ce80e6 100644 --- a/edgraph/server.go +++ b/edgraph/server.go @@ -99,7 +99,7 @@ func (s *ServerState) runVlogGC(store *badger.ManagedDB) { func (s *ServerState) initStorage() { // Write Ahead Log directory x.Checkf(os.MkdirAll(Config.WALDir, 0700), "Error while creating WAL dir.") - kvOpt := badger.DefaultOptions + kvOpt := badger.LSMOnlyOptions kvOpt.SyncWrites = true kvOpt.Dir = Config.WALDir kvOpt.ValueDir = Config.WALDir @@ -116,9 +116,9 @@ func (s *ServerState) initStorage() { x.Printf("Setting Badger option: %s", Config.BadgerOptions) var opt badger.Options switch Config.BadgerOptions { - case "default": + case "ssd": opt = badger.DefaultOptions - case "lsmonly": + case "hdd": opt = badger.LSMOnlyOptions default: x.Fatalf("Invalid Badger options") @@ -130,6 +130,7 @@ func (s *ServerState) initStorage() { x.Printf("Setting Badger table load option: %s", Config.BadgerTables) switch Config.BadgerTables { + case "none": // Use default based on BadgerOptions. case "mmap": opt.TableLoadingMode = options.MemoryMap case "ram": @@ -142,6 +143,7 @@ func (s *ServerState) initStorage() { x.Printf("Setting Badger value log load option: %s", Config.BadgerVlog) switch Config.BadgerVlog { + case "none": // Use default based on BadgerOptions. case "mmap": opt.ValueLogLoadingMode = options.MemoryMap case "disk":