如果没有设置节点CPU线程数,则默认为4倍的CPU线程数

This commit is contained in:
GoEdgeLab
2021-12-31 19:45:54 +08:00
parent 9cbb96e989
commit acdfbb2c37

View File

@@ -635,6 +635,9 @@ func (this *Node) listenSock() error {
"limiter": sharedConnectionsLimiter.Len(),
},
})
case "gc":
runtime.GC()
debug.FreeOSMemory()
}
})
@@ -660,7 +663,7 @@ func (this *Node) onReload(config *nodeconfigs.NodeConfig) {
runtime.GOMAXPROCS(int(config.MaxCPU))
remotelogs.Println("NODE", "[CPU]set max cpu to '"+types.String(config.MaxCPU)+"'")
} else {
runtime.GOMAXPROCS(runtime.NumCPU())
runtime.GOMAXPROCS(runtime.NumCPU() * 4)
remotelogs.Println("NODE", "[CPU]set max cpu to '"+types.String(runtime.NumCPU())+"'")
}