Jianghan 1 жил өмнө
parent
commit
f7e5c3661f
1 өөрчлөгдсөн 4 нэмэгдсэн , 1 устгасан
  1. 4 1
      CMPlatform/main.go

+ 4 - 1
CMPlatform/main.go

@@ -14,6 +14,7 @@ import (
 	"cmplatform/service"
 	"cmplatform/util"
 	"fmt"
+	"runtime"
 	"time"
 )
 
@@ -108,7 +109,9 @@ func initOther() {
 }
 
 func main() {
-
+	numCPU := runtime.NumCPU()
+	log.Debug(fmt.Sprintf("Number of CPUs: %d\n", numCPU))
+	runtime.GOMAXPROCS(numCPU / 2)
 	log.Debug("port:" + fmt.Sprint(util.Sysconfig["port"]))
 	xweb.Run(":" + common.ObjToString(util.Sysconfig["port"]))