github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/remotewrite/concurrency.go (about)

     1  package remotewrite
     2  
     3  import "runtime"
     4  
     5  const queueFactor = 4
     6  const maxWorkers = 64
     7  
     8  // This number is used for the HTTP client as well as the client queue
     9  func numWorkers() int {
    10  	v := runtime.NumCPU() * queueFactor
    11  	if v > maxWorkers {
    12  		return maxWorkers
    13  	}
    14  	return v
    15  }