chore(model): increase default value for num hashers (#10761)
This commit is contained in:
+8
-21
@@ -2548,13 +2548,6 @@ func (m *model) DelayScan(folder string, next time.Duration) {
|
|||||||
func (m *model) numHashers(folder string) int {
|
func (m *model) numHashers(folder string) int {
|
||||||
m.mut.RLock()
|
m.mut.RLock()
|
||||||
folderCfg := m.folderCfgs[folder]
|
folderCfg := m.folderCfgs[folder]
|
||||||
numFolders := max(1, len(m.folderCfgs))
|
|
||||||
// MaxFolderConcurrency already limits the number of scanned folders, so
|
|
||||||
// prefer it over the overall number of folders to avoid limiting performance
|
|
||||||
// further for no reason.
|
|
||||||
if concurrency := m.cfg.Options().MaxFolderConcurrency(); concurrency > 0 {
|
|
||||||
numFolders = min(numFolders, concurrency)
|
|
||||||
}
|
|
||||||
m.mut.RUnlock()
|
m.mut.RUnlock()
|
||||||
|
|
||||||
if folderCfg.Hashers > 0 {
|
if folderCfg.Hashers > 0 {
|
||||||
@@ -2562,21 +2555,15 @@ func (m *model) numHashers(folder string) int {
|
|||||||
return folderCfg.Hashers
|
return folderCfg.Hashers
|
||||||
}
|
}
|
||||||
|
|
||||||
numCpus := runtime.GOMAXPROCS(-1)
|
numCPUs := runtime.GOMAXPROCS(-1)
|
||||||
if build.IsWindows || build.IsDarwin || build.IsIOS || build.IsAndroid {
|
switch {
|
||||||
// Interactive operating systems; don't load the system too heavily by
|
case build.IsWindows || build.IsIOS || build.IsAndroid:
|
||||||
// default.
|
// Use a quarter of the CPU cores on interactive or constrained OSes
|
||||||
numCpus = max(1, numCpus/4)
|
return max(1, numCPUs/4)
|
||||||
|
default:
|
||||||
|
// Otherwise use up to half
|
||||||
|
return max(1, numCPUs/2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// For other operating systems and architectures, lets try to get some
|
|
||||||
// work done... Divide the available CPU cores among the configured
|
|
||||||
// folders.
|
|
||||||
if perFolder := numCpus / numFolders; perFolder > 0 {
|
|
||||||
return perFolder
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateClusterConfig returns a ClusterConfigMessage that is correct and the
|
// generateClusterConfig returns a ClusterConfigMessage that is correct and the
|
||||||
|
|||||||
Reference in New Issue
Block a user