Browse Source

volume: optimzation for leveldb

pull/991/head
Chris Lu 6 years ago
parent
commit
76cf57a0e1
  1. 3
      weed/storage/volume_loading.go

3
weed/storage/volume_loading.go

@ -88,6 +88,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
opts := &opt.Options{ opts := &opt.Options{
BlockCacheCapacity: 2 * 1024 * 1024, // default value is 8MiB BlockCacheCapacity: 2 * 1024 * 1024, // default value is 8MiB
WriteBuffer: 1 * 1024 * 1024, // default value is 4MiB WriteBuffer: 1 * 1024 * 1024, // default value is 4MiB
CompactionTableSizeMultiplier: 10, // default value is 1
} }
if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile, opts); e != nil { if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile, opts); e != nil {
glog.V(0).Infof("loading leveldb %s error: %v", fileName+".ldb", e) glog.V(0).Infof("loading leveldb %s error: %v", fileName+".ldb", e)
@ -97,6 +98,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
opts := &opt.Options{ opts := &opt.Options{
BlockCacheCapacity: 4 * 1024 * 1024, // default value is 8MiB BlockCacheCapacity: 4 * 1024 * 1024, // default value is 8MiB
WriteBuffer: 2 * 1024 * 1024, // default value is 4MiB WriteBuffer: 2 * 1024 * 1024, // default value is 4MiB
CompactionTableSizeMultiplier: 10, // default value is 1
} }
if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile, opts); e != nil { if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile, opts); e != nil {
glog.V(0).Infof("loading leveldb %s error: %v", fileName+".ldb", e) glog.V(0).Infof("loading leveldb %s error: %v", fileName+".ldb", e)
@ -106,6 +108,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
opts := &opt.Options{ opts := &opt.Options{
BlockCacheCapacity: 8 * 1024 * 1024, // default value is 8MiB BlockCacheCapacity: 8 * 1024 * 1024, // default value is 8MiB
WriteBuffer: 4 * 1024 * 1024, // default value is 4MiB WriteBuffer: 4 * 1024 * 1024, // default value is 4MiB
CompactionTableSizeMultiplier: 10, // default value is 1
} }
if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile, opts); e != nil { if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile, opts); e != nil {
glog.V(0).Infof("loading leveldb %s error: %v", fileName+".ldb", e) glog.V(0).Infof("loading leveldb %s error: %v", fileName+".ldb", e)

Loading…
Cancel
Save