diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-07-12 03:01:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-12 03:01:24 -0700 |
| commit | fba5219dab83f312de5a0b8ea7ace0e26f6e73a1 (patch) | |
| tree | 506a93d0720995bfee74c52adecce21a03e1d322 | |
| parent | 860c207c946bf1c1cac7f074324166bf0a99ecce (diff) | |
| parent | 26313060a305d429989d554cf0ad061c02b2c6cc (diff) | |
| download | seaweedfs-fba5219dab83f312de5a0b8ea7ace0e26f6e73a1.tar.xz seaweedfs-fba5219dab83f312de5a0b8ea7ace0e26f6e73a1.zip | |
Merge pull request #3303 from guol-fnst/loading_volume
speeding up loading volumes
| -rw-r--r-- | weed/storage/disk_location.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go index 847324838..a2a63acbb 100644 --- a/weed/storage/disk_location.go +++ b/weed/storage/disk_location.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "strings" "sync" "time" @@ -206,7 +207,11 @@ func (l *DiskLocation) concurrentLoadingVolumes(needleMapKind NeedleMapKind, con func (l *DiskLocation) loadExistingVolumes(needleMapKind NeedleMapKind) { - l.concurrentLoadingVolumes(needleMapKind, 10) + workerNum := runtime.NumCPU() + if workerNum <= 10 { + workerNum = 10 + } + l.concurrentLoadingVolumes(needleMapKind, workerNum) glog.V(0).Infof("Store started on dir: %s with %d volumes max %d", l.Directory, len(l.volumes), l.MaxVolumeCount) l.loadAllEcShards() |
