From 4f292c5003440f1daa838c4529109eef195f8846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 31 Dec 2021 19:45:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E8=8A=82=E7=82=B9CPU=E7=BA=BF=E7=A8=8B=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E9=BB=98=E8=AE=A4=E4=B8=BA4=E5=80=8D?= =?UTF-8?q?=E7=9A=84CPU=E7=BA=BF=E7=A8=8B=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/node.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/nodes/node.go b/internal/nodes/node.go index d01f6ea..3ed116e 100644 --- a/internal/nodes/node.go +++ b/internal/nodes/node.go @@ -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())+"'") }