starsz commented on a change in pull request #1569:
URL: https://github.com/apache/apisix-dashboard/pull/1569#discussion_r590496205



##########
File path: api/internal/conf/conf.go
##########
@@ -249,3 +254,16 @@ func initEtcdConfig(conf Etcd) {
                Prefix:    prefix,
        }
 }
+
+// initialize parallelism settings
+func initParallelism(choiceCores int) {
+       if choiceCores < 0 {
+               return
+       }
+       maxSupportedCores := runtime.NumCPU()
+
+       runtime.GOMAXPROCS(maxSupportedCores)
+       if choiceCores < maxSupportedCores {
+               runtime.GOMAXPROCS(choiceCores)
+       }

Review comment:
       > GOMAXPROCS sets the maximum number of CPUs that can be executing 
simultaneously and returns the previous setting. It defaults to the value of 
runtime.NumCPU. If n < 1, it does not change the current setting. This call 
will go away when the scheduler improves.
   
   As the doc said, I think this will be more clear.
   
   ```golang
   maxSupportedCores := runtime.NumCPU()
   if choiceCores > maxSupportedCores {
         choiceCores = maxSupportedCores
   }
   
   runtime.GOMAXPROCS(choiceCores)
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to